[ncl-talk] write variable to netCDF in slices

Maria Gehne - NOAA Affiliate maria.gehne at noaa.gov
Mon Mar 23 14:31:58 MDT 2015


Just to add to what Dennis sent. The CDOs have the cat and the mergetime
operators that may be similar to ncrcat.

Maria

On Mon, Mar 23, 2015 at 2:11 PM, Dennis Shea <shea at ucar.edu> wrote:

> For concatenation of netCDF files, the 'record dimension (here, time) must
> be unlimited.
> You have a few things out-of-place. Also, you can do better than time
> steps of 999.
>
> I used 'ncrcat' ... likely the CDO have some equivalent operator.
>
> See attached ... not tested
>
> Good Luck
>
> On Mon, Mar 23, 2015 at 12:40 PM, Frank Rüthrich <
> frank.ruethrich at posteo.de> wrote:
>
>> Hi there!
>> I wonder if anybody of you had success with a similar problem:
>>
>> I want to calculate hourly horizontal divergences on 20 pressure levels
>> for one year.
>> Dimensions are:[ 8784 <time | unlimited>, 20 <pressure>, 180
>> <south_north>, 270 <west_east> ]
>> Unfortunately, reading the entire u and v netCDF-files gives me a memory
>> error, so i will have to perform the calculation in slices.
>> I neither can allocate an array to store the divergences and thus:
>> I will have to append the divergences of the sliced u and v variables
>> directly to the netCDF file.
>>
>> Reading u and v in timeslices and calculating divergences works fine,
>> but I did not succeed in writing them to a netcdf file so far.
>>
>> I guess need somethin like the "ncdf->div(i:i+999,:,:,:)=DV" in the
>> below example:
>>
>> fu      = addfile (fileu, "r")
>> fv      = addfile (filev, "r")
>> ncdf     = addfile(fnameout ,"w")  ; open output netCDF file (already
>> existing)
>> filedimdef(ncdf,"time",-1,True)
>> TIME   = fu->time
>> m=dimsizes(TIME)
>> do while (i.le.m)
>>        VARu    =  short2flt(fu->u(i:i+999,:,:,:))
>>        VARv    =  short2flt(fv->v(i:i+999,:,:,:))
>>        DV    = uv2dvF_Wrap(VARu,VARv)
>>        ncdf->div(i:i+999,:,:,:)=DV
>>        i=i+1000
>> end do
>>
>> I would very much appreciate every idea!
>>
>> Cheers,
>> Frank
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20150323/657a5ead/attachment.html 


More information about the ncl-talk mailing list