I have a problem with NCL stalling. I have a few scripts that will
hang. They render output correctly most of the time, but every once in
a while they will start to run and then just sit and take up 100% cpu
(without nice). It does not seem to be random, because it will hang on
the same input files every time, but I have no idea what could be in
those input files that does not exist in the others that ncl has no
problem with.
Here is a script that regularly has problems:
Could it be the array arithmetic gives ncl problems sometimes? The
scripts this happens to all use array math in one way or another. In
the script below, I subtract the precip totals of the current sim hour
from the previous one.
Thanks,
JD
;*************************************************
; WRF: near surface winds and total precipitation
;************************************************
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/WRF_contributed.ncl"
begin
;************************************************
; open file
; Read U10 and V10, Cumulus (rinc) and Non-cumulus (rainnc) prc
;************************************************
f = addfile("/home/jd3/garytest/"+resDate+"/"+wrfFile+".nc", "r")
if ( wrfFile2 .eq. "None" ) then
else
f2 =
addfile("/home/jd3/garytest/"+resDate+"/"+wrfFile2+".nc", "r")
precip2 = (f2->RAINC + f2->RAINNC)
end if
precip = (f->RAINC + f->RAINNC) ; Convert mm
to inches
lat2d = f->XLAT(0,:,:)
lon2d = f->XLONG(0,:,:)
precip_at_lat2d = lat2d
precip_at_lon2d = lon2d
;************************************************
; create plots: create colormap using named colors
;************************************************
wks = gsn_open_wks("pdf"
,"../../layer/"+resDate+"/"+domain+"/"+shour+"/PREACCFILLONE")
; ps,pdf,x11,ncgm,eps
gsn_define_colormap(wks,"MSL") ; select color map
times = chartostring(f->Times) ; convert to type string
ntimes = dimsizes(times) ; # time steps
if ( wrfFile2 .eq. "None" ) then
oneprecip = precip
else
oneprecip = precip - precip2
end if
oneprecip_at_lat2d = lat2d
oneprecip_at_lon2d = lon2d
; This is the big loop over all of the time periods to process.
precip@_FillValue = 0.0 ; manually set _FillValue
;************************************************
; create plots
;************************************************
res = True ; plot
mods desired
res_at_gsnBoxMargin = 0.0
res_at_cnNoDataLabelOn = False
res_at_cnConstFLabelOn = False
res_at_tiMainOn = False
res_at_gsnSpreadColors = True ; use
full range of colormap
res_at_cnFillOn = True ; color
plot desired
res_at_cnFillMode = "AreaFill" ;
color plot desired
;res_at_lbLabelOn = True
res_at_cnLinesOn = False ; turn
off contour lines
res_at_cnLineLabelsOn = False ; turn
off contour labels
;res_at_cnLevelSelectionMode = "ManualLevels"
res_at_cnLevelSelectionMode = "ExplicitLevels"
res_at_cnLevels =
(/1.0,2.0,3.0,4.0,5.0,10.0,20.0,30.0,40.0,50.0,75.0,100.0,250.0,500.0,1000.0/)
res_at_cnNoDataLabelOn = False
res_at_lbLabelBarOn = False;
res_at_pmLabelBarDisplayMode = "NoCreate"
res_at_vpXF = 0.0
res_at_vpYF = 1.0
res_at_vpWidthF = 1.0
res_at_vpHeightF = 1.0
res_at_wkBackgroundColor = "Black"
res_at_cnMinLevelValF = 0.0
res_at_cnMaxLevelValF = 5.0
res_at_mpGeophysicalLineColor = "red"
res_at_mpUSStateLineColor = "red"
res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"
res_at_mpDataBaseVersion = "Ncarg4_1"
res_at_mpDataSetName = "Earth..2"
if ( domain .eq. "d01" ) then
res_at_mpMaxLatF = 43.14445 ;
zoom in on map
res_at_mpMinLatF = 2.273166
res_at_mpMinLonF = -99.29759
res_at_mpMaxLonF = -15.4003
else
if ( domain .eq. "d02" ) then
minLat = f2->XLAT(0,0,0)
maxLat = f2->XLAT(0,164,164)
minLon = f2->XLONG(0,0,0)
maxLon = f2->XLONG(0,0,164)
res_at_mpMaxLatF = maxLat ;
zoom in on map
res_at_mpMinLatF = minLat
res_at_mpMinLonF = minLon
res_at_mpMaxLonF = maxLon
else
minLat = f2->XLAT(0,0,0)
maxLat = f2->XLAT(0,299,299)
minLon = f2->XLONG(0,0,0)
maxLon = f2->XLONG(0,0,299)
res_at_mpMaxLatF = maxLat
; zoom in on map
res_at_mpMinLatF = minLat
res_at_mpMinLonF = minLon
res_at_mpMaxLonF = maxLon
end if
end if
;************************************************
; if appropriate, set True for native (direct) mapping (faster)
;************************************************
;res_at_tfDoNDCOverlay = True
;************************************************
; NCL contouring does not like _FillValue=0.0
;************************************************
precip@_FillValue = -999 ; change to -999
; turn raster on
plotu = gsn_csm_contour_map(wks,oneprecip(0,:,:),res)
delete(res)
end
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 18 2008 - 07:08:31 MDT
This archive was generated by hypermail 2.2.0 : Mon Aug 25 2008 - 15:23:45 MDT