[ncl-talk] plot model variable without knowledge of map projection?
Erik Noble
erik.u.noble at gmail.com
Tue Aug 12 12:23:15 MDT 2014
Dear NCL,
How can I plot a model variable on a grid without knowing the native grid's
particular map projection? I would like to see an image similar to what
"ncview" does when I look at the file (image attached). NCVIEW seems to
just know what to plot.
Although I am able to extract the variable, I can't seem to plot it
correctly at all. How do I show a decent map?
Thank you,
- Erik -
[image: Inline image 2][image: Inline image 1]
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"
; Get file
a=addfile("ICE.2012.01-12.f06.nc","r")
; Get variable
; and lat-lons (2D)
s1=a->SHF
printVarSummary(s1) ; display variable
lat2d = a->LAT
lon2d = a->LON
s1 at lat2d=lat2d
s1 at lon2d=lon2d
printVarSummary(s1) ; display variable again
; plot paramaters
res = True
wks = gsn_open_wks("x11" ,"x_static")
res at pmTickMarkDisplayMode = "Always" ; turn on lat / lon labeling
;************************************************
; set map limits
;************************************************
dimll = dimsizes(lat2d)
nlat = dimll(0)
mlon = dimll(1)
; res at mpProjection = ??? I HAVE NO IDEA???
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)
res at tfDoNDCOverlay = True ; True only for 'native' grid
res at gsnAddCyclic = False ; data are not cyclic
; res at lbLabelAutoStride = True ; let NCL determine label bar spacing
plot = gsn_csm_contour_map (wks,s1(0,:,:),res)
; TERMINAL OUTPUT
erikmbp:MAR_3.2 enoble$ ncl test_plot_080714.ncl
Copyright (C) 1995-2014 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.2.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
Variable: s1
Type: float
Total Size: 9662400 bytes
2415600 values
Number of Dimensions: 3
Dimensions and sizes: [TIME | 366] x [Y18_127 | 110] x [X10_69 | 60]
Coordinates:
TIME: [972672.0625..981432]
Y18_127: [-1200.000091097248..1525.000107494753]
X10_69: [-775.0000471284118..700.0000440380242]
Number Of Attributes: 3
units : W/m2
long_name : Sensible Heat Flux
history : From ICE.j06.2012.01.01-15
Variable: s1
Type: float
Total Size: 9662400 bytes
2415600 values
Number of Dimensions: 3
Dimensions and sizes: [TIME | 366] x [Y18_127 | 110] x [X10_69 | 60]
Coordinates:
TIME: [972672.0625..981432]
Y18_127: [-1200.000091097248..1525.000107494753]
X10_69: [-775.0000471284118..700.0000440380242]
Number Of Attributes: 5
lon2d : <ARRAY of 6600 elements>
lat2d : <ARRAY of 6600 elements>
units : W/m2
long_name : Sensible Heat Flux
history : From ICE.j06.2012.01.01-15
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140812/4b53046b/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncview_plot_SHF.png
Type: image/png
Size: 108680 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140812/4b53046b/attachment.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncl_plot_SHF.png
Type: image/png
Size: 52962 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140812/4b53046b/attachment-0001.png
More information about the ncl-talk
mailing list