Re: appending data to existing Netcdf file

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Thu, 16 Aug 2007 12:08:48 -0600

Hi Gary,
I'm glad to hear this worked for you.
One thing I forgot to note is that it seems to be dangerous to use
the ':' notation to try to reference all
the elements of an unlimited dimension when writing to it.
Essentially, it seems to turn it a request for
an infinite number of dimensions (in practice it became a request for
0 through the maximum integer
value on the system). I am not quite sure where this is happening,
but it was definitely a problem.
  -dave

On Aug 16, 2007, at 11:34 AM, Gary Bates wrote:

> Thanks, Dave... you've solved my problem!
>
> I didn't quite see how to assign values --- was trying to use
> numpy.append and that wasn't working.
> Gary
>
>
>
>
> David Brown wrote:
>> Hi Gary,
>> It's pretty straightforward to append data to a variable that has
>> an unlimited dimension in PyNIO.
>> You simply assign to the variable, referencing the index you want
>> to append to. If you reference an index that is greater than
>> the last existing index plus one, then the intervening elements
>> will be created and filled with whatever is the _FillValue.
>> I am attaching a little script that creates a file with an
>> unlimited dimension, defines a variable and assigns some
>> values, then closes it, reopens it, and assigns more elements
>> along the unlimited dimension.
>> -dave
>> ---------------------------------------------------------------------
>> ---
>> On Aug 14, 2007, at 2:38 PM, Gary Bates wrote:
>>> hi,
>>> Does anyone have a PyNGL example in which data is appended to an
>>> existing Netcdf file (along UNLIMITED time axis)?
>>>
>>> For example, I have a file containing daily precip data from 1
>>> Jan to 31 July 2007 and would like to update with 1-13 Aug data.
>>>
>>> Thanks,
>>> Gary
>>> _______________________________________________
>>> pyngl-talk mailing list
>>> pyngl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Thu Aug 16 2007 - 12:08:48 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 23 2007 - 10:48:58 MDT