[Thread Prev][Thread Next][Index]

Re: Concatenating netcdf files along time dim



hello,
	there must be a better way to do this. Here I'm just pointing
out one way which is working for me. I'm copying the .jnl file first:

!==============================================================
! Concatenate 5 files with single time point and different time
!  origin.
 can dat/all

! open all the 5 files
 use grex01.nc
 use grex02.nc
 use grex03.nc
 use grex04.nc
 use grex05.nc

! define a time axis for the new concatenated variable. In this case
!  time increment is daily and there are 5 days of data.
 def axis/t="01-jan-2003:12:00":"05-jan-2003:12:00":1/units=days tax

! define a series of variables. var1 is the final 'concatenated'
!  variable. (If you have many many days, it may be possible to write
!  these series of variable definitions in a single repeat loop).
 let var1 = if (l eq 1) then var[d=1,gx=var,gy=var,gt=tax] else var2
 let var2 = if (l eq 2) then var[d=2,gx=var,gy=var,gt=tax] else var3
 let var3 = if (l eq 3) then var[d=3,gx=var,gy=var,gt=tax] else var4
 let var4 = if (l eq 4) then var[d=4,gx=var,gy=var,gt=tax] else var5
 let var5 = if (l eq 5) then var[d=5,gx=var,gy=var,gt=tax]

 list var1

 contour var1[l=@ave]
 go land

 save/clo/file=grex01-05.nc var1
! end of .jnl file =============


Here I'm including the ncdump-ed output of one of my .nc files:
netcdf grex01 {
dimensions:
        lon = 6 ;
        lat = 3 ;
        time = UNLIMITED ; // (1 currently)
variables:
        float lon(lon) ;
                lon:units = "degrees_east" ;
                lon:long_name = "Longitude" ;
                lon:actual_range = 3.082857e-44f, 2.009861f ;
        float lat(lat) ;
                lat:units = "degrees_north" ;
                lat:long_name = "Latitude" ;
                lat:actual_range = 32.12643f, 3.041262e-23f ;
        double time(time) ;
                time:units = "days since 2003-01-01 12:00:00" ;
                time:long_name = "Time" ;
                time:valid_min = 0. ;
        float var(time, lat, lon) ;
                var:units = "put_the_unit" ;
                var:long_name = "This is long name of the variable" ;
                var:missing_value = -999.9f ;

// global attributes:
                :var_desc = "You can have a global attribute here" ;


 Hope this helps,

~ Arindam C

On Tue, 9 Sep 2003 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" ;
> 




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement