[Thread Prev][Thread Next][Index]
Re: [ferret_users] Problem in preparing monthly climatology using multiple netcdf files
Hi
The NCO commands ncecat can do this.
# Create a file with Time as a degenerate record dimension
ncecat -u Time file_in.nc file_out.nc
You probably then need to populate a "Time" variable
You could just make a small template netcdf file with just the
appropriate time and append in to the file created above using ncks.
russ-hf% ncdump time.nc
netcdf time {
dimensions:
Time = UNLIMITED ; // (1 currently)
variables:
double Time(Time) ;
data:
Time = 1 ;
}
Create a netcdf file using ncgen.
There are probably plenty of wasys to do this.
Russ
On Thu, 2012-08-09 at 09:50 +1000, Ansley Manke wrote:
> Hi,
> For our users who are familiar with NCO, are there tools there that
> would let Sreejith add a time dimension to the files and to the grids of
> the variables in the files? If that's possible, then one could use a
> descriptor file and bypass the step of putting the data from all the
> files into one big monthly dataset and then forming the climatology from
> that.
>
> If not, then the thing to do is described under the documentation under
> the topic "timestamp". You define the final time axis as a monthly axis
> with the range of dates for the set of monthly files. Then define a
> variable which adds the dataset variable to a variable which is zero at
> all timesteps of the long monthly axis. Write out just the timestep
> that corresponds to that file, appending to a monthly data file.
>
> yes? define axis/t=1-jan-1871:31-dec-1881:1/units=months/edges monthtime
> yes? let timestamp = 0* t[gt=monthtime]
>
> (This makes an evenly-spaced axis - there are other ways to define
> monthly time axes. See entries under "axis" in the Ferret Users Guide
> index).
>
> Then look at this,
> http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/SAVE#timestamp
>
> Where we'd open each file, define a variable that adds the file variable
> to "timestamp", and save/append/t= where t= specifies the appropriate
> month, to add them all to a file containing all of the months.
>
> Finally, have a look at this FAQ on creating a climatology:
> http://ferret.pmel.noaa.gov/Ferret/faq/how-do-i-calculate-climatologies-and-climatological-anomalies
>
> Ansley
>
> On 8/8/2012 12:24 PM, sreejith k.s wrote:
> > Dear all,
> > I am facing some problem in preparing monthly climatoloy using around
> > 120 files covering 10 years.
> >
> > 1) Please see the files as shown below.
> > SODA_2.2.4_187101.cdf
> > SODA_2.2.4_187102.cdf
> > SODA_2.2.4_187103.cdf
> > ..................................................
> > ..................................................
> > ..................................................
> > SODA_2.2.4_188012.cdf
> >
> > 2) For example, the "ncdump -h" command for one of these files will
> > give the following result.
> >
> > netcdf SODA_2.2.4_187312 {
> > dimensions:
> > lon = 720 ;
> > lat = 330 ;
> > depth = 40 ;
> > variables:
> > float temp(depth, lat, lon) ;
> > temp:long_name = "TEMPERATURE" ;
> > temp:units = "deg. C" ;
> > temp:_FillValue = -9.99e+33f ;
> > float salt(depth, lat, lon) ;
> > salt:long_name = "SALINITY" ;
> > salt:units = "g/kg" ;
> > salt:_FillValue = -9.99e+33f ;
> > float u(depth, lat, lon) ;
> > u:long_name = "ZONAL VELOCITY" ;
> > u:units = "m/sec" ;
> > u:_FillValue = -9.99e+33f ;
> > float v(depth, lat, lon) ;
> > v:long_name = "MERIDIONAL VELOCITY" ;
> > v:units = "m/sec" ;
> > v:_FillValue = -9.99e+33f ;
> > float w(depth, lat, lon) ;
> > w:long_name = "VERTICAL VELOCITY" ;
> > w:units = "m/sec" ;
> > w:_FillValue = -9.99e+33f ;
> > float taulat, lon) ;
> > taux:long_name = "TAUX" ;
> > taux:units = "N/m^2" ;
> > taux:_FillValue = -9.99e+33f ;
> > float tauy(lat, lon) ;
> > tauy:long_name = "TAUY" ;
> > tauy:units = "N/m^2" ;
> > tauy:_FillValue = -9.99e+33f ;
> > float ssh(lat, lon) ;
> > ssh:long_name = "SEA SURFACE HEIGHT" ;
> > ssh:units = "m" ;
> > ssh:_FillValue = -9.99e+33f ;
> > double lon(lon) ;
> > lon:units = "degrees_east" ;
> > double lat(lat) ;
> > lat:units = "degrees_north" ;
> > double depth(depth) ;
> > depth:units = "meters" ;
> > depthositive = "down" ;
> >
> > // global attributes:
> > :title = "SODA 2.2.4, 1871-2008 Assimilation Run" ;
> > :released = "July 20, 2010" ;
> > ata_timestamp = "12-1873" ;
> >
> > The point to be noted here is that there is no time axis in these
> > files (as it shows only lat,lon and depth). Because of this, merging
> > these files using "cdo" command - "cdo -r
> > mergetime" is found to be not working.
> >
> > Hence I am interested to know two things.
> > 1) How to merge/append all these 120 files into a single file and that
> > should also give the time axis as time = 120
> > 2) After getting the appended file how to prepare monthly climatology
> > using the appended file.
> > 3) Is there any other way of preparing the monthly climatology of
> > above 120 monthly files without going to the step of "creating an
> > appended data file"?
> >
> > If anybody know a work around, please help me.
> >
> > Thanks in advance
> >
> > Sreejith.
> >
>
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
Ferret
Privacy Policy | Disclaimer | Accessibility Statement