[netcdfgroup] Python and netCDF4: AttributeError: NetCDF: Numeric conversion not representable

I'm running some Python code that uses the netCDF4 module (from here:
http://netcdf4-python.googlecode.com) and I'm getting a numeric
conversion error when attempting to set attributes of my output NetCDF
Dataset using the corresponding values from the input NetCDF Dataset.
I think what's happening is that I'm setting the output NetCDF's
missingValue attribute value to the missingValue attribute value of
the input NetCDF, and this value is negative infinity ("-inf").  The
input NetCDF file was written on a 32-bit Windows 7 machine and the
Python code reading this input and writing the output NetCDF is
running on a CentOS 6.4 (x86_64) machine.  Maybe I should use another
value for missing value, one which will be applicable on all
platforms?  Perhaps "-inf" isn't as good of a choice for the missing
value as other values such as the minimum float, etc.? When I run the
Python code on the same Windows machine where the original input file
was written then I don't get this error, so I'm prone to think that
the NetCDF with -inf as missingValue created by Python code running on
32-bit Windows is not meaningful when used as input to Python code
running on 64-bit Linux.

Traceback (most recent call last):
  File "src/main/python/indicators/indicators_netcdf.py", line 620, in <module>
    main()
  File "src/main/python/indicators/indicators_netcdf.py", line 271, in main
    outputDataset.setncatts(attributeDictionary)
  File "netCDF4.pyx", line 1754, in netCDF4.Dataset.setncatts (netCDF4.c:22438)
  File "netCDF4.pyx", line 1026, in netCDF4._set_att (netCDF4.c:15913)
AttributeError: NetCDF: Numeric conversion not representable

Thanks in advance to anyone who can suggest how to get around this error.

--James



  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: