Skip to content
Prev 351065 / 398502 Next

About manipulating NetCDF files in ncdf package.

Hi Thanh:

You are confounding  several issues here, and are providing only incomplete information about your data.  The confounded issues are:

1.  How to write a netcdf with a given coordinate system.

2.  How to calculate a monthly average or monthly subsample from a larger sample.

I would guess that you data are really dimensioned something like (time,lat, lon) and what would help is showing the results of say:

str(u_w)

Also, in your original netcdf file there were probably coordinate variables for time, latitude and longitude, you need to read those in and be aware of their dimensions, and the latitude and longitude data will form the basis of your new netcdf file.

To create and write a new netcdf file you will need to understand somewhat the structure of a netcdf file.  As the help for the ncdf4-package says:
Also look at the following web site:

https://www.image.ucar.edu/GSP/Software/Netcdf/

As for issue two, your data are just 3-D arrays, and it is just a question of normal array averaging or other operations to get you monthly data.

HTH,

-Roy
**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.