Re: High/Low labels not showing for gsn_csm_contour_map_ce()

From: A.J. Eiserloh <arthur.eiserloh_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 05 2013 - 12:08:05 MDT

I forgot to show that part of my code:

  res@cnLevelSpacingF = 4
  res@cnLineLabelFontHeightF = 0.011

  ;set High/Low Labels
   res@cnHighLabelsOn = True; label highs
   res@cnHighLabelPerimOn = False
   res@cnHighLabelFontHeightF = 0.015; larger H labels
   res@cnHighLabelBackgroundColor = "Transparent"
   res@cnLowLabelsOn = True; label lows
   res@cnLowLabelPerimOn = False
   res@cnLowLabelFontHeightF = 0.015; larger L labels
   res@cnLowLabelBackgroundColor = "Transparent"
   res@cnConpackParams = (/ "HLX:4, HLY:4" /)
  ; res@cnHighLabelString = "H~B~$ZDV$~E~"
  ; res@cnLowLabelString = "L~B~$ZDV$~E~"

 res@cnSmoothingOn = True
 res@cnSmoothingTensionF = 1.8

On Thu, Sep 5, 2013 at 11:02 AM, A.J. Eiserloh <arthur.eiserloh@gmail.com>wrote:

> Hi Adam,
>
> When I took off the resources cnHighLabelString/cnLowLabelString, The
> lows and highs with the numbers appeared finally. However, it does not put
> H/L s for every high and low. I tried increasing the value for
> res@cnConpackParams = (/ "HLX:4, HLY:4" /) to a higher number for HLX and
> HLY, however, it did not change anything. So, for certain times my "low of
> interest" has an "L" associeated with it, but then for certain later times
> there is no L within the "low" but yet there are definitely contours around
> the "low". How can I get it to put a H/L stamp for every high/low ?
>
> I tried adding the res@cnHighLabelString = "H~B~$ZDV$~E~" and
> res@cnLowLabelString = "L~B~$ZDV$~E~" resources, but I noticed that it
> did not change anything, so I left those out. Also, I am not very familiar
> with that syntax.
>
> Thanks,
>
> A.J.
>
>
> On Thu, Sep 5, 2013 at 8:20 AM, Adam Phillips <asphilli@ucar.edu> wrote:
>
>> Hi A.J.,
>> You are telling NCL to not label the min/max values by setting the
>> cnHighLabelString/cnLowLabelString resources = "H"/"L"..
>>
>> According to the documentation here:
>>
>> http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnHighLabelString
>>
>> http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnLowLabelString
>> the defaults are:
>> res@cnHighLabelString = "H~B~$ZDV$~E~"
>> res@cnLowLabelString = "L~B~$ZDV$~E~"
>> (note that I replaced the : with ~ as that is what most people have their
>> function code set to..)
>>
>> Try setting the resources as I have it above and see if that works.. If
>> not, please let ncl-talk know..
>> Adam
>>
>>
>> On 09/04/2013 06:04 PM, A.J. Eiserloh wrote:
>>
>> Thanks Adam,
>>
>> That worked, however, is there a way to put the minimum/maximum values
>> under the L/H symbols? Right now, only the "L" for low shows up.
>>
>> -A.J.
>>
>>
>> On Wed, Sep 4, 2013 at 12:36 PM, Adam Phillips <asphilli@ucar.edu> wrote:
>>
>>> Hi A.J.,
>>> I don't see anything amiss with your script. Take a look at this
>>> ncl-talk email from the archive:
>>> http://www.ncl.ucar.edu/Support/talk_archives/all/0877.html
>>> Specifically try setting cnConpackParams, and see if you can get the
>>> labels on there.
>>> If that resource doesn't help let ncl-talk know.
>>> Adam
>>>
>>>
>>> On 9/4/13 12:27 PM, A.J. Eiserloh wrote:
>>>
>>> Hi,
>>>
>>> I am trying to put high/low label marks on my contour map of 500 mb
>>> geopotential height surface but for some reason it does not seem to be
>>> working. Here is my script below:
>>>
>>> ;==============================================================
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/calendar_decode2.ncl"
>>> ;==============================================================
>>>
>>> begin
>>>
>>> f = addfile("./hgt.2012.nc","r")
>>>
>>> ;geopotential height
>>> hgt = short2flt(f->hgt) ; hgt(time,lev,lat,lon)
>>> ; short2flt() function uses scale_factor and
>>> add_offset attribute to convert
>>> hgt = hgt/(10.0)
>>> hgt@units = "dam"
>>> hgt@description = "Geopotential Height"
>>> time = f->time
>>> ntimes=dimsizes(time)
>>>
>>> lat = f->lat
>>> lon = f->lon
>>> lev = f->level
>>>
>>> nlat = dimsizes(lat)
>>> nlon = dimsizes(lon)
>>>
>>> ;convert times to dates
>>> times =fspan(time@actual_range(0),time@actual_range(1),ntimes)
>>> times@units= "hours since 1800-1-1 00:00:00"
>>> dates = calendar_decode2(times,-3)
>>>
>>> print(dates)
>>> ;create lat2d and lon2d arrays
>>> ;lat2d = conform_dims((/nlat,nlon/),lat,0)
>>> ;lon2d = conform_dims((/nlat,nlon/),lon,1)
>>>
>>> ;hgt@lat2d = lat2d
>>> ;hgt@lon2d = lon2d
>>>
>>>
>>> ;---------------------------------------------------------------
>>> ;Plot
>>> ;---------------------------------------------------------------
>>>
>>> ;What level do you want to plot?
>>> plev = 500.
>>> dateStart = ind(dates.eq."2012112800")
>>> dateEnd = ind(dates.eq."2012120318")
>>>
>>> ;do i=0,0 ; begin plotting loop
>>>
>>> fname = "500mb-"+dates(1335)
>>> wks = gsn_open_wks("png",fname)
>>>
>>> ;plot resources
>>> res = True
>>>
>>> res@tiMainString = " NCEP Reanalysis-2"
>>> res@tiMainFontAspectF = 1.4
>>> res@tiMainFontThicknessF = 0.80
>>> res@tiMainFontHeightF = 0.03
>>>
>>> res@gsnAddCyclic = False ; regional data
>>> res@tfDoNDCOverlay = False
>>>
>>> colr="black"
>>> res@mpFillOn = False
>>> res@mpGeophysicalLineColor = colr ; color of
>>> continental outlines
>>> res@mpPerimOn = True ; draw box
>>> around map
>>> res@mpGridLineDashPattern = 2 ; lat/lon lines
>>> as dashed
>>> res@mpDataBaseVersion = "MediumRes"
>>> res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; add state
>>> boundaries
>>> res@mpUSStateLineColor = colr
>>> res@mpGeophysicalLineColor = colr
>>> res@mpNationalLineColor = colr
>>> res@mpUSStateLineColor = colr
>>> res@mpGridLineColor = colr
>>> res@mpLimbLineColor = colr
>>> res@mpPerimLineColor = colr
>>> res@mpGeophysicalLineThicknessF = 1.0
>>> res@mpGridLineThicknessF = 1.0
>>> res@mpLimbLineThicknessF = 1.0
>>> res@mpNationalLineThicknessF = 1.0
>>> res@mpUSStateLineThicknessF = 1.0
>>>
>>> res@cnLevelSpacingF = 4
>>> res@cnLineLabelFontHeightF = 0.011
>>>
>>> res@cnHighLabelsOn = True; label highs
>>> res@cnHighLabelString = "H"; highs' label
>>> res@cnHighLabelFontHeightF = 0.013; larger H labels
>>> ; res@cnHighLabelBackgroundColor = "Transparent"; no box
>>> res@cnLowLabelsOn = True; label lows
>>> res@cnLowLabelString = "L"; lows' label
>>> res@cnLowLabelFontHeightF = 0.013; larger L labels
>>> ; res@cnLowLabelBackgroundColor = "Transparent"; no box
>>>
>>> res@mpLimitMode="LatLon"
>>> res@mpMinLatF = 20
>>> res@mpMaxLatF = 60
>>> res@mpMinLonF = -170
>>> res@mpMaxLonF = -110
>>>
>>> res@gsnLeftStringFontHeightF=0.015
>>> res@gsnRightStringFontHeightF=0.015
>>> res@gsnLeftString = hgt@description+" "+flt2string(plev)+"mb " +
>>> dates(1335)
>>> res@gsnRightString= hgt@units
>>>
>>> plot = gsn_csm_contour_map_ce(wks,hgt(1335,ind(lev.eq.plev),:,:),res)
>>>
>>> ;end do
>>>
>>> end
>>>
>>> I've attatched an image to show what it looks like so far.
>>>
>>> Any help would be much appreciated.
>>> Thanks,
>>>
>>> --
>>> Arthur J. Eiserloh, Jr.
>>> San Jose State University
>>> Graduate Student
>>> Dept. of Meteorology and Climate Science
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>>
>> --
>> Arthur J. Eiserloh, Jr.
>> San Jose State University
>> Graduate Student
>> Dept. of Meteorology and Climate Science
>>
>>
>> --
>> ______________________________________________________________
>> Adam Phillips asphilli@ucar.edu
>> NCAR/Climate and Global Dynamics Division (303) 497-1726
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>>
>>
>
>
> --
> Arthur J. Eiserloh, Jr.
> San Jose State University
> Graduate Student
> Dept. of Meteorology and Climate Science
>

-- 
Arthur J. Eiserloh, Jr.
San Jose State University
Graduate Student
Dept. of Meteorology and Climate Science

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 5 12:08:24 2013

This archive was generated by hypermail 2.1.8 : Mon Sep 16 2013 - 13:43:52 MDT