plotting a regional zoom of a lambert conformal grid

From: Steve Nesbitt <snesbitt_at_nyahnyahspammersnyahnyah>
Date: Wed, 24 Jan 2007 16:29:25 -0600

Hello,

I am trying to plot RUC model data using NCL (4.2.0.a033 on linux).
I can plot maps of the data over the entire domain, but when I try to
subset the data over the Midwest, for example (if you look carefully)
the map zooms in but the data does not. The attached images show
this behavior. See the script below for my attempt at zooming in.
If you want access to the raw data to try, let me know.

Thanks,
-Steve


;*******************************************************
; plotetaruc.ncl
;*******************************************************
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/csm/contributed.ncl"

begin
;************************************************
; open file and read in data
;************************************************
   diri = "./"
   fili = "my.grb"
   f = addfile (diri+fili, "r")
   names = getfilevarnames(f)
; print(names)
; printVarSummary(names)

   atts = getfilevaratts(f,names(0))
; dims = getfilevardims(f,names(0))
; print(atts)
; print(dims)

; get vars

   w = f->V_VEL_252_ISBL
   u = f->U_GRD_252_ISBL
   v = f->V_GRD_252_ISBL
   z = f->HGT_252_ISBL
   zeta = f->ABS_V_252_ISBL
   t = f->TMP_252_ISBL
   t_sfc = f->TMP_252_SFC
   u_sfc = f->U_GRD_252_HTGL
   v_sfc = f->V_GRD_252_HTGL
   pmsl = f->MSLMA_252_MSL
   rh = f->R_H_252_ISBL
   spd = u*0.
   spd = (u^2.+v^2)^0.5
   prate= f->PRATE_252_SFC

   pres = f->lv_ISBL2
   lat2d = f->gridlat_252
   lon2d = f->gridlon_252

time=w_at_initial_time
print(time)
;printVarSummary(lat)

   dims=dimsizes(w)
; print(dims)
   nlon=dims(2)
   nlat=dims(1)

; print(nlon)
; print(nlat)
; print(var)
; print(pres(12))
; printVarSummary(var)
; printVarSummary(lon2d)
; printVarSummary(lat2d)

;*************************
;common plotting resources
;*************************

    res = True ; plot mods desired
    res_at_gsnDraw = False
    res_at_gsnFrame = False
    res_at_cnLinesOn = False
    res_at_cnFillOn = True ; color plot desired
    res_at_cnLineLabelsOn = False ; turn off contour lines
    res_at_gsnAddCyclic = False
; !!!!! any plot of data that is on a native grid, must use the
"corners"
; method of zooming in on map.

;**** ZOOMED IN
    res_at_mpLimitMode = "Corners" ; choose range of map
    res_at_mpLeftCornerLatF = 35.
    res_at_mpLeftCornerLonF = -105.
    res_at_mpRightCornerLatF = 47.
    res_at_mpRightCornerLonF = -80.
;**** ZOOMED OUT
    res_at_mpLimitMode = "Corners" ; choose range of map
   res_at_mpLeftCornerLatF = lat2d(0,0)
   res_at_mpLeftCornerLonF = lon2d(0,0)
   res_at_mpRightCornerLatF = lat2d(nlat-1,nlon-1)
   res_at_mpRightCornerLonF = lon2d(nlat-1,nlon-1)

;
; The following 4 pieces of information are REQUIRED to properly display
; data on a native lambert conformal grid. This data should be
specified
; somewhere in the model itself.

; WARNING: our local RCM users could not provide us with this
information,
; so this is our best guess as to the correct numbers. Use at your
own risk.

    res_at_mpProjection = "LambertConformal"
    res_at_mpLambertParallel1F = lon2d_at_Latin1
    res_at_mpLambertParallel2F = lon2d_at_Latin2
    res_at_mpLambertMeridianF = lon2d_at_Lov

; usually, when data is placed onto a map, it is TRANSFORMED to the
specified
; projection. Since this model is already on a native lambert
conformal grid,
; we want to turn OFF the tranformation.

    res_at_tfDoNDCOverlay = True

    res_at_mpGeophysicalLineColor = "red" ; color of
continental outlines
    res_at_mpPerimOn = True ; draw box
around map
    res_at_mpGridLineDashPattern = 2 ; lat/lon
lines as dashed
    res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates" ; add state
boundaries
    res_at_mpUSStateLineColor = "red" ; make them red
    res_at_pmTickMarkDisplayMode = "Always" ; turn on
tickmarks
   res_at_cnLineLabelInterval = 1
res_at_cnLabelMasking = True
    res_at_gsnSpreadColors=True
    res_at_gsnSpreadColorStart = 3
    res_at_gsnSpreadColorEnd = 19
   wks = gsn_open_wks("ps","ruc_300") ; open a workstation
;plot=new(4,graphic)
    gsn_define_colormap(wks,"gui_default") ; choose colormap

;************************************************
; create plot: upper left
;************************************************

res1=res
res1_at_tiMainString=time
res1_at_gsnLeftString="300hPa height(dm), wind speed(m/s) "
res1_at_cnLevelSelectionMode = "ManualLevels" ; manual levels
res1_at_cnMinLevelValF = 10. ; min level
res1_at_cnMaxLevelValF = 100. ; max level
res1_at_cnLevelSpacingF = 10 ; contour spacing

res2=True

   res2_at_tfDoNDCOverlay = True
   res2_at_cnInfoLabelOn = False
   res2_at_cnMinLevelValF = 900.+12*12 ; set min
contour level
   res2_at_cnMaxLevelValF = 900.-12*12 ; set max
contour level
   res2_at_cnLevelSpacingF = 12. ; set contour spacing
   res2_at_cnLineLabelsOn = True
   res2_at_cnLineLabelInterval = 1
res2_at_cnLabelMasking = True
; res2_at_cnHighLabelsOn = True; label highs
; res2_at_cnHighLabelString = "H"; highs' label
; res2_at_cnHighLabelFontHeightF = 0.03; larger H labels
; res2_at_cnHighLabelFont = "helvetica-bold"; H labels font
; res2_at_cnHighLabelBackgroundColor = "Transparent"; no box
; res2_at_cnLowLabelsOn = True; label lows
; res2_at_cnLowLabelString = "L"; lows' label
; res2_at_cnLowLabelFontHeightF = 0.03; larger L labels
; res2_at_cnLowLabelFont = "helvetica-bold"; L labels font
; res2_at_cnLowLabelBackgroundColor = "Transparent"; no box
; res2_at_cnConpackParams = (/ "HLX:6, HLY:6" /)

index300=ind(pres.eq.300.)

    plot1 = gsn_csm_contour_map_overlay(wks,spd(index300,:,:),z
(index300,:,:)/10.,res1,res2) ; Draw contours over a map.

   draw(plot1)
   frame(wks)

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 24 2007 - 15:29:25 MST

This archive was generated by hypermail 2.2.0 : Mon Feb 05 2007 - 16:31:09 MST