The Scaling / Unscaling of CLAVR-x Data Records.
The CLAVR-x/PATMOS-x data is written in HDF4. Most
parameters are stored as scaled
integers. The IDL and MATLAB tools provided from this site
automatically unscale the
data. This page provides information on how to unscale the data
without using the existing tools.
Shown below is the output from the hdp command on a CLAVR-x/PATMOS-x
gridded file for one particular sds (cld_opd_ir).
Variable
Name = cld_opd_ir
Index = 175
Type= 8-bit signed
integer
Ref. = 177
Rank = 1
Number of attributes =
7
Dim0: Name=fakeDim175
Size = 165018
Scale Type = number-type not set
Number of attributes = 0
Attr0: Name = SCALED
Type = 8-bit signed integer
Count= 1
Value = 2
Attr1: Name = RANGE_MIN
Type = 32-bit floating point
Count= 1
Value = -1.000000
Attr2: Name = RANGE_MAX
Type = 32-bit floating point
Count= 1
Value = 2.000000
Attr3: Name =
SCALED_MIN
Type = 32-bit signed integer
Count= 1
Value = -127
Attr4: Name =
SCALED_MAX
Type = 32-bit signed integer
Count= 1
Value = 127
Attr5: Name =
SCALED_MISSING
Type = 32-bit signed integer
Count= 1
Value = -128
Attr6: Name = UNITS
Type = 8-bit signed char
Count= 4
Value = none
This attributes of this variable tell how to unscale
it. The SCALED flag set to something nonzero indicates that is
parameter has been scaled. The value of 1 for SCALED says it is
linearly scaled. A value of 2 would refer to log10 scaling and a
value of 3 refers to square-root scaling. The type of this variable is
an 8-bit signed integer which can have a value of -128 to 127.
There are some variables scaled to be 16-bit signed integers.
The SCALED_MIN and SCALED_MAX give the valid range of
the scaled numbers. For this type, the valid range is -127 to
127. The SCALED_MISSING tells the value assigned when the
variable and in this case it is -128. RANGE_MIN and RANGE_MAX
provide the range of the
valid unscaled data. The missing value for the unscaled
data is not provided and its assignment is up to the user. A value of
-999.0 is appropriate. Here is an example, let I be the scaled
value and X be the unscaled value. Because SCALED = 1 (linear),
we can write
if (I = SCALED_MISSING) then
X = USER_DEFINED_MISSING_VALUE
else
X = RANGE_MIN + (RANGE_MAX-RANGE_MIN) * (I -
SCALED_MIN) / (SCALED_MAX - SCALED_MIN)
endif
If log10 scaling were used (SCALED =2), we would write the same relation
if (I = SCALED_MISSING) then
X = USER_DEFINED_MISSING_VALUE
else
X = RANGE_MIN + (RANGE_MAX-RANGE_MIN) * (I -
SCALED_MIN) / (SCALED_MAX - SCALED_MIN)
endif
but we would need to take the
ani-log10 of X
X = 10^X
Note, for
log10 scaling, the RANGE_MIN and RANGE_MAX are already converted to
log10.
If square-root scaling were used (SCALED=3), we would write
if (I = SCALED_MISSING) then
X = USER_DEFINED_MISSING_VALUE
else
X = RANGE_MIN + (RANGE_MAX-RANGE_MIN) * ((I -
SCALED_MIN) / (SCALED_MAX - SCALED_MIN))^2
endif
Note, as opposed to log10 scaling, the RANGE_MIN and RANGE_MAX are not
already converted to the square root.