I am trying to create a map with gsn_csm_contour_map (amongst many
other commands) and write directly to a png file. This wasn't
working, so I stripped everything out I could to find the problem and
still cannot get a single image to plot. If I set gsnDraw and
gsnFrame to False, the my png is empty. If I write to a ps file, then
I get 2 pages,the first being blank. If I set them to True, then I
get to frames that look the same.
Here is the code.
Thanks,
Craig
-------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
ifn1="idir1/winds.nc"
ifn2="idir2/winds.nc"
cfn1=addfile(ifn1,"r")
cfn2=addfile(ifn2,"r")
nt=dimsizes(cfn1->w080(:,0,0))
; Plot all time images
lat=cfn1->lat(:)
lon=cfn1->lon(:)
time=cfn1->time(:)
fv=48
d1=cfn1->w080(fv,:,:)
d2=cfn2->w080(fv,:,:)
d1&lat@units="degrees_north"
d1&lon@units="degrees_east"
d2&lat@units="degrees_north"
d2&lon@units="degrees_east"
; Difference of the magnitudes
data=d1
data=d2-d1
data&lat@units="degrees_north"
data&lon@units="degrees_east"
; Convert wind speed to knots
data=data*1.943
ofn="diff_80m_winds_mag"
;; ofn must be specified on the command line
wks=gsn_open_wks("png",ofn);
gsn_define_colormap(wks,"gui_default")
lat0=5.0
latf=60.0
lon0=220.0
lonf=320.0
; Set Defaults
; Set specific domain
res = True
res@cnLinesOn = False
res@cnFillOn = True
res@cnLineLabelsOn = False
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = lat0
res@mpLeftCornerLonF = lon0
res@mpRightCornerLatF = latf
res@mpRightCornerLonF = lonf
; Comment this out, I get two frames, not one
res@gsnDraw = False
res@gsnFrame = False
data@units="knots"
map = gsn_csm_contour_map(wks,data,res)
frame(wks)
draw(map)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 13 17:26:31 2014
This archive was generated by hypermail 2.1.8 : Fri Mar 14 2014 - 15:08:52 MDT