NSF Unidata

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

Re: 20030926:aggregate different netCDF files

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.



Hi All,

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

>(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.

Good luck,
Charlie

P.S. The correct place to post NCO questions is shown on nco.sf.net
--

Charlie Zender, zender at uci dot edu, (949) 824-2987, Department of
Earth System Science, University of California, Irvine CA 92697-3100