[ncl-talk] gsn_contour_map, zoom in plot problem
Mary Haley
haley at ucar.edu
Thu Sep 21 11:12:34 MDT 2017
Ying,
Sorry about the delay, I've been out-of-town.
Were you able to figure out the problem? Did you try the "trGridType"
setting that the message recommended? This is needed if your lat/lon
coordinates contain missing values.
If you are still having a problem, it would help if I could have access to
your data file and the latest version of your script.
You can upload these to our ftp site:
http://www.ncl.ucar.edu/ftp_files.shtml
--Mary
On Fri, Sep 8, 2017 at 2:58 AM, Ying Song <ying.song at sjsu.edu> wrote:
> Hello, Mary,
>
> I modified my script following your first suggestion. The problem is still
> there. The warning msg shows:
> -------------------------------------------------
> Variable: o3_p
> Type: float
> Total Size: 831744 bytes
> 207936 values
> Number of Dimensions: 2
> Dimensions and sizes: [lat | 361] x [lon | 576]
> Coordinates:
> lat: [ -90.. 90]
> lon: [-180..179.375]
> Number Of Attributes: 13
> lev : 900
> time : 540
> long_name : ozone mixing ratio
> units : ppbv
> _FillValue : 1e+15
> missing_value : 1e+15
> fmissing_value : 1e+15
> scale_factor : 1
> add_offset : 0
> standard_name : ozone_mass_mixing_ratio
> vmax : 1e+15
> vmin : -1e+15
> valid_range : ( -1e+15, 1e+15 )
> warning:ContourPlotDraw: out of range coordinates encountered; standard
> AreaFill rendering method may be unreliable;
> consider setting the resource trGridType to "TriangularMesh" if
> coordinates contain missing values
> -------------------------------------
> And I attached the updated script. I wounder if I need to add triangular
> meshes resource in my script?
>
> Thanks!
>
> On Thu, Sep 7, 2017 at 8:46 AM, Mary Haley <haley at ucar.edu> wrote:
>
>> I think the issue is that "o3_p", which is the variable you are trying to
>> plot, doesn't have any metadata attached to it.
>>
>> When you do calculations like this in NCL:
>>
>> o3= a->O3(3,4,:,:) ; 18GTM = 11AM PST
>>
>> printVarSummary(o3)
>> o3_p =(o3*1e9)*(28.97/48)
>>
>> The "o3" will have metadata because no computations were done when you
>> read the variable off the file.
>>
>> However, since o3_p involves calculations, NCL will strip all the
>> metadata and the only thing that o3_p will retain from o3 is the _FillValue
>> attribute, if any.
>>
>> As a "trick", you can force o3_p to have the same metadata by doing the
>> following:
>>
>> o3_p = a->O3(3,4,:,:) ; 18GTM = 11AM PST
>>
>> o3_p =(o3_p*1e9)*(28.97/48)
>>
>> The first line will read the data into o3_p, and the metadata will all be
>> there. Then, when you do the calculation, since o3_p already exists, no
>> metadata will be removed.
>>
>> Note that I removed the use of o3, just to save memory. If you need to
>> keep o3 and o3_p around, then you can do:
>>
>> o3 = a->O3(3,4,:,:) ; 18GTM = 11AM PST
>> o3_p = o3 ; trick to copy metadata
>> o3_p =(o3*1e9)*(28.97/48)
>>
>> You should however, update the long_name and units attributes of o3_p, to
>> reflect what the new values represent.
>>
>> --Mary
>>
>>
>> On Wed, Sep 6, 2017 at 5:05 PM, Ying Song <ying.song at sjsu.edu> wrote:
>>
>>> Hello, ncl helper,
>>>
>>> I trying to plot MERRA-2 reanalysis data in NCL using gsn_contour_map. I
>>> am only interested in west coast of US. But I can not get the zoom in plot
>>> correctly by using resources:
>>>
>>> res at mpMinLatF = 30
>>> res at mpMaxLatF = 45
>>> res at mpMinLonF = -130
>>> res at mpMaxLonF = -110
>>>
>>> The warning shows:
>>> warning:ContourPlotDraw: out of range coordinates encountered; standard
>>> AreaFill rendering method may be unreliable;
>>> consider setting the resource trGridType to "TriangularMesh" if
>>> coordinates contain missing values
>>>
>>> Attachment is my script. The info of MERRA-2 O3 data from
>>> printVarSummary is:
>>> ------------------------------
>>> Variable: o3
>>> Type: float
>>> Total Size: 279465984 bytes
>>> 69866496 values
>>> Number of Dimensions: 4
>>> Dimensions and sizes: [time | 8] x [lev | 42] x [lat | 361] x [lon |
>>> 576]
>>> Coordinates:
>>> time: [0..1260]
>>> lev: [1000..0.1000000014901161]
>>> lat: [ -90.. 90]
>>> lon: [-180..179.375]
>>> Number Of Attributes: 11
>>> long_name : ozone_mass_mixing_ratio
>>> units : kg kg-1
>>> _FillValue : 1e+15
>>> missing_value : 1e+15
>>> fmissing_value : 1e+15
>>> scale_factor : 1
>>> add_offset : 0
>>> standard_name : ozone_mass_mixing_ratio
>>> vmax : 1e+15
>>> vmin : -1e+15
>>> valid_range : ( -1e+15, 1e+15 )
>>> ---------------------------------------------------------
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170921/c8f170f2/attachment.html>
More information about the ncl-talk
mailing list