sodri126 / netcdf4-python

Automatically exported from code.google.com/p/netcdf4-python
Other
0 stars 0 forks source link

Can't access to variables datatype in netCDF4 file #221

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. tryin to copy dimensions, variable attributes from a netCDF4 file to another
2.
3.

What is the expected output? What do you see instead?
i expect to see variable datatypes

What version of the product are you using? On what operating system?
i'm using Red Hat Enterprise 6.3, i have imported netCDF4 and numpy library 

Please provide any additional information below.
i've tried to run the same code at home (xubuntu linux) and it works...

Original issue reported on code.google.com by ivano.ba...@gmail.com on 10 Jul 2014 at 9:08

Attachments:

GoogleCodeExporter commented 9 years ago
i've sorted out writing "variable.dtype" instead of "variable.datatype"

i've got another problem. i can't have access to variable fill values
 which is the correct syntax?

i've tried (see attached code)

varin._Fillvalue

but it doesn't work

thank you so much

Original comment by ivano.ba...@gmail.com on 10 Jul 2014 at 9:53

GoogleCodeExporter commented 9 years ago

It's _FillValue.  Most likely that attribute doesn't exist, and the netCDF 
default fill value was used.  The default values are defined in the include 
file netcdf.h: NC_FILL_CHAR, NC_FILL_BYTE, NC_FILL_SHORT, NC_FILL_INT, 
NC_FILL_FLOAT, and NC_FILL_DOUBLE.  

Please use the github site (https://github.com/Unidata/netcdf4-python) in the 
future - the googlecode site is no longer active.

Original comment by whitaker.jeffrey@gmail.com on 10 Jul 2014 at 11:58

GoogleCodeExporter commented 9 years ago
The default fill values are also accessible directly in python:

>>> import netCDF4
>>> netCDF4.default_fillvals
{'i8': -9223372036854775806, 'f4': 9.969209968386869e+36, 'u8': 
18446744073709551614L, 'i1': -127, 'U1': '\x00', 'S1': '\x00', 'i2': -32767, 
'u1': 255, 'i4': -2147483647, 'u2': 65535, 'f8': 9.969209968386869e+36, 'u4': 
4294967295L}
>>>

Original comment by whitaker.jeffrey@gmail.com on 10 Jul 2014 at 12:18