Re: Zooming in on native lambert conformal data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 6 Dec 2005 17:47:10 -0700 (MST)

>I'm having troubles plotting native lambert conformal data from my netcdf wrf
output...
>
>A simple script is below, basically, I want to plot zoomed views of my domain.
The first plot from the script (the entire domain) works fine but if I specify
new "corners" and plot, I get a zoomed background map but the data is at its
original scale.
>
> I would prefer to keep everything Lambert Conformal but am prepared to change
>
> lat2d = f->XLAT(0,:,:)
> lon2d = f->XLONG(0,:,:)
> dimll = dimsizes(lat2d)
> nlat = dimll(0)
> mlon = dimll(1)
>
> x = f->HGT(0,:,:) ; surface height

Comment before explanation:

When NCL imports a variable
it not only reads the values but also other information.
Essentially, it is a structure where users/software can
use NCL syntax [@, !, &] to access elements of the structure.
If a variable, has one or more strictly netCDF conforming
coordinate variables [ie: one dimensional monotonically
{in/de}creasing array with the additional constraint
that the variable name is the same as the
dimension name {eg lat(lat), time(time)}] then NCL
will automatically include these coordinates as part
of the structure. The gsn_csm* graphical interfaces
query the input data structure to test if the
data has true coordinate variables. It can then readily
plot the data.

WRF coordinates are not 1d/mono/ ... they are 2D.
Thus, the variable has no coordinate information
associated with it.

NCL has two reserved attribute names for variables
which have lat/lon coordinates that do not adhere to the
strict definition of netCDF coordinate variables
These are (arbitrarily) named "lat2d" and "lon2d".
Because there is no "rule" on how a 2d lat/lon array
is named, then it becomes the user responsibility to
associate the 2d arrays

   x_at_lat2d = lat2d ; also x_at_lat2d = f->XLAT(0,:,:)
   x_at_lon2d = lon2d
   
The gsn_csm* interfaces recognize these special reserved attributes.

>
> wks = gsn_open_wks("x11" ,"WRF_test") ; ps,pdf,x11,ncgm,eps
> res = True ; plot mods desired
>
> res_at_gsnAddCyclic = False ; regional data: not cyclic
> res_at_tfDoNDCOverlay = True ; set True for native projection
>
> res_at_gsnMaximize = True
> res_at_mpFillOn = True
> res_at_pmTickMarkDisplayMode = "Always"
>
> res_at_mpProjection = "LambertConformal"
> res_at_mpLambertParallel1F = f_at_TRUELAT1
> res_at_mpLambertParallel2F = f_at_TRUELAT2
> res_at_mpLambertMeridianF = f_at_CEN_LON
>
> res_at_mpLimitMode = "Corners"
> res_at_mpLeftCornerLatF = lat2d(0,0)
> res_at_mpLeftCornerLonF = lon2d(0,0)
> res_at_mpRightCornerLatF = lat2d(nlat-1,mlon-1)
> res_at_mpRightCornerLonF = lon2d(nlat-1,mlon-1)
>
> plot = gsn_csm_contour_map(wks, x, res) ; This works
fine

   res_at_tfDoNDCOverlay = False ; what u want to plot is
                                       ; not native the way NCL thinks of it
>
> res_at_mpLimitMode = "Corners"
> res_at_mpLeftCornerLatF = -45
> res_at_mpLeftCornerLonF = 170
> res_at_mpRightCornerLatF = -40
> res_at_mpRightCornerLonF = 175
>
> plot = gsn_csm_contour_map(wks, x, res)

I think this should work ... untested.

good luck
D

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 06 2005 - 17:47:10 MST

This archive was generated by hypermail 2.2.0 : Fri Dec 09 2005 - 10:22:22 MST