SkewT Top pressure

From: Li, Yongzuo <yongzuo.li_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 17 2010 - 12:25:03 MDT

Jack,

Thanks for your help.

Yongzuo
________________________________________
From: ncl-talk-bounces@ucar.edu [ncl-talk-bounces@ucar.edu] on behalf of ncl-talk-request@ucar.edu [ncl-talk-request@ucar.edu]
Sent: Thursday, June 17, 2010 1:00 PM
To: ncl-talk@ucar.edu
Subject: ncl-talk Digest, Vol 79, Issue 36

Send ncl-talk mailing list submissions to
        ncl-talk@ucar.edu

To subscribe or unsubscribe via the World Wide Web, visit
        http://mailman.ucar.edu/mailman/listinfo/ncl-talk
or, via email, send a message with subject or body 'help' to
        ncl-talk-request@ucar.edu

You can reach the person managing the list at
        ncl-talk-owner@ucar.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ncl-talk digest..."

Today's Topics:

   1. Re: skewt plot (Jack Glendening)
   2. Lambert Conformal Projection for WRF data (Agnes Lim)
   3. Re: Image resize problem (Mary Haley)
   4. Re: NCL 5.1.1 Font problems (Mary Haley)
   5. Re: Lambert Conformal Projection for WRF data (Mary Haley)

----------------------------------------------------------------------

Message: 1
Date: Thu, 17 Jun 2010 08:20:38 -0700
From: Jack Glendening <ncarg_drjack@drjack.info>
Subject: Re: skewt plot
To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
Message-ID: <201006170820.39134.ncarg_drjack@drjack.info>
Content-Type: text/plain; charset="us-ascii"

> I have three question about SkewT:
> (1) Can I plot up to only 300 hPa ?

The modified skewT code at

http://www.drjack.info/RASP/DOWNLOAD/skewt_func.ncl

allows one to internally specify a pressure level for the plotted top.
However there are additional alterations so you would need to pull out
those modifications from the others (by searching on "Ptop") and then
modify your own code.

Jack

------------------------------

Message: 2
Date: Thu, 17 Jun 2010 10:21:07 -0500
From: Agnes Lim <alim@ssec.wisc.edu>
Subject: Lambert Conformal Projection for WRF data
To: ncl-talk@ucar.edu
Message-ID: <4C1A3D63.3090009@ssec.wisc.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hi

I had plotted the WRF humidity variable for a particular level.
However the figure is not what I wanted. (see attached figure)
1. There are 2 sets of latitude and longitude labeled. I only wanted 1
set , specifically the bottom and right set labels.
2. The figure is 90 degree to my title. I wanted the plot to be rotated
90 degree counter clockwise.

Could someone point out what I had did incorrectly?

Thanks
Agnes

The following is my code segment for plotting.
=================================================
 wks = gsn_open_wks("x11" ,"test") ; open a ps file
   res = True ; plot mods desired
; gsn_define_colormap(wks,"WhBlGrYeRe") ; select color map
    gsn_define_colormap(wks,"gui_default") ; select color map
    gsn_reverse_colormap(wks)
   res@gsnSpreadColors = True
   res@mpLandFillColor = -1 ; set land to be transperant
   res@mpOutlineOn = True
   res@mpOutlineBoundarySets = "AllBoundaries"
   res@mpLimitMode = "LatLon"
   res@mpProjection = "LambertConformal"
   res@mpEllipticalBoundary = False ; If you want elliptical
   res@cnFillOn = True
   res@cnLinesOn = False
   res@lbBoxLinesOn = True
   res@mpCenterLonF = -100
   res@mpMinLatF = 17 ; range to zoom in on
   res@mpMaxLatF = 40
   res@mpMinLonF = -125
   res@mpMaxLonF = -78
   res@tmXBLabelFontHeightF = 0.01 ; resize tick labels
   res@tmYLLabelFontHeightF = 0.01
   res@pmTickMarkDisplayMode = "Always"
   res@tiMainString = "Humidity Analysis Increments at approximately 300mb"
   res@lbLabelAutoStride = True
   res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
