Hello,
I am running my ncl script and getting a segmentation fault and don't know why. It will run until it says "print("Test")" and makes the segmentation fault right at the time of the "plot" function. I used to run this script before with no problems until. Can someone help me with this? It would be most appreciated.
Thank you!
Cecille
;This program will produce vertical profiles of total
;hydrometeor species at a given time. This plot can be used
;to see relationships such as the melting of graupel / freezing
;of rain couplet near the freezing level.
;
;All previous comments consolidated with general script cleanup.
;*****************************************************
;Standard loading scripts for functions and plotting?
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 "./contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
external AVERAGE "./average_PURDUE.so"
begin
;;EDITABLE CODE BEGINS HERE
type = "Graupel/Hail mixing ratio (g/kg)"
pdftype = "qg_50-130"
grid = "2km"
; timelabl = (/"0000","0005","0010","0015","0020","0025","0030","0035","0040","0045",\
; "0050","0055","0100","0105","0110","0115","0120","0125","0130"/)
; timelabl = (/"0000","0005","0010","0015","0020","0025","0030","0035","0040","0045"/)
timelabl = (/"0000","0005","0010","0015","0020","0025","0030","0035","0040","0045","0050","0055","0060"/)
;;END EDITABLE CODE
a = addfile("../../Morrison/2km/delt_3/wrfout_d01_0001-01-01_00:00:00_Anderson_SC_2km_delt_3_MOR_past.nc", "r")
b = addfile("../../Morrison/2km/delt_3/wrfout_d01_0001-01-01_00:00:00_Anderson_SC_2km_delt_3_MOR_fut.nc", "r")
mor = a->QGRAUP(:,0:50,:,:)
ph = a->PH(:,0:50,:,:)/9.81 ;eliminate geopotential
phb = a->PHB(:,0:50,:,:)/9.81
height = (ph + phb)/1000
;height = wrf_user_getvar(a,"z",-1)/1000
delete(ph)
delete(phb)
; times = a->Times(:,:)
times = wrf_user_list_times(a)
; print(times)
; delete(a)
; delete(b)
q_past = a->QGRAUP(:,0:50,:,:)
q_fut = b->QGRAUP(:,0:50,:,:)
delete(a)
delete(b)
;I will need the number of vertical/horiz levels for the height labels later
num_times = dimsizes(times)
; num_times = 9
num_vert = dimsizes(q_past(0,0:50,1,1))
num_horiza = dimsizes(q_past(0,0,:,0))
num_horizb = dimsizes(q_past(0,0,0,:))
delete(times)
nt = num_times
nz = num_vert
ny = num_horiza
nx = num_horizb
print (num_times)
print (num_vert)
print (num_horiza)
print (num_horizb)
; timid = ispan(0,18,1)
;*****************************************************
;These are all of my array declarations, which will
;be the length of the num_vert variable from above
;*****************************************************
; qavg_vapor = new(num_vert, float)
avg_past = new(num_vert, float)
avg_fut = new(num_vert, float)
qds_vapor = new((/num_times/), float)
qds_cloud = new((/num_times/), float)
qds_rain = new((/num_times/), float)
qds_ice = new((/num_times/), float)
qds_snow = new((/num_times/), float)
qds_graup = new((/num_times/), float)
mavg_past = new((/num_times,num_vert/), float)
mavg_fut = new((/num_times,num_vert/), float)
suma = new((/num_times,num_vert/), float)
sumb = new((/num_times,num_vert/), float)
suma = 0.
sumb = 0.
pt = new((/num_times,num_vert/), float)
ft = new((/num_times,num_vert/), float)
pt = 0.
ft = 0.
; allq = new((/6, num_vert/), float)
allq = new((/2, num_vert/), float)
;*****************************************************
;This code will obtain the maximum values of some
;hydrometeor anywhere in the 3D domain for a fixed time.
;This may need to be updated to correct for domains
;that don't include the cells which develop on the
;outflow of my supercell. NOTE: units now in g/kg
;*****************************************************
AVERAGE::average(suma,sumb,q_past,q_fut,pt,ft,mavg_past,mavg_fut,nx,ny,nz,nt)
print (suma*1000)
print (pt)
mavg_past=mavg_past>0
mavg_fut=mavg_fut>0
print (mavg_past)
;The following makes an array with the model height (in km)
;to be used for the plot labels, in actuallity, we need to make a
;code that plots intergers vs. qmass
tmp1 = floattoint((num_vert/5)+1)
height_array = new(tmp1, float)
height_array(0) = avg(height(:,0,:,:)) ;because (j*5)-1 for 0 gives a negative index
do j=1,tmp1-1
tmp2 = (j*5)-1
height_array(j) = floattoint(avg(height(:,tmp2,:,:)))
end do
;Now generate the intergers for plotting
; heightplot = new(num_vert, float)
; heightplot(0) = 0
; do j=1,num_vert-1
; heightplot(j) = heightplot(j-1)+1
; end do
heightplot = ispan(0,num_vert-1,1)
delete(tmp2)
delete(tmp1)
;print("Heightplot = "+heightplot)
;Open the workstation
wks = gsn_open_wks ("pdf", pdftype+"_scheme_avg_height"+grid)
do i = 0,num_times -1
;fub = i
;do k=0,num_vert-1
; avg_vapor(k) = (sum(qvapor(fub,k,:,:))) * 1000
avg_past = mavg_past(i,:)* 1000
avg_fut = mavg_fut(i,:)* 1000
print(avg_past)
; delete(mavg_wsm6)
; delete(mavg_tho)
; delete(mavg_mil)
; delete(mavg_mor)
;print (avg_mor)
allq(0,:) = avg_past
allq(1,:) = avg_fut
;end do
; qds_vapor(i) = sum(avg_vapor)
;qds_cloud(i) = sum(avg_cloud)
;qds_rain(i) = sum(avg_rain)
;qds_ice(i) = sum(avg_ice)
;qds_snow(i) = sum(avg_snow)
;qds_graup(i) = sum(avg_graup)
;*****************************************************
;Time to make some plots, yo
;*****************************************************
;Open the workstation
; wks = gsn_open_wks ("pdf", "Qdiftot_vALT"\
; +di2_labl+"")
; allq(0,:) = qavg_vapor(i)
; leg_label = (/"QVapor","QCloud","QRain","QIce","QSnow","QGraupel"/)
leg_label = (/"past","fut"/)
res = True
res@tiMainString = timelabl(i)
res@tiXAxisString = type
res@tiYAxisString = "Height (km)"
res@tiXAxisFontHeightF = 0.025 ;resize axis labels
res@tiYAxisFontHeightF = 0.025
res@tiXAxisFont = "times-roman" ;change font type for axis labels
res@tiYAxisFont = "times-roman"
res@pmLegendDisplayMode = "Always"
res@pmLegendZone = 0
res@pmLegendSide = "Top"
res@pmLegendWidthF = 0.16
res@pmLegendHeightF = 0.15
res@lgLabelFontHeightF = .47
res@lgLabelFont = "times-roman" ;change font type for legend label
res@xyExplicitLegendLabels = leg_label
res@pmLegendParallelPosF = 0.32
res@pmLegendOrthogonalPosF = 0.32
res@tmYLMode = "Explicit"
res@tmYLMinorOn = True
res@trYMaxF = num_vert-1
res@tmYLTickSpacingF = 5
res@tmYLMinorPerMajor = 4
res@tmXBLabelFontHeightF = 0.023 ;resize tick labels
res@tmYLLabelFontHeightF = 0.023
res@tmXBLabelFont = "times-roman" ;change font type for tick labels
res@tmYLLabelFont = "times-roman"
res@tmYLValues = ispan(0,num_vert-1,5)
res@tmYLMinorValues = ispan(0,num_vert-1,1)
res@tmYLLabels = height_array
res@tmYLPrecision = 1
; res@xyMarkLineMode = "MarkLines"
; res@xyMarkers = (/9,4/)
res@xyLineThicknessF = 3.0
; res@xyLineThicknesses = (/2.0,3.0,2.0,3.0/)
;res@xyLineColors = (/"black","green","blue","brown","orange","purple"/)
res@xyLineColors = (/"blue","red"/)
res@xyDashPatterns = (/0,2/)
;res@TimeLabel = times(i)
print("Test")
plot = gsn_xy(wks,allq,heightplot,res)
print("Heightarray = "+height_array)
end do
; grandtotnovap = qds_cloud+qds_rain+qds_ice+qds_snow+qds_graup
; print (avg_mor)
; print(qds_vapor)
; print(qds_cloud)
; print(qds_rain)
; print(qds_ice)
; print(qds_snow)
; print(qds_graup)
; print(grandtotnovap)
end
> ********************************************************
> Cecille M. Villanueva Birriel
> Ph.D. Candidate
> Cloud Microphysics Research Group
> Purdue University
> Department of Earth, Atmospheric, & Planetary Sciences
> 550 Stadium Mall Drive, West Lafayette, IN 47907-2051
> email: cvillanu@purdue.edu
> ********************************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 9 16:09:59 2012
This archive was generated by hypermail 2.1.8 : Tue Nov 13 2012 - 14:27:24 MST