X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 27 Jul 2016 10:18 AM by  anon
NetCDF creation bug when _FillValue attribute is of wrong type
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
27 Jul 2016 10:18 AM
    It seems as if you create a NetCDF file that has a variable with the attribute "_FillValue" that is the wrong type, IDL will silently not write to it. This can happen if you copy/paste some variable definitions and forget to propagate the change in type down through your attributes. $ idl IDL Version 8.5 (linux x86_64 m64). (c) 2015, Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation. IDL> ncid = ncdf_create('test.nc') IDL> dimid = ncdf_dimdef(ncid, 'index', /unlimited) IDL> varid = ncdf_vardef(ncid, 'time', /double, dimid) IDL> ncdf_attput, ncid, varid, '_FillValue', 0. ; oops! IDL> ncdf_control, ncid, /endef IDL> ncdf_varput, ncid, varid, dindgen(100) IDL> ncdf_close, ncid IDL> $ ncdump -h test.nc netcdf test { dimensions: index = UNLIMITED ; // (0 currently) variables: double time(index) ; time:_FillValue = 0.f ; Now, try it again with the right attribute type: $ idl IDL Version 8.5 (linux x86_64 m64). (c) 2015, Exelis Visual Information Solutions, Inc., a subsidiary of Harris Corporation. IDL> ncid = ncdf_create('test.nc', /clobber) IDL> dimid = ncdf_dimdef(ncid, 'index', /unlimited) IDL> varid = ncdf_vardef(ncid, 'time', /double, dimid) IDL> ncdf_attput, ncid, varid, '_FillValue', 0d ; there, that's better IDL> ncdf_control, ncid, /endef IDL> ncdf_varput, ncid, varid, dindgen(100) IDL> ncdf_close, ncid IDL> $ ncdump -h test.nc netcdf test { dimensions: index = UNLIMITED ; // (100 currently) variables: double time(index) ; time:_FillValue = 0. ;
    You are not authorized to post a reply.