Re: zooming in on WRF plots

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 14 Jul 2008 13:57:18 -0600 (MDT)

Joe,

I looked at the WRFUserARW.ncl file, and it appears it is expecting
index integers for these start and end values, and not actual lat/lon
values. I think you need to determine at what indices your desired
lat/lon values fall at in your 2D lat/lon arrays, and use these values
instead.

Just FYI: if you try to put a floating point value in an NCL variable
that's already an integer, you will get the error message about "can't
be coerced to type of...".

--Mary

On Mon, 14 Jul 2008, Joe Grim wrote:

> Hi,
>
> I am new to NCL and attended the NCL workshop last week. I have been trying
> to find a way to zoom in on WRF plots, and according to the information on
> the WRF graphics site
> (http://www.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/NCL_functions.htm#map_overlay),
> it's just a simple matter of adding five lines to the code:
> mpres_at_ZoomIn = True
> mpres_at_Xstart = -74.75 (here I tried using longitude and latitude, but I also
> tried using the 0.0 - 1.0 plotting coordinates as well)
> mpres_at_Xend = -72.25
> mpres_at_Ystart = 39.50
> mpres_at_Yend = 41.75
>
> However, when I try to run it, I get the following errors:
> fatal:Assignment type mismatch, right hand side can't be coerced to type of
> left hand side
> fatal:Execute: Error occurred at or near line 1518 in file ./WRFUserARW.ncl
>
> fatal:Execute: Error occurred at or near line 1727 in file ./WRFUserARW.ncl
>
> fatal:Execute: Error occurred at or near line 133 in file SST_new.ncl
>
> Do you know what I'm doing wrong? If I comment out these five new lines, the
> plot is made beautifully, except that it's not zoomed in, of course.
>
> Below is my entire code, in case that would be helpful.
>
> I would appreciate very much any help you could give!
>
> Joe Grim
>
>
>
> << SST_new.ncl >>
> ; Example script to produce plots for a WRF real-data run,
> ; with the ARW coordinate dynamics option.
>
> 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 "./WRFUserARW.ncl"
>
> begin
>
> start_month="04"
> start_day="10"
> start_hour="06"
> end_day="10"
> end_hour="21"
> ;
> ; The WRF ARW input file.
> ; This needs to have a ".nc" appended, so just do it.
>
> cntrl_file="/d1/grim/NASA_NYC/WRF_output/cntrl/2006"+start_month+start_day+start_hour+"/wrfout_d03_2006-"+start_month+"-"+end_day+"_"+end_hour+":00:00.GRM_P+FCST.nc"
>
> new_sst_file="/d1/grim/NASA_NYC/WRF_output/new_sst/2006"+start_month+start_day+start_hour+"/wrfout_d03_2006-"+start_month+"-"+end_day+"_"+end_hour+":00:00.GRM_P+FCST.nc"
> a = addfile(cntrl_file,"r")
> b = addfile(new_sst_file,"r")
>
> ; We generate plots, but what kind do we prefer?
> ; type = "x11"
> ; type = "pdf"
> type = "ps"
> ; type = "ncgm"
> wks = gsn_open_wks(type,"SST_diff/SST_new")
> gsn_define_colormap(wks,"rainbow")
>
> ; Set some basic resources
> res = True
> res_at_MainTitle = "REAL-TIME WRF"
>
> pltres = True
> mpres = True
> mpres_at_mpUSStateLineColor = "black"
> mpres_at_mpUSStateLineThicknessF = 2
> mpres_at_mpGeophysicalLineColor = "black"
> mpres_at_mpGeophysicalLineThicknessF = 2
> mpres_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"
> mpres_at_ZoomIn = True
> mpres_at_Xstart = -74.75
> mpres_at_Xend = -72.25
> mpres_at_Ystart = 39.50
> mpres_at_Yend = 41.75
> ; mpres_at_Xstart = 0.25
> ; mpres_at_Xend = 0.75
> ; mpres_at_Ystart = 0.25
> ; mpres_at_Yend = 0.75
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> it=0
> times = wrf_user_list_times(a) ; get times in the file
> res_at_TimeLabel = times(it) ; Set Valid time to use on plots
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; First get the variables we will need slp =
> wrf_user_getvar(a,"slp",it) ; slp
> wrf_smooth_2d( slp, 3 ) ; smooth slp
> u_old = wrf_user_getvar(a,"ua",it) ; 3D U at mass points
> v_old = wrf_user_getvar(a,"va",it) ; 3D V at mass points
> u_new = wrf_user_getvar(b,"ua",it) ; 3D U at mass points
> v_new = wrf_user_getvar(b,"va",it) ; 3D V at mass points
> u10_old = u_old(0,:,:) ; Use lowest level at time 0
> v10_old = v_old(0,:,:)
> u10_new = u_new(0,:,:) ; Use lowest level at time 0
> v10_new = v_new(0,:,:)
>
> ; Extra variables I want to look at
> Land_mask = wrf_user_getvar(a,"XLAND",it) ; Land Mask (1 FOR LAND, 2 FOR
> WATER
> SST_old = wrf_user_getvar(a,"SST",it) ; SST
> SST_new = wrf_user_getvar(b,"SST",it) ; SST
> SST_diff = SST_new - SST_old ; SST difference btwn the sims
> SST_old = SST_old-273.15
> SST_old_at_units = "C"
> SST_old_at_description = "Old Sea Surface Temperatures"
> SST_new = SST_new-273.15 SST_new_at_units = "C"
> SST_new_at_description = "New Sea Surface Temperatures"
> SST_old = mask(SST_old,Land_mask,2)
> SST_new = mask(SST_new,Land_mask,2)
> SST_diff = mask(SST_diff,Land_mask,2)
> SST_diff_at_description = "SST Difference (new-old)"
> SST_diff_at_units = "C"
> u10_diff = u10_new - u10_old
> v10_diff = v10_new - v10_old
> u10_old_at_units = "m/s"
> v10_old_at_units = "m/s"
> u10_new_at_units = "m/s"
> v10_new_at_units = "m/s"
> u10_diff_at_units = "m/s"
> v10_diff_at_units = "m/s"
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> ; Plotting options for New SST Wind Vectors
> opts = res
> opts_at_FieldTitle = "Wind" ; overwrite Field Title
> opts_at_NumVectors = 24 ; density of wind barbs
> opts_at_vcGlyphStyle = "LineArrow"; type of wind arrow/barb
> opts_at_vcRefAnnoOn = True
> opts_at_vcRefLengthF = 0.03
> opts_at_vcRefMagnitudeF = 5.0
> vector_new = wrf_vector(a,wks,u10_new,v10_new,opts)
> delete(opts)
>
> ; Plotting options for SST_new
> opts = res
> opts_at_cnFillOn = True
> opts_at_cnLinesOn = False
> opts_at_ContourParameters = (/ 0., 12., 2./)
> opts_at_gsnSpreadColors = True
> opts_at_gsnSpreadColorEnd = -3 ; End third from the last color in color map
> contour_SST_new = wrf_contour(a,wks,SST_new,opts)
> delete(opts)
>
>
> ; MAKE PLOTS
>
> ; cmap = (/(/1.,1.,1./),(/0.,0.,0./),(/1.,.5,1./),(/1.,0.,1./),\
> ; (/.5,0.,1./),(/0.,0.,1./),(/0.,.5,1./),(/0.,1.,1./),\
> ; (/1.,1.,1./),(/1.,1.,1./),(/.7,1.,0./),\
> ; (/1.,1.,0./),(/1.,.5,0./),(/1.,0.,0./),(/.5,0.,0./),\
> ; (/.3,.3,0./),(/.5,.5,0./),(/.7,.7,0./)/)
>
> ; gsn_define_colormap(wks, cmap)
> ; gsn_define_colormap(wks,"ViBlGrWhYeOrRe")
>
> plot =
> wrf_map_overlays(a,wks,(/contour_SST_new,vector_new/),pltres,mpres)
>
> cmd="convert SST_diff/SST_new.ps SST_diff/SST_new.gif"
> cmd2="rm -f SST_diff/SST_new.ps"
> system (cmd)
> system (cmd2)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> end
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 14 2008 - 13:57:18 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 18 2008 - 08:51:52 MDT