comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » netCDF _FillValue attributes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
netCDF _FillValue attributes [message #43025] Fri, 11 March 2005 03:04
sdj is currently offline  sdj
Messages: 20
Registered: November 2003
Junior Member
Dear All,

I am using IDL to produce some netCDF files.

In order to adhere to the COARDS convention I need to supply the
_FillValue attribute.

My data variable is in form of a byte array, with values ranging from 0
to 255.
My valid values go from 0 to 254, and subsequently I want to have both
the _FillValue and the missing_value attributes set to 255.

The problem I am having is that I cannot set the _FillValue to 255.
By running the code attached below (with the different options ->), and
ncdumping -h the resulting netCDF file I always get the _FillValue =
'\377'

So the question is, how can I set (force) the _FillValue attribute to
255 (byte) ?

Thanks for the help.

Best Regards,
Pepe


..............
..............
..............
lon_id = NCDF_DIMDEF(id, 'longitude', x)
lat_id = NCDF_DIMDEF(id, 'latitude', y)

;Define the variables to be used in the file
longitude_id = NCDF_VARDEF(id, 'longitude', lon_id, /FLOAT)
latitude_id = NCDF_VARDEF(id, 'latitude', lat_id, /FLOAT)
data_id = NCDF_VARDEF(id, 'data', [lon_id, lat_id], /BYTE)

NCDF_ATTPUT, id, chl_id, 'valid_min', '0'
NCDF_ATTPUT, id, chl_id, 'valid_max', '254'
-> NCDF_ATTPUT, id, /BYTE, chl_id, '_FillValue', byte(255)
-> NCDF_ATTPUT, id, chl_id, '_FillValue', byte(255)
NCDF_ATTPUT, id, chl_id, 'missing_value', '255'

;Put the file into data mode
NCDF_CONTROL, id, /ENDEF

;Write the appropriate data to the netCDF file
NCDF_VARPUT, id, longitude_id, longitude
NCDF_VARPUT, id, latitude_id, latitude
NCDF_VARPUT, id, data_id, data

;Close the netCDF file
NCDF_CLOSE, id

END

ncdump-h file.netcdf
.
byte data(latitude, longitude) ;
data:standard_name = "Test" ;
data:long_name = "Test data" ;
data:valid_min = "0" ;
data:valid_max = "254" ;
data:_FillValue = '\377' ;
data:missing_value = "255" ;
[Message index]
 
Read Message
Previous Topic: netCDF _FillValue attributes
Next Topic: Re: netCDF _FillValue attributes

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 12:18:34 PDT 2025

Total time taken to generate the page: 0.88257 seconds