Re: resource file with gsn_csm

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 01 2014 - 21:38:09 MDT

Hi Wenshan,

This is a confusing situation indeed.

The gsn_csm_xxxx plotting scripts explicitly check your "res" variable to
see if cnFillOn is attached to it and set to True, and if so, they turn on
a labelbar. When you set cnFillOn in a .hluresfile and no longer attach it
to your "res" variable, then the gsn_csm scripts don't know that you've set
this, and hence they don't turn on a labelbar.

Also, setting "lbLabelBarOn" to True is not going to work in this case,
unfortunately. You have to use the special "PlotManager" resource
"pmLabelBarDisplayMode" and set it to "Always". You can try doing this in
your .hluresfile:

*pmLabelBarDisplayMode : Always

However, I suggest to make things easier, just set "res@cnFillOn = True" in
your script.

--Mary



On Tue, Jul 1, 2014 at 6:02 PM, Wenshan Wang <wenshanw@uci.edu> wrote:

> Dear NCL group,
>
> I am learning how to use resource files now.
> And I got a problem with gsn_csm interface.
>
> I know that if I use gsn_csm and set cnFillOn to be True, a labelbar will
> be created automatically.
> And it is TRUE if I put cnFillOn in .ncl script.
> However, when I move this resource to a resource file, I have a filled
> contour but no labelbar, even though I explicitly set lbLabelBarOn to be
> True.
>
> I have other resources in that resource file.
> Some of them work; some don't. cnFillOn is just one example.
>
> Just wondering where I went wrong.
> Thank you very much!
>
> Here I list:
> 1, NCL script (resfile.ncl)
> 2, resource file in the same directory (resfile.res)
> 3, I put the test data (cf_grl_airs.nc) and the above two files to the
> ftp.
> 4, I am using NCL 6.2.0
> 5, Linux grele 3.5.0-52-generic #78~precise1-Ubuntu SMP Wed Jun 11
> 17:14:53 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
> *NCL script: resfile.ncl*
>
> ; Written by Wang Wenshan 2014-07-01 Tuesday 16:32:47
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;*************************************************************
> ; Use Resource File
> ;************************************************************
> begin
> fname = "resfile"
> fn = "cf_grl_airs.nc"
> fin = addfile(fn,"r")
> cf = fin->CldFrcTot
> lat = fin->Latitude
> lon = fin->Longitude
>
> ;- res
> wks = gsn_open_wks("x11",fname)
>
> res = True ; Plot mods desired.
>
> res@gsnMaximize = True ; make plot large
>
> res@gsnDraw = False
> res@gsnFrame = False
>
> ;res@cnFillOn = True
> res@cnLinesOn = False ; turn off contour lines
> res@cnFillMode = "RasterFill"
> res@cnLineLabelsOn = False; turn off contour line labels
> res@cnMissingValFillPattern = 0 ; missing value pattern is set to
> "SolidFill"
> ;res@cnMissingValFillColor = "grey"; color for missing values
>
> res@mpProjection = "LambertEqualArea" ; choose map projection
> ;res@mpProjection = "Satellite" ; choose map projection
> res@mpGridAndLimbOn = False ; turn on lat/lon lines
> res@mpPerimOn = False ; turn off perimeter
> res@mpFillDrawOrder = "PostDraw"
> res@mpDataBaseVersion = "MediumRes"
> res@mpDataSetName = "Earth..4"
> res@mpFillOn = False
> res@mpOutlineOn = True
> res@mpOutlineBoundarySets = "AllBoundaries"
>
> res@mpLimitMode = "LatLon" ; required
> res@mpMinLatF = 60. ; min lat
> res@mpMaxLatF = 85. ; max lat
> res@mpMinLonF = 290. ; min lon
> res@mpMaxLonF = 350. ; max lon
> res@mpCenterLonF = 320.
> res@mpCenterLatF = 72.5
>
> res@trGridType = "TriangularMesh" ; faster graphic rendering
>
> res@pmTickMarkDisplayMode = "Always"
> res@tmXBOn = False
> res@tmXTOn = False
> res@tmYLOn = False
> res@tmYROn = False
>
> res@gsnAddCyclic = False ; don't add cyclic longitude point
>
> res@sfYArray = lat
> res@sfXArray = lon
> plot = gsn_csm_contour_map(wks,cf,res)
>
> draw(plot)
> frame(wks)
>
> print("done!")
> end
>
>
> =====================================================================
> *Resource file: resfile.res*
> ! test cnFillOn
> *cnFillOn : True
> *cnMissingValFillColor : grey
>
>
> Best,
> Wenshan
>
> ------------------------------------------------------------------------------
> Graduate Student Researcher
> Earth System Science
> University of California, Irvine
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Wed Jul 02 03:38:09 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT