[ncl-talk] Getting North to be Up on plots from WRF_lc_8.ncl ?
Ronald Stenz
rds238 at cornell.edu
Mon Dec 17 13:14:54 MST 2018
How do I get North to be on the top of my plots using WRF_lc_8.ncl? I am
using the same code given on the website, where the plots shown have north
in the upward direction. However, on my plot which is attached, north is
towards the upper right corner of the plot... it is not directly upward.
What should I be doing to fix this?
I am using the lambert conformal grid in WRF. My code is below (same as
the website) Thanks! :
;----------------------------------------------------------------------
; WRF_lc_8.ncl
;
; Concepts illustrated:
; - Plotting WRF data that's on a Lambert Conformal map projection
; - Using gsn_csm_vector_scalar_map to plot WRF-ARW data
; - Drawing wind barbs over filled contours
; - Creating a color map using named colors
; - Drawing raster contours
;----------------------------------------------------------------------
; WRF: near surface winds and total precipitation
;----------------------------------------------------------------------
; These files are loaded by default in NCL V6.2.0 and newer
; 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
;
; Open file
; Read U10 and V10, Cumulus (rinc) and Non-cumulus (rainnc) prc
;
f = addfile ("wrfout_d01_000000_25time.nc","r")
rainc = f->RAINC ; (Time, south_north, west_east)
rainnc = f->RAINNC
u10 = f->U10 ; (Time, south_north, west_east)
v10 = f->V10
times = wrf_user_getvar(f,"times",-1)
ntim = dimsizes(times) ; # time steps
;
; Use NCL operator > to make sure all values >=0.0
; Sum components and assign attributes
;
rainc = rainc > 0.0
rainnc = rainnc > 0.0
rainTot = rainc + rainnc
rainTot at description = "Total Precipitation"
rainTot at units = rainc at units
wks = gsn_open_wks("png","WRF_lc")
colors = (/"white","azure" \
,"green","palegreen","yellowgreen", "greenyellow" \
,"yellow","goldenrod","orange","orangered" \
,"red","deeppinK", "violet","darkviolet" \
,"blueviolet","blue" /)
res = True ; plot mods desired
res at gsnMaximize = True ; maximize size
res at gsnScalarContour = True ; contours desired
res at gsnLeftString = "Wind Vectors (m/s)"
res at gsnRightString = "Total Precipitation (mm)"
res at cnFillOn = True ; color plot desired
res at cnFillPalette = colors ; define colors for contour plot
res at cnLinesOn = False ; turn off contour lines
res at cnLineLabelsOn = False ; turn off contour labels
res at cnFillMode = "RasterFill" ; raster
res at cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal] cn levels
res at cnLevels =
(/0,0.1,1,2.5,5,7.5,10,15,20,25,37.5,50,75,100,125,150/)
res at vcGlyphStyle = "WindBarb"
res at vcRefLengthF = 0.025 ; ref vec length
res at vcMinDistanceF = 0.025 ; larger means sparser
res at vcWindBarbTickLengthF = 0.4 ; default 0.3
res at vcRefAnnoOn = False
res = wrf_map_resources(f,res)
res at gsnAddCyclic = False ; regional data: not cyclic
res at tfDoNDCOverlay = True
res at mpFillOn = False
res at mpGeophysicalLineColor = "black" ; wrf_map_resources uses "gray"
res at mpUSStateLineColor = "black"
res at mpGeophysicalLineThicknessF = 2.0 ; wrf_map_resources uses 0.5
res at mpUSStateLineThicknessF = 2.0
;
; Plot one time and level for demo
; . create u and v on a common grid for visualization: nothing fancy
;
nt = 12
;;do nt=0,ntim-1 ; uncomment to loop
res at tiMainString = times(nt)
plot = gsn_csm_vector_scalar_map(wks,u10(nt,:,:),v10(nt,:,:),rainTot(nt,:,:),res)
;;end do
end
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181217/df4c7043/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WRF_lc.pdf
Type: application/pdf
Size: 73084 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181217/df4c7043/attachment.pdf>
More information about the ncl-talk
mailing list