________________________________
From: eric.holt@huskers.unl.edu
Sent: Saturday, September 18, 2010 1:24 PM
To: ncl-users@ucar.edu
Subject: NARCCAP Resolution Problem
Hello,
I am trying to simply plot winds from RCM3-cgcm3 and RCM3-gdfl solutions under NARCCAP. I can run my code at 2 degree resolution, and my image is fine (2reswind.pdf). However, when I run my code at 0.5 degrees, the plot displays choppy data, or none at all (pt5reswind.pdf). This has been bugging me for a while now, can anyone provide a tip on why this is, and what I can do? It would be much appreciated. Thank You!
Here is the error when the 0.5 degree doesn't plot:
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible :[errno=1101]
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/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
begin
file1 = "vas_RCM3_cgcm3_2038010103.nc"
file2 = "uas_RCM3_cgcm3_2038010103.nc"
file3 = "vas_RCM3_cgcm3_2066010103.nc"
file4 = "uas_RCM3_cgcm3_2066010103.nc"
print("Starting file 1")
f1 = addfile(file1,"r")
print("Starting file 2")
f2 = addfile(file2,"r")
print("Starting file 3")
f3 = addfile(file1,"r")
print("Starting file 4")
f4 = addfile(file2,"r")
;===============================
;2038-2041
print("Starting U")
U10_o = f2->uas(0:5,:,:)
print("Starting V")
V10_o = f1->vas(0:5,:,:)
;Total Wind Calculation
tot10 = V10_o ; Transfering meta data
tot10 = sqrt(U10_o^2+V10_o^2)
delete(V10_o)
delete(U10_o)
;;2D Arrays of Lat and Lon
lat2d = f1->lat
lon2d = f1->lon
y1 = dim_avg_Wrap( tot10(yc|:,xc|:,time|:))
printVarSummary(y1)
delete(tot10)
;;2D Arrays of Lat and Lon
lat2d = f1->lat
lon2d = f1->lon
print(" min="+min(lat2d)+" max="+max(lat2d))
print(" min="+min(lon2d)+" max="+max(lon2d))
dimlc = dimsizes(lat2d)
nlat = dimlc(0)
mlon = dimlc(1)
; NLAT = 180
; MLON = 360
NLAT = 046
MLON = 090
dlat = 0.5 ; output lat, in this case dlat=2
lat = ispan ( 0,NLAT-1,1 )*dlat ; 0-90N, by dlat=0.5, so 0, 0.5N 1N, 1.5N. 90N
lat!0 = "lat"
lat@units = "degrees_north"
lat&lat = lat
dlon = 0.5 ; output lon, in this case dlon=2
lon = ispan ( 0,MLON-1,1 )*dlon + 180. ; -180W-180E by dlon=2, so -180, -178W... 180E
lon!0 = "lon"
lon@units = "degrees_east"
lon&lon = lon
; ydiff = y2
; ydiff = y2 - y1
X2D = triple2grid(ndtooned(lon2d),ndtooned(lat2d),ndtooned(y1(:,:)), lon,lat, False)
; X2D = triple2grid2d(ndtooned(lon2d),ndtooned(lat2d),ndtooned(y1(:,:)), lon,lat, False)
X2D!0 = "lat" ; triple2grid regrids based on a nearest neighbor routine.
X2D&lat = lat
X2D!1 = "lon"
X2D&lon = lon
X2D@units = y1@units
printVarSummary(X2D)
print(" min="+min(X2D)+" max="+max(X2D))
print(" min="+min(lat2d)+" max="+max(lat2d))
print(" min="+min(lon2d)+" max="+max(lon2d))
; print (lat)
; print (lon)
;********************************************
; create plots
;********************************************
wks = gsn_open_wks ("pdf", "pt5reswind") ; open workstation
gsn_define_colormap (wks,"gui_default") ; choose color map
sres = True ; plot mods desired for 2x2 array
sres@gsnAddCyclic = False
sres@cnFillOn = True ; color fill
sres@cnLinesOn = False ; no contour lines
sres@cnLineLabelsOn = False ; no contour labels
sres@gsnSpreadColors = True ; use total colormap
sres@gsnSpreadColorStart = 4
sres@gsnSpreadColorEnd = -1
sres@cnInfoLabelOn = False ; no contour info label
sres@mpMinLatF = min(lat2d)+1
sres@mpMaxLatF = max(lat2d)-1
sres@mpMinLonF = min(lon2d)+1
sres@mpMaxLonF = max(lon2d)-1
; sres@mpMinLonF = 220. ; min(lon2d) - 1
; sres@mpMaxLonF = 300. ; max(lon2d) - 1
sres@mpCenterLonF = 270 ; Centers the plot at 180
sres@gsnFrame = False
sres@gsnDraw = False
sres@lbLabelBarOn = False
panres = True ; set up panel resources
panres@gsnPaperOrientation = "portrait"
panres@gsnMaximize = True
panres@gsnPanelLabelBar = True
; panres@gsnPanelYWhiteSpacePercent= 3.0
panres@gsnPanelYWhiteSpacePercent= 0.5
plot = new(1,graphic)
sres@gsnLeftString = "Regridded to 0.5x0.5"
; sres@gsnCenterString = "Gridded Precipitation "
; plot(1) = gsn_csm_contour_map_ce(wks,X2D,sres) ; Draw new 2x2 grid
plot = gsn_csm_contour_map_ce(wks,X2D,sres) ; Draw new 2x2 grid
gsn_panel(wks,plot,(/1,1/),panres)
end
Eric Holt
Department Of Geosciences
Graduate Student
University of Nebraska
119 Bessey Hall
eric.holt@huskers.unl.edu
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:55 MDT