Re: A question about processing HDF-eos when using ncl-6.2.0

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 29 2014 - 07:41:12 MDT

Cheung,

Your code:

 filein = "2009200040119_17152_CS_2B-TAU_GRANULE_P_R04_E02.hdf"
 eos_file = addfile(filein+".he2","r")

;read using eos file
 var = eos_file->layer_optical_depth_2B_TAU
 var_f = short2flt(eos_file->layer_optical_depth_2B_TAU)/100

which var read for the he2 directly, and NCL show it as short:

Variable: var (subsection)
Type: short
Total Size: 8 bytes
            4 values
Number of Dimensions: 1
Dimensions and sizes: [nray_2B_TAU | 4]
Coordinates:
Number Of Attributes: 9
  factor : 100
  offset : 0
  long_name : Layer cloud optical depth
  units : -
  valid_range : ( 0, 5000 )
  missing : -9900
  missop : ==
  _FillValue : 0
  hdfeos_name : layer_optical_depth
(0) -9900
(1) -9900
(2) -9900
(3) -9900

When you use short2flt, NCL has the (scale-)factor multiplied to the var, and then return as float.
see the print:

Variable: var_f (subsection)
Type: float
Total Size: 16 bytes
            4 values
Number of Dimensions: 1
Dimensions and sizes: [4]
Coordinates:
Number Of Attributes: 1
  _FillValue : 0
(0) -9900
(1) -9900
(2) -9900
(3) -9900

In most the case, when the data is short, and has factor and offset,
you can get the original value as:

new_var = ori_var * tofloat(factor) + tofloat(offset)

That is what short2flt does.
See document for short2flt at:
http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml

In your case, you may want to do:

new_var = ori_var / tofloat(factor)

You do not need the offset, as it is zero for your case.

Hope this help:

Wei

On Apr 28, 2014, at 9:37 PM, Cheung <zuibeidemei@126.com> wrote:

> Hi Wei:
>
> Thanks for your response.
>
> I put an example online https://github.com/slashgithub/test_2btau,
>
> which contains data and test script, please download and check it.
>
> ---
>
> Regards
>
> Cheung
>
>
>
> At 2014-04-29 00:53:57,"Wei Huang" <huangwei@ucar.edu> wrote:
> Cheung,
>
> Can you point us a data you are using, so we can take a look?
>
> Thanks,
>
> Wei
> On Apr 23, 2014, at 6:23 AM, Cheung <zuibeidemei@126.com> wrote:
>
>> Dear all:
>> I just came across a different result when I use ncl-6.2.0 processing the HDF-eos file from CloudSat, before I was using 6.1.0.
>>
>> This particular variable is layer_optical_depth from 2b-tau as documented http://www.cloudsat.cira.colostate.edu/dataSpecs.php?prodid=2.
>>
>> I used to use:
>>
>> var = short2flt(eos_file->layer_optical_depth_2B_TAU)/100 to retreive the "actual" value in float from this file due to a factor of 100.
>>
>> However, in this new version, I found I need to "xxxxx/10000" to retreive the "actual" value in float.
>>
>> I'm not sure what happen during this process, any comment is appreciated.
>>
>> Regards
>>
>> Cheung
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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 Apr 29 07:41:31 2014

This archive was generated by hypermail 2.1.8 : Tue Apr 29 2014 - 09:04:20 MDT