; res@cnLevelSelectionMode = "AutomaticLevels" ; set manual
contour levels
   res@cnMinLevelValF = -2 ; set min contour level
   res@cnMaxLevelValF = 1 ; set max contour level
   res@cnLevelSpacingF = 0.1 ; set
   plot=gsn_csm_contour_map(wks,T_increment(34,:,:) ,res)

------------------------------

Message: 3
Date: Thu, 17 Jun 2010 09:26:25 -0600
From: Mary Haley <haley@ucar.edu>
Subject: Re: Image resize problem
To: sahidul@gmail.com
Cc: ncl-talk <ncl-talk@ucar.edu>
Message-ID: <C0D4C264-BBB9-4C18-AE55-A843BA52AC9A@ucar.edu>
Content-Type: text/plain; charset=us-ascii

Sahidul,

Are the text strings showing up on the very last page of your PS file by any chance?

I think what may be happening is that when you call wrf_map_overlays, it is calling a frame advance for you.
This means that anything you draw after this call will be drawn on a new page.

If this is what's happening, then before you call this function, try setting:

  pltres@gsnFrame = False

You also mentioned a problem with resizing the image. I'm not sure what you mean.

Note that if you want the text to appear on the map, you'd be better off using "gsn_add_text",
because this allows you to attach the text to the plot. This means if you resize the plot, the text
will be resized automatically.

In order to do this, however, you need to use data coordinates of your plot, rather than NDC
coordinates. This would be lat/lon coordinates, since "plot" is a map.

Also, the text won't get drawn until the plot gets drawn.

Here's what your code changes might look like:

  . . .
   pltres = True
  . . .
  pltres@gsnDraw = False ; don't draw plot
  pltres@gsnFrame = False ; don't advance frame

  . . .
  contour_tot2 = wrf_contour(wrf_out,wks2,rain_tot2,opts)
  plot = wrf_map_overlays(wrf_out,wks2,(/contour_tot2/),pltres,mpres) ; plot will not get drawn at this point

;*********************plot1**************************************************
  txres@txFontHeightF = 0.013 ; font smaller. default big
  txres@txFont = "text-symbols"
  dumid1 = gsn_add_text(wks2,plot,"S",xlon1,xlat,txres) ; need to replace xlon1 and xlat with appropriate lon/lat values
; page coordinates are normalized. go from 0->1 not 0->8" etc.
  txres@txFontHeightF = 0.015 ; font smaller. default big
  txres@txFont = "courier-bold"
  dumid2 = gsn_add_text(wks2,plot,"CDAC",xlon2,xlat,txres) ; need to replace xlon2 and xlat with appropriate lon/lat values
  txres@txFontHeightF = 0.01 ; font smaller. default big
  txres@txFont = "courier"
  dumid3 = gsn_add_text(wks2,plot,"(Continent Boundary may differ from Political boundary) ",xlon3,xlat1,txres) ; need to replace xlon3 and xlat with appropriate lon/lat values

  draw(plot) ; This will draw plot and the three text strings.
  frame(wks2) ; now advance frame

--Mary

On Jun 17, 2010, at 6:29 AM, Sahidul wrote:

> Dear NCL users forum,
>
> I am facing problem to resize the image created by following script:
>
> We are not able to print the "text" using this following script i.e., required text is not writing in image file. Kindly help me to sort out this problem
>
> =================================
> 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/wrf/WRFUserARW.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> datadir = "/WRF/output/2010061600/"
> date1="2010-06-16_00"
> date2="2010-06-16_23"
> date3="2010-06-17_23"
> date4="2010-06-18_23"
>
> FILES1 = systemfunc ("ls -1 " + datadir + "wrfout_d02_"+date1)
> FILES2 = systemfunc ("ls -1 " + datadir + "wrfout_d02_"+date2)
> FILES3 = systemfunc ("ls -1 " + datadir + "wrfout_d02_"+date3)
> FILES4 = systemfunc ("ls -1 " + datadir + "wrfout_d02_"+date4)
>
> wrf_out = addfile(FILES1+".nc","r")
>
> res = True
> opts = res
> opts@InitTime = False
> opts@Footer = False
>
> ; Total Rainfall calculation
> ;***********************************************************************
> rainc1 = wrf_user_getvar(wrf_out,"RAINC",0)
> rainnc1 = wrf_user_getvar(wrf_out,"RAINNC",0)
>
> wrf_out2 = addfile(FILES2+".nc","r")
>
> ; Total Rainfall calculation
> ;***********************************************************************
> rainc2 = wrf_user_getvar(wrf_out2,"RAINC",0)
> rainnc2 = wrf_user_getvar(wrf_out2,"RAINNC",0)
> rain_tot2=((rainc2+rainnc2)-(rainnc1+rainc1))/10.
> ;***********************************************************************
> wrf_out3 = addfile(FILES3+".nc","r")
>
> ; Total Rainfall calculation
> ;***********************************************************************
> rainc3 = wrf_user_getvar(wrf_out3,"RAINC",0)
> rainnc3 = wrf_user_getvar(wrf_out3,"RAINNC",0)
> rain_tot3=((rainc3+rainnc3)-(rainnc2+rainc2))/10.
> ;***********************************************************************
> wrf_out4 = addfile(FILES4+".nc","r")
>
> ; Total Rainfall calculation
> ;***********************************************************************
> rainc4 = wrf_user_getvar(wrf_out4,"RAINC",0)
> rainnc4 = wrf_user_getvar(wrf_out4,"RAINNC",0)
> rain_tot4=((rainc4+rainnc4)-(rainnc3+rainc3))/10.
>
> rain_tot2@description = ""
> rain_tot3@description = ""
> rain_tot4@description = ""
> ;***********************************************************************
> ;Open Workstation ps,eps,X11,pdf,ncgm
> ;***********************************************************************
> wks2 = gsn_open_wks("ps","precip_surf_day1")
>
> res@InitTime = False
> res@Footer = False
> res@gsnMaximize = True
> res@MainTitle = "Total Precipitation"
>
> opts@cnLinesOn = False
> opts@cnFillOn = True
> opts@cnLevelSelectionMode = "ExplicitLevels"
> ;opts@UnitLabel = "cm"
> ; opts@description = "Precipitation Rate"
>
> opts@cnLevels = (/ 1., 2., 5., 10., 15., 20., 25., 30., 35., 40., 50./)
> opts@cnFillColors = (/"white","seagreen1","green4","greenyellow","yellow","goldenrod1","goldenrod2","tomato","orangered",\
> "red","red2","red4"/)
> opts@cnInfoLabelOn = False
> opts@cnConstFLabelOn = False
> res@gsnMaximize = True ; must include w/ Paper Orientation
> res@gsnPanelBottom = 0.2 ; save space at bottom
>
> txres = True ; text mods desired
>
> pltres = True
> mpres = True
> mpres@mpOutlineBoundarySets = "National"
> mpres@mpNationalLineThicknessF = 1.5
> mpres@mpNationalLineColor = "Black"
> mpres@mpGeophysicalLineColor = "Black"
> mpres@mpGeophysicalLineThicknessF = 1.5
> ;***********************************************************************
> contour_tot2 = wrf_contour(wrf_out,wks2,rain_tot2,opts)
> plot = wrf_map_overlays(wrf_out,wks2,(/contour_tot2/),pltres,mpres)
>
> ;*********************plot1**************************************************
> txres@txFontHeightF = 0.013 ; font smaller. default big
> txres@txFont = "text-symbols"
> gsn_text_ndc(wks2,"S",0.12,.19,txres)
> ; page coordinates are normalized. go from 0->1 not 0->8" etc.
> txres@txFontHeightF = 0.015 ; font smaller. default big
> txres@txFont = "courier-bold"
> gsn_text_ndc(wks2,"CDAC",0.17,.19,txres)
> txres@txFontHeightF = 0.01 ; font smaller. default big
> txres@txFont = "courier"
> gsn_text_ndc(wks2,"(Continent Boundary may differ from Political boundary) ",0.6,.19,txres)
> frame(wks2) ; now advance frame
> end
> =================================
>
> Thanking you in advance
>
> Sahidul
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

------------------------------

Message: 4
Date: Thu, 17 Jun 2010 09:34:03 -0600
From: Mary Haley <haley@ucar.edu>
Subject: Re: NCL 5.1.1 Font problems
To: <Arnold.Sullivan@csiro.au> <Arnold.Sullivan@csiro.au>
Cc: ncl-talk@ucar.edu
Message-ID: <4F5CDD97-23AC-41FA-B57D-CA9E161328B8@ucar.edu>
Content-Type: text/plain; charset="us-ascii"

On Jun 16, 2010, at 6:49 PM, <Arnold.Sullivan@csiro.au> <Arnold.Sullivan@csiro.au> wrote:

> Dear all,
>
> 1st problem:
>
> Try to generate 2 by 2 panel plot:
>
> plot = new(4, graphic)
> ...............
> res@mpMinLonF = 0. ; select a subregion
> res@mpMaxLonF = 360.
> res@mpMinLatF = -70.
> res@mpMaxLatF = 70.
> ................
> res@gsnLeftString = "a) DJF,"
> res@gsnLeftString = "b) DJF,"
> res@gsnLeftString = "c) DJF,"
> res@gsnLeftString = "d) DJF,"
> ................
> gsn_panel(wks,plot,(/2,2/),res_P) ; now draw as right panel.
> If I use such code the plot looks ok. However, if I change MinLatF and MaxLatF to -60 and 60, a) and c) string possition will be higher then b) and d).

Hi Arnold,

I'm afraid I don't have enough information to go on here. Can you provide an image that shows the two different versions?

The only thing that I can think of is that when you change the limits of your plot, this changes the size of your plot, and
in turn, the titles may have to be shrunk in order to stay with the plot.

Also, if your four plots do not have the exact same plot limits, this can cause differences in your titles. If I can
see the images, then I might know better how to fix it.

>
>
> 2nd problem:
>
> Similar plot but 3 by 4 panel plot:
>
> ; ===============================
> ; overlay plots
> ; ===============================
>
> res_L@tmYLLabelsOn = True
> res_L@gsnLeftStringParallelPosF = 0 ; move this string left or right
> res_L@gsnLeftStringOrthogonalPosF = .05 ; move this string up or down
> res_L@gsnLeftString = "a) DJF cor. b/t 21st TPC & 20th IOD tele"
> plot_L(0) = gsn_csm_contour_map_overlay(wks,CORREL(0,:,:), CORREL(0,:,:), res_L, res_cor)
> res_L@gsnLeftString = "b) DJF cor. b/t 21st TPC & 20th IOD reg."
> plot_L(1) = gsn_csm_contour_map_overlay(wks,SLOPE(0,:,:), SLOPE(0,:,:), res_L, res_cor)
> res_L@tmXBLabelsOn = True
> res_L@gsnLeftString = "c) DJF cor. b/t 21st TPC & 20th IOD SNR."
> plot_L(2) = gsn_csm_contour_map_overlay(wks,STONR(0,:,:), STONR(0,:,:), res_L, res_cor)
>
> ; ======================
> ; Center Left
> ; ======================
>
> res_CL@gsnLeftStringParallelPosF = 0 ; move this string left or right
> res_CL@gsnLeftStringOrthogonalPosF = .05 ; move this string up or down
> res_CL@gsnLeftString = "d) MAM cor. b/t 21st TPC & 20th IOD tele."
> plot_CL(0) = gsn_csm_contour_map_overlay(wks,CORREL(1,:,:),CORREL(1,:,:), res_CL, res_cor)
> res_CL@gsnLeftString = "e) MAM cor. b/t 21st TPC & 20th IOD reg."
> plot_CL(1) = gsn_csm_contour_map_overlay(wks,SLOPE(1,:,:),SLOPE(1,:,:), res_CL, res_cor)
> res_CL@tmXBLabelsOn = True
> res_CL@gsnLeftString = "f) MAM cor. b/t 21st TPC & 20th IOD SNR."
> plot_CL(2) = gsn_csm_contour_map_overlay(wks,STONR(1,:,:),STONR(1,:,:), res_CL, res_cor)
>
> ; ======================
> ; Center Right
> ; ======================
>
> res_CR@gsnLeftStringParallelPosF = 0 ; move this string left or right
> res_CR@gsnLeftStringOrthogonalPosF = .05 ; move this string up or down
> res_CR@gsnLeftString = "g) JJA cor. b/t 21st TPC & 20th IOD tele."
> plot_CR(0) = gsn_csm_contour_map_overlay(wks,CORREL(2,:,:),CORREL(2,:,:), res_CR, res_cor)
> res_CR@gsnLeftString = "h) JJA cor. b/t 21st TPC & 20th IOD reg."
> plot_CR(1) = gsn_csm_contour_map_overlay(wks,SLOPE(2,:,:),SLOPE(2,:,:), res_CR, res_cor)
> res_CR@tmXBLabelsOn = True
> res_CR@gsnLeftString = "i) JJA cor. b/t 21st TPC & 20th IOD SNR."
> plot_CR(2) = gsn_csm_contour_map_overlay(wks,STONR(2,:,:),STONR(2,:,:), res_CR, res_cor)
>
> ; ======================
> ; Right
> ; ======================
>
> res_R@gsnLeftStringParallelPosF = 0 ; move this string left or right
> res_R@gsnLeftStringOrthogonalPosF = .05 ; move this string up or down
> res_R@gsnLeftString = "i) SON cor. b/t 21st TPC & 20th IOD tele."
> plot_R(0) = gsn_csm_contour_map_overlay(wks,CORREL(3,:,:),CORREL(3,:,:), res_R, res_cor)
> res_R@gsnLeftString = "j) SON cor. b/t 21st TPC & 20th IOD reg."
> plot_R(1) = gsn_csm_contour_map_overlay(wks,SLOPE(3,:,:),SLOPE(3,:,:), res_R, res_cor)
> res_R@tmXBLabelsOn = True
> res_R@gsnLeftString = "l) SON cor. b/t 21st TPC & 20th IOD SNR."
> plot_R(2) = gsn_csm_contour_map_overlay(wks,STONR(3,:,:),STONR(3,:,:), res_R, res_cor)
>
> If I change "a) DJF cor. b/t 21st TPC & 20th IOD tele" to "a) DJF cor. b/t 21st TPC & 20th IOD tele." then won't plot that panel and get error message:

I think here you might be running into a problem with the length of your title relative to the size of your
plot. In this case, seeing an image will help, but I may need to follow up after that by asking for your data
and full script.

Thanks,

--Mary

>
> fatal:MapV40DHDrawMapList: ARPRAM - ALGORITHM FAILURE
> fatal:PlotManagerDraw: error in plot draw
> fatal:_NhlPlotManagerDraw: Draw error
> Regards,
> Arnold Sullivan
> Scientist Support
> CSIRO Marine & Atmospheric Research
> Ph: 61 03 9239 4525
> Fax: 61 03 9239 4444
> Email: arnold.sullivan@csiro.au
>
> _______________________________________________
> ncl-talk mailing list
> 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/20100617/8c336610/attachment.html

------------------------------

Message: 5
Date: Thu, 17 Jun 2010 09:57:28 -0600
From: Mary Haley <haley@ucar.edu>
Subject: Re: Lambert Conformal Projection for WRF data
To: Agnes Lim <alim@ssec.wisc.edu>
Cc: ncl-talk@ucar.edu
Message-ID: <11A5E24C-697F-4E38-9E3F-E61109DE8FC0@ucar.edu>
Content-Type: text/plain; charset=us-ascii

Agnes,

Thanks for providing me with the image offline.

To get just bottom and right labels on your axis, you can set:

 res@tmXTOn = False ; Turn off top tickmarks and labels
 res@tmYLOn = False ; Turn off left tickmarks and labels

Your map is rotated because you are asking for a LambertConformal
projection, but you haven't set the two parallels and a meridian.

The resources for these are:

 res@mpLambertParallel1F = 33.0 ; two parallels
 res@mpLambertParallel2F = 45.0
 res@mpLambertMeridianF = -95.0 ; central meridian

You will need to use the correct values here, and since you have WRF data,
those are probably given on the file as global attributes TRUELAT1,
TRUELAT2, and STAND_LON (or CEN_LON).

As an example, if you opened your file with "f = addfile(....)", then you can set the above
resources with:

 res@mpLambertParallel1F = f@TRUELAT1
 res@mpLambertParallel2F = f@TRUELAT2
 res@mpLambertMeridianF = f@STAND_LON ; or f@CEN_LON

--Mary

On Jun 17, 2010, at 9:21 AM, Agnes Lim wrote:

> Hi
>
> I had plotted the WRF humidity variable for a particular level.
> However the figure is not what I wanted. (see attached figure)
> 1. There are 2 sets of latitude and longitude labeled. I only wanted 1
> set , specifically the bottom and right set labels.
> 2. The figure is 90 degree to my title. I wanted the plot to be rotated
> 90 degree counter clockwise.
>
> Could someone point out what I had did incorrectly?
>
> Thanks
> Agnes
>
> The following is my code segment for plotting.
> =================================================
> wks = gsn_open_wks("x11" ,"test") ; open a ps file
> res = True ; plot mods desired
> ; gsn_define_colormap(wks,"WhBlGrYeRe") ; select color map
> gsn_define_colormap(wks,"gui_default") ; select color map
> gsn_reverse_colormap(wks)
> res@gsnSpreadColors = True
> res@mpLandFillColor = -1 ; set land to be transperant
> res@mpOutlineOn = True
> res@mpOutlineBoundarySets = "AllBoundaries"
> res@mpLimitMode = "LatLon"
> res@mpProjection = "LambertConformal"
> res@mpEllipticalBoundary = False ; If you want elliptical
> res@cnFillOn = True
> res@cnLinesOn = False
> res@lbBoxLinesOn = True
> res@mpCenterLonF = -100
> res@mpMinLatF = 17 ; range to zoom in on
> res@mpMaxLatF = 40
> res@mpMinLonF = -125
> res@mpMaxLonF = -78
> res@tmXBLabelFontHeightF = 0.01 ; resize tick labels
> res@tmYLLabelFontHeightF = 0.01
> res@pmTickMarkDisplayMode = "Always"
> res@tiMainString = "Humidity Analysis Increments at approximately 300mb"
> res@lbLabelAutoStride = True
> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> ; res@cnLevelSelectionMode = "AutomaticLevels" ; set manual
> contour levels
> res@cnMinLevelValF = -2 ; set min contour level
> res@cnMaxLevelValF = 1 ; set max contour level
> res@cnLevelSpacingF = 0.1 ; set
> plot=gsn_csm_contour_map(wks,T_increment(34,:,:) ,res)
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

------------------------------

_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

End of ncl-talk Digest, Vol 79, Issue 36
****************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 17 12:25:53 2010

This archive was generated by hypermail 2.1.8 : Thu Jun 24 2010 - 14:10:27 MDT