[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20030926:aggregate different netCDF files



Hi Charlie,

> These additional hints to Russ' solution solve the problem without
> invoking an editor:
> 
>  >You can almost do this with the ncecat program, but it creates a
>  >record dimension that you may not want.  For example, if you run
>  >
>  > ncecat lev-1000-Time-0.nc lev-950-Time-0.nc ... lev-200-Time-0.nc 
> Time-0.nc
> 
> Shell filename globbing also works fine here:
> 
> ncecat lev-*-Time-0.nc Time-0.nc

... except filename globbing puts the data in a different order,
alphabetically by filename, which would put the 200 mbar level after
between the 1000 mbar and 300 mbar level.

>  >(where I've used "..." to save typing), you get a file with the first
>  >time and all 10 levels, but now have a record dimension of 10, where 1
>  >record is used for each level, something like:
>  >
>  > float var(record, Time, lev, Lon, Lat) ;
>  >
>  >with lev of size 1 and record of size 10, instead of
> 
> and also a time of size 1. Perhaps the easiest  NCO strategy is to
> average over the degenerate dimensions then renaming "record" to lev:
> 
> ncwa -O -a Time,lev Time-0.nc Time-0.nc
> ncrename -d record,lev Time-0.nc
> 
> Now you will have
> 
> float var(lev, Lon, Lat) ;
> 
> which is presumably what you want.

I didn't know about averaging over degenerate dimensions.  That's a
good technique to know about.

--Russ