[ncl-talk] Fwd: Plot grid values

Mary Haley haley at ucar.edu
Fri Jul 25 14:27:15 MDT 2014


If by "plot grid values" you mean the actual numbers of the values, this is
why I said you need to use gsn_add_text.  See this page:

http://www.ncl.ucar.edu/Applications/text.shtml

There are number of map examples that show how to add text.

See text_10.ncl.  After you create the map with gsn_csm_vector_map_ce, you
use the id from this function to call gsn_add_text:

  plot = gsn_csm_vector_map_ce(wks,plot,u,v,res)

  txres               = True
  txres at txFontHeightF = 0.007    ; make text strings smaller

  text = gsn_add_text(wks,plot,values,lon,lat,txres)

  draw(plot)      ; Now draw map with text strings and
  frame(wks)      ; advance the frame

The "values" should be an array of numbers you want to draw on the
map, and the lon and lat variables should be 1D arrays of the same
representing the lon/lat location of each value you want to draw.


--Mary



On Thu, Jul 24, 2014 at 2:42 PM, Rabah Hachelaf <hachelaf at sca.uqam.ca>
wrote:

> Hi Mary,
>
> I succeeded plot wind barb without any problem using "gsn_csm_vector_map"
> function, now it remains just plot grid values.
> Sorry for that but on this page
> http://www.ncl.ucar.edu/Applications/weather_sym.shtml*, i* can't find
> any function or a clear example who plot gridded values.
>
> Thanks for help.
>
>
>
>
> 2014-07-24 16:27 GMT-04:00 Mary Haley <haley at ucar.edu>:
>
> Did you see our wind barb page:
>>
>> http://www.ncl.ucar.edu/Applications/barb.shtml
>>
>> This should work for gridded data which is either on a rectilinear grid,
>> and hence has coordinate arrays attached to the U and V variables, or on a
>> curvilinear grid, in which you have two-dimensional coordinate arrays for
>> the X and Y (or lat/lon) dimensions.
>>
>> If you have a curvilinear grid that's over a map, then you will need to
>> attach the 2D lat/lon arrays to your u and v variables via the special
>> lat2d and lon2d attributes before you plot:
>>
>>       u at lat2d = f->lat
>>       u at lon2d = f->lon
>>       v at lat2d = f->lat
>>       v at lon2d = f->lon
>>
>> The above code snippet will have to be changed, of course, to match
>> whatever the lat/lon variables are called on your file.
>>
>> If you are not drawing wind barbs over a map, then you need to provide
>> the 2D coordinates via the vfXArray and vfYArrays.  See the "meteo_1.ncl"
>> example at:
>>
>> https://www.ncl.ucar.edu/Applications/meteo.shtml
>>
>>
>> You will have to add the text strings yourself, though, probably via
>> calls to gsn_add_text.
>>
>> --Mary
>>
>>
>> On Thu, Jul 24, 2014 at 12:46 PM, Rabah Hachelaf <hachelaf at sca.uqam.ca>
>> wrote:
>>
>>> Hi,
>>>
>>> Examples in the link are for plot station data, but in may case i have
>>> gridded data (gfs data).
>>> Does plot station data work for gridded data also.
>>> Can you suggest me a simple script to plot a variable values.
>>>
>>> Thanks
>>>
>>>
>>> 2014-07-24 11:32 GMT-04:00 Mary Haley <haley at ucar.edu>:
>>>
>>> Please see this page of examples:
>>>>
>>>> http://www.ncl.ucar.edu/Applications/weather_sym.shtml
>>>>
>>>> --Mary
>>>>
>>>>
>>>>
>>>> On Wed, Jul 23, 2014 at 4:43 PM, Rabah Hachelaf <hachelaf at sca.uqam.ca>
>>>> wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I need an example ncl script how i can plot grid data values
>>>>> (temperature for example) like the map attached.
>>>>> Thanks.
>>>>> --
>>>>> ------------------------------
>>>>> Cordialement,
>>>>> Best regards,
>>>>> Rabah Hachelaf
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> ------------------------------
>>> Cordialement,
>>> Best regards,
>>> Rabah Hachelaf
>>>
>>
>>
>
>
> --
> ------------------------------
> Cordialement,
> Best regards,
> Rabah Hachelaf
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140725/350058fa/attachment.html 


More information about the ncl-talk mailing list