[SciPy-User] netcdf integer output issue

Neil Berg nberg at atmos.ucla.edu
Sat Jul 16 01:20:23 EDT 2011


Hi all,

I am struggling to correctly output negative integers into a netCDF file.  I have attached my code snippet and a 2-row sample of the input CSV data.  

After reading in 24 data points, I calculate the maximum, store it into a list, and output that list as a netCDF file.  These are what the 2 rows of CSV input data look like, followed by the maximum value.  

['21', '21', '21', '21', '20', '19', '17', '17', '16', '17', '17', '15', '16', '16', '11', '9', '7', '6', '5', '6', '4', '3', '2', '0']
['-1', '-1', '-2', '-3', '-3', '-4', '-5', '-5', '-5', '-5', '-5', '-6', '-5', '-5', '-5', '-6', '-7', '-8', '-9', '-11', '-13', '-12', '-15', '-15'] 

This is the current netCDF output:

time[0] max_t[0]=21 degrees F
time[1] max_t[1]=4294967295 degrees F

You can see that the time[0] output is correct, though the time[1] output is incorrect.  I believe this is an issue with outputting negative integers.  Have anyone else encountered this issue and know of a way to solve it?

Thanks in advance,

Neil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: csv_sample2.csv
Type: text/csv
Size: 170 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110715/7b7ba12f/attachment.csv>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: code_snippet.py
Type: text/x-python-script
Size: 1174 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110715/7b7ba12f/attachment.bin>
-------------- next part --------------
  




More information about the SciPy-User mailing list