Re: Question about data types

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 14 2010 - 09:51:53 MDT

Gina,

If you are using NCL 5.2.0 or later version, the easy way is to use
"tofloat(xxx)",
which will convert any NCL data type to float.

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Sep 14, 2010, at 9:29 AM, Gina Henderson wrote:

> Hi there,
>
> I have a question about the correct function to use to convert a
> hexadecimal input array to type float. If I use the function
> "stringtointeger" to convert it I get the correct data ranges (from
> 0-255) but I also get the following warning:
>
> warning:Argument 0 of the current function or procedure was coerced
> to the appropriate type and thus will not change if the function or
> procedure modifies its value
>
> If I use "byte2flt" to convert the data, I get no warning message
> but my data range then only goes from 0-254 and all grids that were
> value = 255 are now set to another value which I am pretty sure is 0.
>
> The variable summary of the raw data array is included below. My
> question is, should I be worried about the warning I get when
> converting the data using "stringtointeger", as this method
> maintains the original data more correctly that reading the data in
> and then converting it using "byte2flt".
>
> Any suggestions or comments would be greatly appreciated.
> Thanks, Gina.
>
> ----------------------------------------------------------------------
> printVarSummary of original data array:
>
> Variable: modis_per_byte
> Type: byte
> Total Size: 25920000 bytes
> 25920000 values
> Number of Dimensions: 2
> Dimensions and sizes: [YDim_MOD_CMG_Snow_5km | 3600] x
> [XDim_MOD_CMG_Snow_5km | 7200]
> Coordinates:
> Number Of Attributes: 13
> long_name : Daily snow extent, global at 5km
> units : none
> format : I3
> coordsys : latitude, longitude
> valid_range : ( 0x00, 0x64 )
> _FillValue : 0xff
> Mask_value : 0xfe
> Night_value : 0x6f
> Cell_resolution : 0.05 deg
> Water_mask_land_threshold____ : 12
> Antarctica_snow_note : Antarctica deliberately mapped as snow
> Key : 0-100=percent of snow in cell, 107=lake ice, 111=night,
> 250=cloud obscured water, 253=data not mapped, 254=water mask, 255=f
> ll
> hdf_name : Day_CMG_Snow_Cover
> (0)
> (0) Daily snow extent, global at 5km: min=0x00 max=0xfe
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 14 08:52:03 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 16 2010 - 11:05:24 MDT