Re: NCL Debugging and HDF-EOS Support for AMSR-E LAMAZ Projection?

From: Wei Huang <huangwei_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 12 2011 - 08:42:06 MDT

Stewart,

If you use: addfile("AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2", "r")
to read this HDF-EOS2 file, there will be no ubyte, as NCL has no "ubyte" at the
time we developed that part of the code, so the ubyte was converted to byte (silently).
The default value was converted to "-1".

If you use this file as HDF data, since we have "ubyte" now, so, it is read as ubyte,
which the "_FillValue" is 255.

So, if you want to use "he2" to take the advantage of HDF-EOS2 interface,
please treat those data as byte. which

 f = addfile("AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2", "r")
 print(f)

gives:

...
      byte Flags_NorthernPentad_Northern_Hemisphere ( YDim_Northern_Hemisphere, XDim_Northern_Hemisphere )
         coordinates : GridLat_Northern_Hemisphere, GridLon_Northern_Hemisphere
         hdfeos_name : Flags_NorthernPentad
         projection : Lambert Azimuthal Equal Area
         unsigned : True
         _FillValue : -1

      byte SWE_NorthernPentad_Northern_Hemisphere ( YDim_Northern_Hemisphere, XDim_Northern_Hemisphere )
         coordinates : GridLat_Northern_Hemisphere, GridLon_Northern_Hemisphere
         hdfeos_name : SWE_NorthernPentad
         projection : Lambert Azimuthal Equal Area
         unsigned : True
         _FillValue : -1

If you use "hdf", then treat them as ubyte. which

 f = addfile("AMSR_E_L3_5DaySnow_V09_20050126.hdf", "r")
 print(f)

will give:

...
      ubyte SWE_SouthernPentad ( YDim_Southern_Hemisphere, XDim_Southern_Hemisphere )
         _FillValue : 255
         hdf_name : SWE_SouthernPentad

      ubyte Flags_SouthernPentad ( YDim_Southern_Hemisphere, XDim_Southern_Hemisphere )
         hdf_name : Flags_SouthernPentad

After you read in the data, you can convert them using NCL's convert function,
such as "tobyte", or "toubyte", or "tointeger", etc.

Hope this help,

Thanks,

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 Apr 12, 2011, at 7:32 AM, Stewart Dickson wrote:

> On 4/11/2011 5:50 PM, Dennis Shea wrote:
>>
>> NCL 6.0.0-beta has different "literal suffix" for the differnt types
>> EK ubyte has "B"
>>
>> 0B
>>
>> See:
>> http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclDataTypes.shtml
>>
> The NCL HDF4 interface says that SWE_NorthernPentad has type 'ubyte' _FillValue : 255
> The HDF-EOS interface says that SWE_NorthernPentad has type signed byte _FillValue :-1 unsigned : True
> (NCL is contradicting itself, I think)
> I am using the HDF-EOS interface: addfile("AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2", "r")
>
> If I use data@_FillValue=0B, then I encounter:
>> fatal:Type Mismatch: The type of missing value could not be converted to type of variable (data)
>> fatal:Execute: Error occurred at or near line 44 in file AMSR_E_L3_5DaySnow_NH_SWE.ncl
> line 44: data@_FillValue=0B
>
> Thanks,
>
> -Stewart
>>
>> On 04/11/2011 04:41 PM, Stewart Dickson wrote:
>>> Thank you, Wei,
>>>
>>> Yes, I was previously using: ncl_ncarg-5.2.1.Linux_RedHat_i686_gcc412
>>> I have just now downloaded and installed:
>>> ncl_ncarg-6.0.0-beta.Linux_RedHat_i686_gcc412
>>> I find the results from the on-line example script:
>>> http://www.hdfeos.org/zoo/index_openNSIDC_Examples.php ->
>>> AMSR_E_L3_SeaIce6km_V11_20050118_SI_06km_NH_89V_DAY.ncl
>>> <http://www.hdfeos.org/zoo/NSIDC/AMSR_E_L3_SeaIce6km_V11_20050118_SI_06km_NH_89V_DAY.ncl>
>>> To be the same as what I obtained previously (the control case) ;)
>>> I see the same results in ncl_ncarg-6.0.0-beta.Linux_RedHat_i686_gcc412
>>> as you report for
>>> ncl_filedump AMSR_E_L3_5DaySnow_V09_20050126.hdf
>>> and
>>> ncl_filedump AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2
>>>
>>> I note the difference in data field type and _FillValue as reported by
>>> the NCL HDF4 interface vs. the NCL HDF-EOS interface:
>>> ncl_filedump AMSR_E_L3_5DaySnow_V09_20050126.hdf
>>> variables:
>>> ubyte SWE_NorthernPentad ( YDim_Northern_Hemisphere,
>>> XDim_Northern_Hemisphere )
>>> _FillValue : 255
>>> hdf_name : SWE_NorthernPentad
>>> ncl_filedump AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2
>>> (signed)byte SWE_NorthernPentad_Northern_Hemisphere
>>> _FillValue :-1
>>>
>>> I am using:
>>> eos_file=addfile("AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2", "r") ; The
>>> HDF-EOS2 Interface
>>> and
>>> data=eos_file->SWE_NorthernPentad_Northern_Hemisphere ; read data field(:,:)
>>>
>>> Do I also see correctly from ncl_filedump
>>> AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2
>>> that
>>> data@lon2d=eos_file->GridLon_Northern_Hemisphere
>>> and
>>> data@lat2d=eos_file->GridLat_Northern_Hemisphere
>>> Should be well-defined?
>>>
>>> I am using the following:
>>> data@_FillValue=0b ; Making this double assignment allows the _FillValue
>>> of 0
>>> ; to be properly represented.
>>> data@_FillValue=-1b
>>> xwks=gsn_open_wks("pdf","AMSR_E_L3_5DaySnow_V09_20050126_SWE_NH")
>>> res=True ; plot mods desired
>>> res@... ; Options
>>> plot=gsn_csm_contour_map(xwks,data,res) ; create plot
>>>
>>> I am (still) seeing:
>>> fatal:NhlCvtStringToEnum: Unable to convert string "missing" to
>>> requested type
>>> warning:Error retrieving resource amJust from args - Ignoring Arg
>>> fatal:NhlCvtStringToEnum: Unable to convert string "missing" to
>>> requested type
>>> warning:Error retrieving resource amSide from args - Ignoring Arg
>>> ...
>>> (Repeated 12 times)
>>> ERROR 2 IN MAPPOS/MDPPOS - ARGUMENTS ARE INCORRECT
>>> ERROR 1 IN MAPSTI - UNCLEARED PRIOR ERROR
>>> ERROR 1 IN MAPROJ - UNCLEARED PRIOR ERROR
>>> ERROR 2 IN MAPSET/MDPSET - UNCLEARED PRIOR ERROR
>>> fatal:MapSetTrans: error initializing map: MAPINT - UNCLEARED PRIOR ERROR
>>> warning:PDFWorkstationInitialize:Device X Coordinates invalid, defaulting
>>> warning:PDFWorkstationInitialize:Device Y Coordinates invalid, defaulting
>>>
>>> This time, in ncl_ncarg-6.0.0-beta.Linux_RedHat_i686_gcc412, NCL
>>> produces a PDF file with map axes, grid lines, decoration (continental
>>> outlines, etc.) but no contour plot data; whereas previously, in
>>> ncl_ncarg-5.2.1.Linux_RedHat_i686_gcc412, NCL produced no output file.
>>>
>>> Thanks again,
>>>
>>> -Stewart
>>>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 13 00:42:19 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT