FillValue error in PyNio

From: Gary Bates <gary.bates_at_nyahnyahspammersnyahnyah>
Date: Mon Nov 30 2009 - 11:37:47 MST

hi,
I have a python code (attached) which reads 1 year of daily data from a
netcdf file and writes out a subset of this data. The code successfully
reads and writes out the 1st day's data (1 Jan), but I get the following
error when trying to write data for 2 Jan:

Traceback (most recent call last):
   File "test.py", line 154, in <module>
     apcpdat[nr] = precip.astype('f')
   File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyNIO/Nio.py",
line 316, in __setitem__
     fval = self.__dict__['_FillValue'][0]
IndexError: 0-d arrays can't be indexed

It appears that somehow _FillValue was an array for 1 Jan but becomes a
scalar for 2 Jan. Why? I never set _FillValue in the code.
-Gary

p.s. On the line before the error, print precip.__dict__ gives:

{'_baseclass': <type 'numpy.ndarray'>, '_hardmask': False, '_optinfo':
{}, '_basedict': {}, '_sharedmask': False, '_isfield': False, '_mask':
False, '_fill_value': None}

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

Received on Mon Nov 30 11:37:53 2009

This archive was generated by hypermail 2.1.8 : Tue Dec 01 2009 - 09:32:36 MST