Re: Time unlimited.

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Fri, 08 Feb 2008 19:03:55 -0700

Yi,

You mean you actually want to change each file on disk, right?

Because of the fundamental structure of Netcdf 3 files, each file
must be completely rewritten when changing a dimension from limited
to unlimited, or reverse.

The simplest and most robust method that I know does not use NCL.
This changes the time dimension from limited to unlimited. Reverse
str1 and str2 to go the other way. Change the dim name and integer
value to match your files. C shell syntax:

   set str1 = 'time = 24350 ;'
   set str2 = 'time = UNLIMITED ; // (24350 currently)'
   ncdump in.nc | sed -e "s#^.$str1# $str2#" | ncgen -o out.nc

Do this in a shell script, for each input and output file name. If
the integer dimension value changes between files, then you will
need to expand the sed expression to accommodate a changing dimension.

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/

Wang, Yi wrote:
> Hi Folks:
>
> Is there a simple way to change time to unlimited for a bunch of large
> netcdf files?
>
> Each netcdf file has more than 20 variables, in which some have time
> dimension, some do not have time dimension.
>
> I can use the " filedimdef(outfile,"time",-1,True)" to make time
> unlimited.
>
> However, I need write all those variables in the script.
>
> Thanks,
>
> Yi Wang, PhD
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Feb 08 2008 - 19:03:55 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 12 2008 - 14:45:27 MST