brandi_clark@mavs_uta_edu
New Member
Code:
I have been going back and forth with CISL help, and they directed me to this site.<br /><br />I am trying to map data from the CESM RCP 8.5 simulations. I couldn't find out whether or not the
data are on a native grid for Lambert Conformal, so I am assuming not. To get NCL to read in the
lat and lon correctly, I found the code on NCL's website:
; open file and read in data
;*******************************************
f = addfile ("pre.8912.mon.nc", "r")
P = f->pre
LAT2D= f->lat
LON2D= f->lon
;********************************************
;reorder arrays
;********************************************
p = P(time|:,ycoord|:,xcoord|:)
lon2d=LON2D(ycoord|:,xcoord|:)
lat2d=LAT2D(ycoord|:,xcoord|:)
;********************************************
I am not sure what to use for ycoord and xcoord. I printed the variables and included screen shots
of lat and lon.
Code:
Hi Brandi,
From your screenshots, it looks like you have a rectilinear grid, which is relatively easy to plot.
A rectilinear grid is one that can be represented by one-dimensional coordinate arrays.
I agree with you that your data is probably not on a native lambert conformal map.
If you want to put it on a Lambert Conformal, you will need to set the two corners of your grid,
and set the two parallels and meridian.
See the sample script, which allows you to set LAMBERT_CONFORMAL to False if you want the default
cylindrical equidistant map.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
f = addfile ("myfile.nc", "r")
x = f->x
wks = gsn_open_wks ("ps", "lcnative") ; open workstation
res = True ; plot mods desired
res@cnFillOn = True ; color fill
res@gsnAddCyclic = False ; if regional data
LAMBERT_CONFORMAL = True ; Use a lambert conformal map
if(LAMBERT_CONFORMAL) then
res@mpProjection = "LambertConformal"
res@mpLimitMode = "Corners" ; choose range of map
res@mpLeftCornerLatF = min(x&lat) ; change as necessary
res@mpLeftCornerLonF = min(x&lon) ; change as necessary
res@mpRightCornerLatF = max(x&lat) ; change as necessary
res@mpRightCornerLonF = max(x&lon) ; change as necessary
res@mpLambertParallel1F = 30. ; change as necessary
res@mpLambertParallel2F = 55. ; change as necessary
res@mpLambertMeridianF = 45. ; change as necessary
else
res@mpMinLatF = min(x&lat) ; change as necessary
res@mpMinLonF = min(x&lon) ; change as necessary
res@mpMaxLatF = max(x&lat) ; change as necessary
res@mpMaxLonF = max(x&lon) ; change as necessary
end if
plot = gsn_csm_contour_map(wks,x,res)
end
In that example, it looks like they are reading in the one-dimensional lat and lon variables and converting them to 2-dimensional variables lat2d and lon2d, which are then used to define the corners.