Re: WRF overlays

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 4 Jun 2008 14:17:55 -0600 (MDT)

On Wed, 4 Jun 2008, James Correia wrote:

> Thanks Mary-
> That is what I usually do, use the gsn routines, but I didnt know I could
> use them to zoom in on an area. Are the gsn routines able to zoom in to a
> portion of the domain while retaining the map?

I'm not sure what you mean about retaining the map. Are you saying
that you only want to plot a subset of the data, but that you want to
keep the original map area that the full data is measured on?

Some info: when you use the WRF_map_c procedure, this looks at
attributes on your WRF file and determines what map resources need to
be set in order to correctly display the map area of interest using
the correct projection. This effectively causes the map to be zoomed in
to the area that the data is measured over.

This usually involves setting the "mpProjection" resource, as well as
"mpLimitMode", "mpLeftCornerLatF", "mpRightCornerLatF", "mpCenterLonF",
etc.

After you call this procedure, you can print the resource variable
to see exactly what map resources were added to it:

     WRF_map_c(f, res, 0) ; reads info from file
     print(res)

You can then change the values yourself if you need to.

--Mary

> Thanks for your help.
> jimmyc
>
>
> On Wed, Jun 4, 2008 at 8:03 AM, Mary Haley <haley_at_ucar.edu> wrote:
>
>>
>> Jimmy,
>>
>> The error message you're getting indicates something is probably
>> syntactically wrong with your vort.ncl script, and not with
>> wrf_overlay per se. It's hard to tell from looking at the code
>> snippet, however.
>>
>> The WRF-NCL plotting scripts are meant to be more black-box, and not
>> so much be customizable.
>>
>> If you want to try to use gsn_csm_xxx functions to do your plotting,
>> then there are some examples that are similar to what you want to do.
>> See example WRF_lc_8 at:
>>
>> http://www.ncl.ucar.edu/Applications/wrflc.shtml
>>
>> This one generates vectors and contours over a map, but you can
>> substitute the "gsn_csm_vector_scalar_map" call with a call to
>> "gsn_csm_contour_map_overlay" which allows you to overlay two contour
>> plots.
>>
>> To see an actual example of using gsn_csm_contour_map_overlay, see
>> example 2 at:
>>
>> http://www.ncl.ucar.edu/Applications/conOncon.shtml
>>
>> You still want to refer to the WRF_lc example for using WRF_map_c
>> to set up your map resources, but you can use the above example
>> for tips on how to set up your two contouring resource lists.
>>
>> --Mary
>>
>>
>> On Tue, 3 Jun 2008, James Correia wrote:
>>
>> Hi All-
>>> I am trying to overlay some variables using the wrf_contour function. I
>>> have
>>> completely given up on the whole zooming in feature listed at the WRF-NCL
>>> website. It appears these will work in the future NCL release at least
>>> thats
>>> what I am guessing.
>>>
>>> My attempt to use wrf_overlay always results in an error. The error is:
>>> fatal:syntax error: line xxx in the file vort.ncl before or near
>>> wrf_overlay
>>> plot = wrf_overlay
>>> ______________^
>>>
>>> Does anybody have an example script using the 5.0.0 NCL release that can
>>> accomplish:
>>> 1. zooming in to a region of the domain
>>> 2. overlay two variables (one with shading and one with contouring)
>>> 3. maximize the plot size to fit the page.
>>>
>>> Thanks
>>> jimmyc
>>>
>>>
>>>
>>> Due to the length of the code, I have provided my plotting procedure:
>>> res = True
>>> colors = (/"white","black" \ ; {fore/back}ground
>>> ,"white" \
>>> ,"orange" \
>>> ,"red","violet" \
>>> ,"blueviolet","blue" /)
>>> gsn_define_colormap(wks, colors)
>>> res_at_gsnMaximize = True ; maximize size
>>> res_at_gsnSpreadColors = True ; use full range of
>>> colormap
>>> res_at_gsnRightString = "Vorticity and W"
>>> res_at_gsnLeftString = "Wind speed"
>>> res_at_mpGeophysicalLineThicknessF = 2.0
>>> res_at_mpUSStateLineThicknessF = 2.0
>>> ;************************************************
>>> ; Use WRF_contributed procedure to set map resources
>>> ;************************************************
>>> WRF_map_c(f, res, 0) ; reads info from file
>>>
>>> ;************************************************
>>> ; set True for native (direct) mapping (faster plotting)
>>> ; set False for non-native mappings
>>> ;************************************************
>>> res_at_tfDoNDCOverlay = True
>>>
>>> ;************************************************
>>> ; associate the 2-dimensional coordinates to the variable for plotting
>>> ; only if not a native projection [ res_at_tfDoNDCOverlay=False ]
>>> ;************************************************
>>> if (.not.res_at_tfDoNDCOverlay) then
>>> lat2d = f->XLAT(0,:,:)
>>> lon2d = f->XLONG(0,:,:)
>>>
>>> u10_at_lat2d = lat2d
>>> u10_at_lon2d = lon2d
>>> v10_at_lat2d = lat2d
>>> v10_at_lon2d = lon2d
>>>
>>> rainTot_at_lat2d = lat2d
>>> rainTot_at_lon2d = lon2d
>>> end if
>>>
>>>
>>> nt=64
>>> x1 = 120
>>> x2 = 210
>>> ;x1 = 120
>>> ;x2 = 210
>>> y1 = 80 ;-20
>>> y2 = 140;-20
>>> zres = True
>>> zres_at_ZoomIn = True
>>> zres_at_Xstart = x1
>>> zres_at_Xend = x2
>>> zres_at_Ystart = y1
>>> zres_at_Yend = y2
>>> res_at_cnFillMode = "RasterFill" ; raster
>>> res_at_cnLevels = (/0.5,1,2,4,6,8,12/)
>>> res_at_cnFillOn = True ; color plot desired
>>> res_at_cnLinesOn = False ; turn off contour lines
>>> res_at_cnLineLabelsOn = False ; turn off contour labels
>>> res_at_cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal] cn
>>> levels
>>>
>>> w = f->W(64,:,:,:)
>>> wa = new((/nlevs,224,299/),float)
>>> do k=0,33
>>> wa(k,:,:) = (w(k,:,:) + w(k+1,:,:))/2.
>>> end do
>>> delete(w)
>>>
>>> fill = wrf_contour(f,wks,wa(4,y1:y2,x1:x2),res)
>>> ;draw(fill)
>>> ;frame(wks)
>>>
>>> resa = True
>>> resa_at_cnLevels = (/-6,-4,-3,-2,-1,-0.5,0.5,1,2,3,4,6/)
>>> resa_at_cnFillOn = False ; color plot desired
>>> resa_at_cnLinesOn = True ; turn off contour lines
>>> resa_at_cnLineLabelsOn = True ; turn off contour labels
>>> resa_at_cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal] cn
>>> levels
>>>
>>> con = wrf_contour(f,wks,vor(nt,y1:y2,x1:x2),resa)
>>> plot = wrf_overlay(wks,(/fill,con/),zres)
>>>
>>> ;also tried using True in place of zres; same problem
>>>
>>> ;draw(con)
>>> ;frame(wks)
>>> end
>>>
>>>
>>>
>>>
>>> --
>>> James Correia Jr.
>>> Post Doc
>>> Climate Physics Group, PNNL
>>>
>>>
>
>
> --
> James Correia Jr.
> Post Doc
> Climate Physics Group, PNNL
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 04 2008 - 14:17:55 MDT

This archive was generated by hypermail 2.2.0 : Wed Jun 04 2008 - 15:43:54 MDT