[ncl-talk] set Time to Unlimited

Dennis Shea shea at ucar.edu
Mon Nov 13 22:32:56 MST 2017


From:
   https://stackoverflow.com/questions/28598485/how-to-
convert-fixed-size-dimension-to-unlimited-in-a-netcdf-file

ncks --mk_rec_dmn time_counter myfile.nc -o myfileunlimited.nc

; mv myfileunlimited.nc myfile.nc


On Mon, Nov 13, 2017 at 9:42 PM, Laura Fowler <laura at ucar.edu> wrote:

> Hello:
>
> I created a bunch of history files but forgot to set Time to
> Unlimited. The beginning of each netCDF file looks like this:
>
> netcdf history_2drad.append.r4.2015-11-29_00.00.00 {
>
> dimensions:
> Time = 24 ;
> StrLen = 64 ;
> nCells = 6488066 ;
>
> variables:
> char xtime(Time, StrLen) ;
>         string xtime:units = "YYYY-MM-DD_hh:mm:ss" ;
>         string xtime:long_name = "Model valid time" ;
>
> float acswdnb(Time, nCells) ;
>         string acswdnb:units = "W m^{-2}" ;
>         string acswdnb:long_name = "accumulated all-sky downward
> surface shortwave radiation flux" ;
>
> etc ....
>
>
> But, I actually need the dimensions to look like
> Time = UNLIMITED ; // (24 currently)
>
>
> So my question is: Is there an "easy way" that I can modify the Time
> dimensions without having to re-create all my files (so would be
> really time-consuming)? I tried something like
>
> begin
> f = addfile("file.nc","w")
>
> ntime  = 24
> StrLen = 64
> nCells = 6488066
>
> dim_names = (/"Time","StrLen","nCells"/)
> dim_sizes = (/ntime,StrLen,nCells/)
> dimUnlim  = (/True,False,False/)
> filedimdef(f,dim_names,dim_sizes,dimUnlim )
> end
>
> but that did not work? I may be missing something. Any hint would be
> appreciated.
>
> Thanks,
> Laura
>
>
>
>
> --
> !-----------------------------------------------------------
> --------------------------------------------------
> Laura D. Fowler
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu
> phone: 303-497-1628
>
> !-----------------------------------------------------------
> --------------------------------------------------
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171113/c476f838/attachment.html>


More information about the ncl-talk mailing list