Re: Specify _FillValue for created variable

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 25 2011 - 16:57:26 MDT

Hi Carl,

I have just today checked in a fix for a rather significant bug involving creating or setting
attributes with numerical values. However, even running a version from prior to my fix, I
cannot duplicate this error on a 10.6.6 Mac OS laptop or on a redhat linux box. Do you
know what version of PyNIO you are using? You can find out with:

import Nio
print Nio.__version__

It would also help to know what version of Python and numpy you are using, as well as what
kind of machine you are running on. Perhaps we can get you a test version with the most
recent code for you to try.
 -dave

Note to other users: the bug mentioned above is only triggered (so far as I can tell) if you attempt to use Python variables
that reference the values of these numeric-valued attributes after closing the file where they were created.

On Mar 25, 2011, at 2:37 PM, Carl Drews wrote:

> Using Nio and Python, how do I create a variable that looks like this
> ncdump -h:
>
> float Hwave(ocean_time, eta_rho, xi_rho) ;
> Hwave:long_name = "wind-induced significant wave height" ;
> Hwave:units = "meter" ;
> Hwave:time = "ocean_time" ;
> Hwave:coordinates = "x_rho y_rho ocean_time" ;
> Hwave:field = "Hwave, scalar, series" ;
> Hwave:_FillValue = 1.e+37f ;
>
> Here's what I'm trying:
>
> varName = 'Hwave'
> newVar = file.create_variable(varName, 'd', ('eta_rho','xi_rho'))
> newVar.long_name = 'wind-induced significant wave height'
> newVar.units = 'meter'
> newVar.coordinates = 'x_rho y_rho ocean_time'
> newVar.field = 'Hwave, scalar, series'
> newVar._FillValue = 1.e+37
>
> and I get this run-time error message:
>
> Traceback (most recent call last):
> File "waves.py", line 227, in <module>
> createWaveFile(outFile, sigHeight, avgLength, avgDirection)
> File "waves.py", line 148, in createWaveFile
> newVar._FillValue = 1.e+37
> File "/usr/local/python/lib/python2.5/site-packages/PyNIO/Nio.py",
> line 188, in __setattr__
> setattr(self._obj,attrib,value)
> NIOError: Memory allocation error
>
> Carl Drews
> _______________________________________________
> pyngl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Fri Mar 25 16:57:30 2011

This archive was generated by hypermail 2.1.8 : Wed May 18 2011 - 12:00:50 MDT