Hi, question from a new user:
I am trying to use gsn_csm_contour_map_overlay to display an NCEP/NCAR
reanalysis wind field (shaded) and its meridional gradient (contour).
However, the contour data won't plot correctly (it appears compressed
into a smaller region in the top-right -- see attached). I believe
the lon/lat2d variables and their "units" attribute are defined
correctly (although the warnings suggest otherwise). The problem
appears to be that the gradsf procedure modifies the coordinates
somehow, because I can contour overlay the wind field with itself
without a problem.
Thanks in advance, all the output follows.
Chris
I see the following warnings from my script:
(0) is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must either
be the same dimension sizes as the data, or one element larger in both
directions. Your data will most likely not be overlaid on the map
correctly.
(0) is_valid_latlon2d_attr: Warning: The 'lon2d' attribute must either
be the same dimension sizes as the data, or one element larger in both
directions. Your data will most likely not be overlaid on the map
correctly.
(0) check_for_y_lat_coord: Warning: Data either does not contain a
valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0) check_for_lon_coord: Warning: Data either does not contain a valid
longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
;Here are the details from printVarSummary
;***********************************************
Variable: lat2d
Type: float
Total Size: 292 bytes
73 values
Number of Dimensions: 1
Dimensions and sizes: [lat | 73]
Coordinates:
lat: [90..-90]
Number Of Attributes: 3
units : degrees_north
actual_range : ( 90, -90 )
long_name : Latitude
Variable: lon2d
Type: float
Total Size: 576 bytes
144 values
Number of Dimensions: 1
Dimensions and sizes: [lon | 144]
Coordinates:
lon: [ 0..357.5]
Number Of Attributes: 3
units : degrees_east
long_name : Longitude
actual_range : ( 0, 357.5 )
Variable: u
Type: float
Total Size: 42048 bytes
10512 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 73] x [lon | 144]
Coordinates:
lat: [90..-90]
lon: [ 0..357.5]
Number Of Attributes: 15
lat2d : <ARRAY of 73 elements>
lon2d : <ARRAY of 144 elements>
long_name : Monthly mean u wind
actual_range : ( -66.37, 124.4 )
valid_range : ( -125, 160 )
units : m/s
missing_value : 32766
precision : 2
least_significant_digit : 1
var_desc : u-wind
U
dataset : CDC Derived NCEP Reanalysis Products
AC
level_desc : Multiple levels
F
statistic : Mean
M
parent_stat : Other
-
_FillValue : 32766
Variable: vdiv
Type: float
Total Size: 42048 bytes
10512 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 73] x [lon | 144]
Coordinates:
lat: [90..-90]
lon: [ 0..357.5]
Number Of Attributes: 15
_FillValue : 32766
parent_stat : Other
-
statistic : Mean
M
level_desc : Multiple levels
F
dataset : CDC Derived NCEP Reanalysis Products
AC
var_desc : v-wind
V
least_significant_digit : 1
precision : 2
missing_value : 32766
units : m/s
valid_range : ( -125, 160 )
actual_range : ( -66.65, 66.39 )
long_name : Monthly mean v wind
lon2d : <ARRAY of 144 elements>
lat2d : <ARRAY of 73 elements>
Here is my script:
;***********************************************
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
;*************************************************
dir = "/home/cgf/projects/"
f = addfile (dir+"uwnd200.nc", "r")
u = f->uwnd ; (lat,lon)
lat2d = f->lat
lon2d = f->lon
f2 = addfile (dir+"vwnd200.nc", "r")
v = f2->vwnd
printVarSummary(lat2d)
printVarSummary(lon2d)
u_at_lon2d=lon2d
u_at_lat2d=lat2d
v_at_lon2d=lon2d
v_at_lat2d=lat2d
udiv=u
vdiv=v
gradsf(u,udiv,vdiv)
;
; ************
; plotting
;
;
wks = gsn_open_wks("ps","wind") ; open a workstation
gsn_define_colormap(wks,"BlWhRe")
;************************************************
; resource list for first data array
;************************************************
res1 = True
res1_at_gsnDraw = False ; don"t draw
res1_at_gsnFrame = False ; don"t advance frame
res1_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour
levels
res1_at_cnMinLevelValF = -5. ; set min contour level
res1_at_cnMaxLevelValF = 45. ; set max contour
level
res1_at_cnLevelSpacingF = 2 ; set contour spacing
res1_at_lbOrientation = "Vertical" ; vertical label bar
res1_at_lbLabelAutoStride = True ; optimal label stride
res1_at_gsnSpreadColors = True ; use full range of
colors
res1_at_gsnSpreadColorEnd = -3 ; don"t use added gray
; res1_at_mpCenterLonF = 180. ; center plot at 180
res1_at_mpMinLonF = 0. ; select a subregion
res1_at_mpMaxLonF = 360.
res1_at_mpMinLatF = -90.
res1_at_mpMaxLatF = 90.
;************************************************
; resource list for second data array
;************************************************
res2 = True
res2_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour
levels
res2_at_cnMinLevelValF = -10. ; set min contour level
res2_at_cnMaxLevelValF = 10. ; set max contour level
res2_at_cnLevelSpacingF = 0.5 ; set contour spacing
res2_at_cnLineLabelsOn = True
res2_at_gsnContourZeroLineThicknessF = 2. ; doubles thickness of
zero contour
res2_at_gsnContourNegLineDashPattern = 1 ; sets negative
contours to dash pattern 1
printVarSummary(u)
printVarSummary(vdiv)
plot=gsn_csm_contour_map_overlay(wks,u,vdiv*1e5,res1,res2)
draw(plot)
frame(wks)
end
-----------------------------------------------
Chris Fletcher, Research Associate
+ Dept. of Physics, U. of Toronto, 60 St. George St.,Toronto, ON, M5S
1A7, Canada.
+ Tel: +1-416-946-0344
+ Home page: http://www.atmosp.physics.utoronto.ca/people/cgf/
-----------------------------------------------
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.2.0 : Fri Aug 14 2009 - 13:47:46 MDT