Commit 0675f171 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdfDefVar: define add_offset and scale_factor always together

parent a8e0e58e
2010-01-14 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdfDefVar: define add_offset and scale_factor always together
2010-01-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added optional sorting of parameters
......
......@@ -2858,7 +2858,7 @@ int cdfDefVar(int streamID, int varID)
if ( laddoffset || lscalefactor )
{
if ( IS_EQUAL(addoffset, (double) ((float) addoffset)) &&
if ( IS_EQUAL(addoffset, (double) ((float) addoffset)) &&
IS_EQUAL(scalefactor, (double) ((float) scalefactor)) )
{
astype = NC_FLOAT;
......@@ -2867,11 +2867,11 @@ int cdfDefVar(int streamID, int varID)
if ( xtype == (int) NC_FLOAT ) astype = NC_FLOAT;
}
if ( laddoffset )
cdf_put_att_double(fileID, ncvarid, "add_offset", (nc_type) astype, 1L, &addoffset);
if ( lscalefactor )
cdf_put_att_double(fileID, ncvarid, "scale_factor", (nc_type) astype, 1L, &scalefactor);
if ( laddoffset || lscalefactor )
{
cdf_put_att_double(fileID, ncvarid, "add_offset", (nc_type) astype, 1L, &addoffset);
cdf_put_att_double(fileID, ncvarid, "scale_factor", (nc_type) astype, 1L, &scalefactor);
}
}
streamptr->vars[varID].ncvarid = ncvarid;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment