[Thread Prev][Thread Next][Index]

Re: [ferret_users] time axis issue / appending netcdf files



Hi Vincent,

You can fix this with a single command.  You just need to replace the time axis of the second data set with a new one that encodes time consistently with the first -- with the same time origin.  There are a number of details not given in your description, so below is a generic description of the technique.  'varname' is the name of any variable in the dataset.  Two possible ways to formulate the new time axis are in bold, below. 
yes?  set data my_1850_2005_dset.nc
yes?  set data my_2006_2012_dset.nc
yes? ... find the name of the time axis of dataset2
            Either manually use SHOW GRID on one of the variables
            Or use `varname[d=2],return=taxis`, which returns the name of the time axis

! if the axis is regularly spaced in time, you can use this
yes? DEFINE AXIS/unit=days/t0="1850-01-01 00:00:00"/t=start:end `varname[d=2],return=taxis`

! if the axis is irregularly spaced something like this
let days_offset = DAYS1900(2006,1,1)-DAYS1900(1850,1,1)
yes? DEFINE AXIS/unit=days/t0="1850-01-01 00:00:00" `varname[d=2],return=taxis` = T[g=varname[d=2]] + days_offset

Here's a min-example, where I redefine the monthly climatology time axis of the COADS_CLIMATOLOGY dataset using this technique.  The new time axis appears to be 12 days in January of 1900.
yes? use coads_climatology
yes? say `sst,return=taxis`
 !-> MESSAGE/CONTINUE TIME
TIME
yes? define axis/t0="1-jan-1900"/units=days time=L[l=1:12]  ! time coordinates 1, 2, 3, ... 12
Replacing definition of axis TIME
 *** NOTE: grid  used by data set coads_climatology
 *** NOTE: Redefinition may alter apparent contents of data set
yes? plot sst[x=160e:160e@ave,y=5s:5n@ave]




On 4/17/2012 2:03 AM, vincent le fouest wrote:
Dear users,

I would like to append two netcdf files that follow up on time, but in which t starting index is same:

File 1 (1 jan 1850 to 31 dec 2005, monthly) time header is:

double TIME(TIME) ;
        TIME:bounds = "TIME_bnds" ;
        TIME:units = "days since 1850-01-01 00:00:00" ;
        TIME:calendar = "noleap" ;
        TIME:axis = "T" ;
        TIME:long_name = "time" ;
    double TIME_bnds(TIME, bnds) ;

File 2 (1 jan 2006 to 31 dec 2012, monthly) time header is:

double TIME(TIME) ;
        TIME:units = "days since 2006-01-01 00:00:00" ;
        TIME:time_origin = "01-JAN-2006 00:00:00" ;
        TIME:calendar = "NOLEAP" ;
        TIME:axis = "T" ;
        TIME:bounds = "TIME_bnds" ;
    double TIME_bnds(TIME, bnds) ;

For both files TIME starts at the same t index

data:

 TIME = 15.5, 45, 74.5, etc...

I guess this is the reason why the append command does not work on. Would you please have an idea on how I could solve this?

Best regards,

Vincent

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement