FillValue error in PyNio

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

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 "", line 154, in <module>
     apcpdat[nr] = precip.astype('f')
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.

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:

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