IndexError when trying to read masked value from variable

From: Carmen St. Jean <carmen.stjean_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 03 2012 - 12:13:45 MDT

Hello all,

I'm getting this strange error message when I attempt to run the
attached code with this input file
(http://jetstreak.unh.edu/netcdf/nos.creofs.fields.nowcast.20120625.t12z.nc,
it is over one GB in size):

Traceback (most recent call last):
  File "creofstest.py", line 22, in <module>
    zvalDirectMissingVal = zval[0, 1, 64387]
  File "/usr/local/lib/python2.7/site-packages/PyNIO/Nio.py", line
305, in __getitem__
    ret = _fill_value_to_masked(self,ret)
  File "/usr/local/lib/python2.7/site-packages/PyNIO/Nio.py", line
283, in _fill_value_to_masked
    a = ma.masked_where(a == self.__dict__['_FillValue'],a,copy=0)
  File "/usr/local/lib/python2.7/site-packages/numpy/ma/core.py", line
1802, in masked_where
    " (got %s and %s)" % (cshape, ashape))
IndexError: Inconsistant shape between the condition and the input
(got (1,) and ())

My code is very simple; it's just trying to access the zval variable
at different valid indices.

I can directly access a specific value from the zval variable that
happens to not contain the missing value (e.g., zval[0, 0, 64387])
without a problem. But when I try to directly access a value that I
know to be a missing value (e.g., zval[0, 1, 64387]), then I get the
above error.

I am, however, able to indirectly access that value zval[0, 1, 64387]
by saving zval[0, :, 64387] to a new variable and taking the 1st index
of that. This correctly prints out as a missing value.

Does anyone have any ideas of why this might be happening?

Thanks,

Carmen

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

Received on Tue Jul 3 12:14:01 2012

This archive was generated by hypermail 2.1.8 : Thu Sep 13 2012 - 15:38:36 MDT