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

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Sun Apr 17 2011 - 22:29:28 MDT

Hi Stewart,

To add a bit to this discussion, a major part of the problem with the particular EASE grid that this file contains is that the corner points of the grid are set to 1e+51, which is supposed to indicate that these points do not project onto the map. Note that these coordinate variables are double precision. But NCL's graphics routines (currently) convert coordinate values to (single precision) float internally. When these lat and lon coordinate variables are passed to NCL without modification, the value 1e51, which is larger than the maximum possible float value, overflows to the value 'inf', which the graphics routines do not handle well.

The fix is to replace these values with values outside the range of possible lat/lon values but inside the range of float. Also setting trGridType to "TriangularMesh" helps in this situation where there are discontinuities in the grid.

I am attaching an annotated script that attempts to clarify these points. It also improves the plotting performance considerably. Hope this helps.
 -dave

On Apr 14, 2011, at 10:44 AM, Stewart Dickson wrote:

> Thank you, Wei,
>
> That looks very good. I shall be more careful in my data type conversion. I neglected to try this particular combination.
> I shall credit you in the example when published.
>
> -Stewart
>
> On 4/14/2011 11:23 AM, Wei Huang wrote:
>>
>> Stewart,
>>
>> Below is a script which I tried, and the plot it attached.
>> Hope this help.
>>
>> 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
>>
>>
>>
>>
>>
>> -------------
>> ;************************************************
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> ;************************************************
>>
>> eos_file=addfile("AMSR_E_L3_5DaySnow_V09_20050126.hdf.he2", "r")
>> bdata=eos_file->SWE_NorthernPentad_Northern_Hemisphere
>> printVarSummary(bdata)
>> udata = tounsigned(bdata)
>> udata@_FillValue = 255B
>> printVarSummary(udata)
>> fdata = tofloat(udata)
>> fdata@_FillValue = 255.0
>> printVarSummary(fdata)
>> fdata@lon2d=eos_file->GridLon_Northern_Hemisphere
>> fdata@lat2d=eos_file->GridLat_Northern_Hemisphere
>>
>> xwks=gsn_open_wks("ps","AMSR_E_L3_5DaySnow_V09_20050126_SWE_NH")
>>
>> res=True
>> res@cnFillOn=True
>> res@gsnSpreadColors=True
>> ;res@cnFillMode="RasterFill"
>> ;res@cnMissingValFillPattern = 0 ; missing value pattern is set to "SolidFill"
>> ;res@cnMissingValFillColor=0; white color for missing values
>>
>> res@cnLevelSelectionMode="ExplicitLevels"
>> res@cnLevels=(/0.0, 5.0, 10.0, 15.0, 20.0, 50.0, 100.0, 150.0, 200.0, 230.0, 240.0, 245.0, 250.0, 255.0/)
>> ;res@cnMinLevelValF=0.0
>> ;res@cnMaxLevelValF=260.0
>> ;res@cnLevelSpacingF=10.0
>>
>> res@mpProjection = "LambertEqualArea" ; LAMAZ
>> res@mpCenterLatF = 90.0; == North Pole
>> res@mpCenterLonF = 0.0
>> ;res@mpMinLatF = min(fdata@lat2d)
>> res@mpMinLatF = 0.0
>>
>> plot=gsn_csm_contour_map(xwks,fdata,res)
>>
> ...
> _______________________________________________
> 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 Mon Apr 18 14:29:53 2011

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