| 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" ;
 |