[Thread Prev][Thread Next][Index]

Re: Concatenating netcdf files along time dim



Thanks to Arindam C, Rost Parsons, Ansley M, and Mick Spillane for their
helpful responses.

Although somewhat unrelated to Ferret, I've decided that the most
straightforward solution for my situation is to use NCO (netcdf
operators, by Charlie Zender).  I cannot use 'ncrcat' directly as it
currently doesn't interpret the time variable when concatenating files
with different time origins.  I therefore will first have to use 'ncap'
to modify the time values to be consistent with one time origin.  For
example:

ncap -s "time=time+31" feb.nc feb-new.nc
ncap -s "time=time+59" mar.nc mar-new.nc
ncrcat  jan.nc feb-new.nc mar-new.nc jan_feb_mar.nc

where
jan.nc has time units as "days since 2003-01-01 00:00:00 +00:00"
feb.nc has time units as "days since 2003-02-01 00:00:00 +00:00"
mar.nc has time units as "days since 2003-03-01 00:00:00 +00:00"

Thanks again for all your educational responses.

-Kek
Physical Oceanography
Singapore

-------- Original Message --------
Subject: Re: Concatenating netcdf files along time dim
Date: Tue, 09 Sep 2003 08:42:45 -0700
From: Ansley Manke <Ansley.B.Manke@noaa.gov>
To: hengkek@nus.edu.sg
CC: Ferret User's group <ferret_users@ferret.wrc.noaa.gov>
References: <3F5D9BCB.3BB91FF@nus.edu.sg>

Hi Kek,
Another method is to use a multi-file cdf data set with a descriptor
file,
see "descriptor file" in the Users Guide.  This way you do not need to
create a new NetCDF file, but only the descriptor.  The files can be
associated into a multi-file dataset regardless of how their internal
time
dimensions are defined (if you are running Ferret v5.33 or later).  An
example is given in the responses to this question from the Ferret email
list archives:
http://ferret.pmel.noaa.gov/Ferret/Mail_Archives/fu_2002/msg00010.html

Or, to write a new NetCDF file, please see "append, time step to
NetCDF file" in the Ferret Users Guide for an example of how to do
this in Ferret.  When your input files are NetCDF files themselves, you
would define the time axes as in the example and regrid in time to the
new time axis using the @ASN regridding transformation, then append
the time step to your output NetCDF file.

Ansley Manke

hengkek@nus.edu.sg wrote:

> Hello people
>
> I'm trying my luck here to see if anyone has successfully used ferret to
> concatenate a series of netcdf files with the following properties:
>
> 1- Record variable is 'time'
> 2- One record per file
> 3- Value of "time" variable is '0.0' for each file.
> 4- Each file's origin for the time variable is different.
>
> I'd be most grateful for some tips or pointers to docs.  I was getting
> the error below.  I was hoping Ferret would magically recalculate all
> the time values to values relative to one single arbitrary origin.
>
> Thanks.
>
> -Kek
> Physical Oceanography
> Singapore
>
> -------------
> use x1.nc
> save/file=z.nc/append eee
>  LISTing to file z.nc
> use x2.nc
> save/file=z.nc/append eee
>  LISTing to file z.nc
>  **TMAP ERR: error in line definition
>              disordered output coordinate value: 2.08333E-03 Axis: TIME
> LIST/FORMAT=CDF/file=z.nc/append eee
> Command file, command group, or REPEAT execution aborted
> -------------
>
> x1.nc and x2.nc have different time origins.
>
> The netcdf file structure is as follows:
>
> dimensions:
>         z = 20 ;
>         lat = 199 ;
>         lon = 133 ;
>         time = UNLIMITED ; // (1 currently)
> ...
>         float time(time) ;
>                 time:long_name = "time" ;
>                 time:units = "days since 2003-01-01 00:00:00 +00:00" ;

--
Ansley Manke  Pacific Marine Environmental Laboratory  Seattle WA


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement