[ncl-talk] Lots of Problems with wrf_contour
Rick Brownrigg
brownrig at ucar.edu
Wed Jul 6 15:54:58 MDT 2016
Hi,
With regard to the field titles, both wrf_contour and wrf_vector take
special resources FieldTitle, SubFieldTitle and UnitLabel that have default
behaviors if not explicitly set; perhaps you can what you want by
overriding their defaults:
http://ncl.ucar.edu/Document/Functions/WRF_arw/wrf_contour.shtml
I'm wondering if this line isn't causing the problem with the axis labeling
(perhaps remove it?)
On Wed, Jun 29, 2016 at 1:51 PM, Kerwyn Texeira <ktish86 at gmail.com> wrote:
> Hi ncl-talk,
>
> I four question about wrf_contour
>
> 1. How to remove the field titles?
> 2. How to fix the longitude and latitude axis
> 3. How do I adjust the contours
> 4. How do I fix the vertical bar title where it is centered?
>
> I tried using my code for a few days now and I had no luck. I'm not
> getting any errors but it just will not plot right. It's like it's not
> obeying the script. I have attached the figure. Could anyone help me
> please. It would be greatly appreciated.
>
> Thanks
>
> Script:
>
> 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"
>
> ;-----------------------------------------------------------------------
>
> begin
>
> a = addfile("./wrfout_d02_2014-01-11_16_00_00.nc","r")
>
> it = 0
> hgt = wrf_user_getvar(a, "HGT", it)
> hgt at lat2d = wrf_user_getvar(a, "XLAT", it)
> hgt at lon2d = wrf_user_getvar(a, "XLONG", it)
> u = wrf_user_getvar(a, "ua", it)
> v = wrf_user_getvar(a, "va", it)
> p = wrf_user_getvar(a, "pressure", it)
> z = wrf_user_getvar(a, "z", it)
> tc = wrf_user_getvar(a, "tc", it)
>
> u_wind = wrf_user_intrp3d(u, p, "h", 700., 0.0, False)
> v_wind = wrf_user_intrp3d(v, p, "h", 700., 0.0, False)
> z_plane = wrf_user_intrp3d(z, p, "h", 700., 0.0, False)
> tc_plane = wrf_user_intrp3d(tc, p, "h", 700., 0.0, False)
>
> spd = (u_wind*u_wind + v_wind*v_wind)^(0.5) ;m/s
> u_wind = u_wind*1.94384449
> v_wind = v_wind*1.94384449
>
> u_wind at lon2d = hgt at lon2d
> u_wind at lat2d = hgt at lat2d
>
> v_wind at lon2d = hgt at lon2d
> v_wind at lat2d = hgt at lat2d
>
> z_plane at lon2d = hgt at lon2d
> z_plane at lat2d = hgt at lat2d
>
> tc_plane at lon2d = hgt at lon2d
> tc_plane at lat2d = hgt at lat2d
>
>
> spd = spd*1.94384449
>
> spd at lon2d = hgt at lon2d
> spd at lat2d = hgt at lat2d
>
> ; spd at units = "Wind Speed"
> ; spd at units = "kts"
>
>
> ;-----------------------------------------------------------------------------
>
> wks_type = "png"
> wks_type at wkWidth = 2500.
> wks_type at wkHeight = 2500.
>
> wks = gsn_open_wks(wks_type, "temp")
> gsn_define_colormap(wks,"matlab_jet")
>
>
> ;-----------------------------------------------------------------------------
>
> res = True
> res at InitTime = False
> res at FieldTitle = ""
> res at Footer = False
> ;res at gsnDraw = False ; do not draw the plot
> ;res at gsnFrame = False ; do not advance the frame
> res at cnLineLabelsOn = False ; do not use line labels
> res at cnFillOn = True ; color fill
> res at cnLinesOn = False ; do not draw contour lines
> res at tiMainString = "Winds (kts) at 700hpa on Jan 11 at
> 16:00UTC"
> res at tiMainFont = "helvetica"
> res at tiMainFontHeightF = 0.025
> res at pmTickMarkDisplayMode = "Always"
> ;res at mpOutlineOn = True
> res at lbOrientation = "Vertical"
> res at tiMainOffsetYF = -0.03
> ;res at mpFillOn = False
> ;res at mpOutlineOn = True ; turn the map outline on
> res at lbTitleString = "Temperature (C)"
> res at lbOrientation = "vertical"
> res at pmLabelBarSide = "right"
> res at cnLevelSelectionMode = "EqualSpacedLevels"
> res at cnInfoLabelOn = False
>
> ;-----------------------------------------------------------------------------
> ; For zooming in... don't need
>
> ;res at mpMinLatF = 34.5 ; 37.85 ; Zoomed in Lat and Lon
> ;res at mpMaxLatF = 35.2 ; 38.50
> ;res at mpMinLonF = -123. ; -120.0
> ;res at mpMaxLonF = -115.5 ; -119.35
>
>
> ;-----------------------------------------------------------------------------
>
> ;res at gsnLeftString = ""
>
> ;res at gsnLeftString = "Geopotential Height (m) and Temperature (C)"
> ;res at gsnStringFontHeightF = 0.020
>
> ;res at gsnRightString = ""
>
> res at lbTitleString = "Temperature (C)"
> res at lbTitlePosition = "Right"
> res at lbTitleDirection = "Across"
> res at lbTitleAngleF = 90.
> ;res at lbTitleFontHeightF = 0.020
>
> ;res at gsnAddCyclic = False
> res at cnLevelSelectionMode= "ManualLevels"
> res at cnMinLevelValF = -7
> res at cnMaxLevelValF = 4
> res at cnLevelSpacingF = 1
>
> ;------wind vectors
> res2 = True
> ;res2 at gsnDraw = False
> ;res2 at gsnFrame = False
> res2 at vcWindBarbLineThicknessF= 4.0
> res2 at vcRefLengthF= 0.018
> res2 at vcRefMagnitudeF= 10
> res2 at vcMinDistanceF = 0.05
> ;res2 at vcGlyphStyle = "WindBarb"
>
> res2 at FieldTitle = "Wind" ; overwrite Field Title
> res2 at NumVectors = 47 ; wind barb density
>
> ;-------Temps
>
>
> ;------Geopotential Height
> res3 = True
>
> res3 at cnLineColor = "Black"
> res3 at cnLineThicknessF = 5.0
>
> ;res3 at cnInfoLabelOn = False
> res3 at cnLevelSpacingF = 2
> res3 at cnLineLabelBackgroundColor = "white"
> ;res3 at cnLineLabelDensityF = 0.5
>
> ;----------------------------------
> pltres = True
> mpres = True
>
> mpres at mpGeophysicalLineColor = "Black"
> mpres at mpNationalLineColor = "Black"
> mpres at mpUSStateLineColor = "Black"
> mpres at mpGridLineColor = "Black"
> mpres at mpLimbLineColor = "Black"
> mpres at mpPerimLineColor = "Black"
> mpres at mpGeophysicalLineThicknessF = 3.0
> pltres at gsnMaximize = True
>
>
> ;-----contours/vectors
> winds = wrf_vector(a, wks, u_wind, v_wind, res2)
> temps = wrf_contour(a, wks, tc_plane, res)
> geoPz = wrf_contour(a, wks, z_plane, res3)
>
> plot = wrf_map_overlays(a, wks, (/ winds, temps, geoPz /), mpres,
> pltres)
> ;draw(plot)
> ;frame(wks)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> end
>
>
>
>
>
>
>
>
> _______________________________________________
> 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/20160706/ea8bfdf4/attachment.html
More information about the ncl-talk
mailing list