The script below reads in monthly mean SST and zonal wave1 amplitude
data, and then creates and animated contour overlay SH stereographic. The
script works fine if I set the resource for the SST cnLevelSelectionMode
to "AutomaticLevels", but if use ManualLevels (or ExplicitLevels, for
that matter) the zw1 contours (plot map2) is offset from the map plot.
Any ideas?
Many thanks,
Will
;=====================================================================;
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;======================================================================
;Plot animation of SH monthly mean zw
begin
;*******USER PARAMETERS***********************
plev = 500 ; select required pressure level
wave = 1 ; select required wavenumber
;***************************************8
;Read in data
;**************************************
FIL1 = "zw_amplitudes_1960_2004.nc"
diri1 = "data/"
f1 = addfile(diri1+FIL1, "r")
amp = f1->amplitude({wave},:,{plev},:,:)
; harmonic = f1->harmonic
time1 = f1->time
;amp dimensions are (harmonic|,time|,level|,lat|, lon|)
;read in SST data
diri2 = "/u/whobbs/ncep/"
; FIL2 = "coads_sst_SH_1960_2004.nc"
; datsrc = "COARDS"
FIL2 = "noaa_sst_SH_1960_2002.nc"
datsrc = "NOAA"
f2 = addfile(diri2+FIL2, "r")
sst = f2->sst
time2 = f2->time
;(sst dims are (time, lat, lon)
dimsst = dimsizes(sst)
dimamp = dimsizes(amp)
;ensure times are coincident
if (dimsst(0).gt.dimamp(0)) then
nmos = dimamp(0)
else
nmos = dimsst(0)
end if
delete(dimsst)
delete(dimamp)
;******************************************************
; create plots
;************************************************
wks = gsn_open_wks("ncgm" ,"plots/zw"+wave+"_z"+plev+"_"+datsrc+"SST")
gsn_define_colormap (wks, "BlueRedGray")
mpres = True ;map resources
mpres_at_gsnDraw = False
mpres_at_gsnFrame = False
mpres_at_gsnMaximize = True
mpres_at_gsnPolar = "SH"
mpres_at_mpMaxLatF = -20
mpres_at_mpGridMaxLatF = -45
mpres_at_mpGridLatSpacingF = 30.
mpres_at_mpGridLonSpacingF = 45.
mpres_at_gsnLeftString = plev+"hPa (gpm)"
mpres_at_gsnCenterString = datsrc
mpres_at_gsnRightString = "SST - degC"
res = True ;sst contour resources
res_at_gsnDraw = False
res_at_gsnFrame = False
res_at_cnLinesOn = False
res_at_cnFillOn = True
res_at_gsnSpreadColors = True
res_at_gsnSpreadColorEnd = -2
res_at_cnLevelSelectionMode = "ManualLevels"
res_at_cnMaxLevelValF = 25
res_at_cnMinLevelValF = -25.
res_at_cnLevelSpacingF = 2
res_at_gsnLeftString = ""
res_at_gsnCenterString = ""
res_at_gsnRightString = ""
res_at_lbLabelBarOn = True
resi = True ; zw1 contour resources
resi_at_gsnDraw = False
resi_at_gsnFrame = False
resi_at_cnLinesOn = True
resi_at_cnFillOn = False
resi_at_cnLevelSelectionMode = "ManualLevels"
resi_at_cnMaxLevelValF = 160.
resi_at_cnMinLevelValF = -160.
resi_at_cnLevelSpacingF = 20
resi_at_gsnContourNegLineDashPattern = 2
resi_at_lbLabelBarOn = False
resi_at_cnLineLabelsOn = True
setvalues wks
"wkForegroundColor" : (/"Black"/)
"wkBackgroundColor" : (/"White"/)
end setvalues
print("beginning plots")
;create month/year array for display
yr = ispan(1960, 1959+(nmos/12), 1)
mon =
(/"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"/)
date = new((/nmos/), string)
dd = 0
do yy = 0, dimsizes(yr)-1 ; concatenate month and years
do mm = 0,11
date(dd) = mon(mm)+" "+yr(yy)
dd = dd+1
end do
end do
delete(yr)
delete(mon)
delete(dd)
nmo = 0
mpres_at_tiMainString = date(nmo)+" monthly mean zonal wave "+wave+":C:
amplitude and SST"
map1 = gsn_csm_contour(wks, sst(0,:,:), res)
map2 = gsn_csm_contour(wks, amp(0,:,:), resi)
mapid = gsn_csm_map_polar(wks, mpres)
overlay(mapid, map1)
overlay(mapid, map2)
draw(mapid)
frame(wks)
do nmo = 1, nmos-1
monyr = date(nmo)
setvalues mapid
"tiMainString" : monyr+" monthly mean zonal wave "+wave+":C:
amplitude and SST"
end setvalues
setvalues map1_at_data
"sfDataArray" : sst(nmo,:,:)
end setvalues
setvalues map2_at_data
"sfDataArray" : amp(nmo,:,:)
end setvalues
draw(mapid)
frame(wks)
end do
delete(mapid)
delete(map1)
delete(map2)
delete(amp)
delete(sst)
end
============================
Room 3221C
UCLA Department of Geography
1255 Bunche Hall
Los Angeles CA 90095-1524
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Feb 18 2006 - 17:52:53 MST
This archive was generated by hypermail 2.2.0 : Tue Feb 21 2006 - 14:23:51 MST