Skip to content

CDMS2 2.12 wrongly scaling variable #174

@JimBiardCics

Description

@JimBiardCics

CDMS2 version 2.12 is wrongly scaling a variable. The CDL for the variable in question is

 short data(time, lat, lon) ;
	data :long_name = "data" ;
	data :missing_value = -27300s ;
	data :scale_factor = 0.01 ;
	data :add_offset = 273. ;

When the value in the variable in the input data file is -27300, the scaled value should be 0.0. However, when you open the file with CDMS2 and look at the value returned, it is 0.01. The value is masked in the variable data array, but the value is wrong. It can then be propagated into files that are written using data from the variable if the values are unmasked.

All other values are scaled correctly. Only the values corresponding to the missing value have a bad value.

The attached cdl file can be used to create a netCDF file with ncgen. The command is
ncgen -k 3 scaledShort.txt
The python script will open the file scaledShort.nc that was generated by ncgen and write out the unmasked first data value, which CDMS2 auto-converted from int16 to float.

readScaledShort.py.txt
scaledShort.txt

(I uploaded new files and corrected the CDL snippet from my original post.)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions