NCL gets the correct result.
ncl 0> f = addfile("2A12.20100101.69095.7.HDF","r")
ncl 1> fzHIndex = f->freezingHeightIndex
ncl 2> printVarSummary(fzHIndex)
Variable: fzHIndex
Type: byte
Total Size: 607568 bytes
607568 values
Number of Dimensions: 2
Dimensions and sizes: [nscan | 2921] x [npixel | 208]
Coordinates:
Number Of Attributes: 1
hdf_name : freezingHeightIndex
ncl 3> print("fzHIndex: min="+min(fzHIndex)+" max="+max(fzHIndex))
(0) fzHIndex: min=0xffffff9d max=0x0d
NCL **prints hexidecimal for bytes ** :-(
However, you can print as 'short' or 'integer'
ncl 4> print("fzHIndex: min="+min(toshort(fzHIndex))+"
max="+max(toshort(fzHIndex)))
or
print("fzHIndex: min="+toshort(min(fzHIndex)))+"
max="+toshort(max(zHIndex))))
or
ncl 5> print("fzHIndex: min="+min(toint(fzHIndex))+"
max="+max(toint(fzHIndex)))
print("fzHIndex: min="+toint(min(fzHIndex)))+" max="+toint(max(zHIndex))))
(0) fzHIndex: min=-99 max=13
======
That said ... this is a poorly constructed file.
The -99 (byte) is a missing value but the variable has no such
information associated with it. You must (should) manually add
fzHIndex@_FillValue = tobyte(-99)
If you wish to plot the byte values, NCL should handle that just fine.
Good luck
On 3/28/14, 1:19 AM, yinjinfang88@163.com wrote:
> Dear All;
> I got a strange error when I read TRMM version 7 Level 2 hdf file with NCL. The variable in the hdf file is named as freezingHeightIndex with the 1-byte integer type. I can get the values of freezingHeightIndex by the following command :
>
> ncl_filedump -v freezingHeightIndex A12.20100101.69095.7.HDF
>
> I can find a value of -99, and I can also find -99 by the HDFview.
>
> However, I got a strange result of 157 by the NCL read command:
>
> fzHIndex = f->freezingHeightIndex
>
> I am confused why the read command cannot get a right result. Is something wrong?
>
> Thank you very much.
>
> Yin
>
>
>
>
>
>
>
> Department of Earth Science, Zhejiang University, Hangzhou 310027, China
>
>
>
> _______________________________________________
> 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 Fri Mar 28 07:37:30 2014
This archive was generated by hypermail 2.1.8 : Mon Mar 31 2014 - 11:47:09 MDT