[ncl-talk] Segmentation error at dim_permsort
Sri nandini
bax8609 at uni-hamburg.de
Thu Jun 4 05:49:34 MDT 2020
Hello ncl users,
I have a segementation error when executing dim_pqsort which i use for
plotting the percentiles in my PDF.
The last print i get is "started percentiles" and then segmentation
error on the line starting with anom1_permsort. I am using ncl version
6.5.0.
Below is my script: would appreciate any help in this?
Sri
begin
f = addfile ("anom_hist_zo_slr.nc", "r")
hist_anom = f->hist_anom
printVarSummary(hist_anom)
dimx = dimsizes(hist_anom)
ntim = dimx(0) ; 240
nens = dimx(1) ; 100
nlat = dimx(2) ; 45
mlon = dimx(3) ; 90
hist_anom at _FillValue = -9.96921e+36
hist_anom1= dtrend_n(hist_anom,False,0)
printVarSummary(hist_anom1)
delete(hist_anom)
f1 = addfile ("anom_rcp45_zo_slr.nc", "r")
rcp45_anom = f1->rcp45_anom
printVarSummary(rcp45_anom)
rcp45_anom1= dtrend_n(rcp45_anom, False,0)
printVarSummary(rcp45_anom1)
delete(rcp45_anom)
f2 = addfile ("anom_rcp85_zo_slr.nc", "r")
rcp85_anom = f2->rcp85_anom
printVarSummary(rcp85_anom)
rcp85_anom1= dtrend_n(rcp85_anom, False,0)
printVarSummary(rcp85_anom1)
delete(rcp85_anom)
;=================================================================
anom1_1d = ndtooned(hist_anom1) ;to carry out the
dim_stat4_n on one dimension.
anom2_1d = ndtooned(rcp45_anom1)
printVarSummary(anom2_1d)
anom3_1d = ndtooned(rcp85_anom1)
printVarSummary(anom3_1d)
TTstat1 = dim_stat4(anom1_1d)
printVarSummary(TTstat1) ; (4,?)
TTstat2 = dim_stat4(anom2_1d)
printVarSummary(TTstat2) ; (4,?)
print("success")
TTstat3 = dim_stat4(anom3_1d)
printVarSummary(TTstat3) ; (4,?)
print("success")
xLow = min(anom1_1d)
xHi = max(anom1_1d)
print("success")
xLow1 = min(anom2_1d)
xHi1 = max(anom2_1d)
print("success")
xLow2 = min(anom3_1d)
xHi2 = max(anom3_1d)
;==================================================================
; percentiles (requires sorting the array)
anom1_nomiss=anom1_1d(ind(anom1_1d.ne.-9999))
print("started percentiles")
anom1_permsort = dim_pqsort(anom1_nomiss,2) ;; sorted array is
anom1_nomiss!!
delete(anom1_permsort)
anom1_p05=anom1_nomiss(floattoint(0.05*dimsizes(anom1_nomiss)))
;(rank_p5)
anom1_p95=anom1_nomiss(floattoint(0.95*dimsizes(anom1_nomiss)))
printVarSummary(anom1_p05)
anom2_nomiss=anom2_1d(ind(anom2_1d.ne.-9999))
anom2_permsort = dim_pqsort(anom2_nomiss,2)
delete(anom2_permsort)
anom2_p05=anom2_nomiss(floattoint(0.05*dimsizes(anom2_nomiss)))
;(rank_p5)
anom2_p95=anom2_nomiss(floattoint(0.95*dimsizes(anom2_nomiss)))
print("started percentiles")
delete(anom2_nomiss)
anom3_nomiss=anom3_1d(ind(anom3_1d.ne.-9999))
anom3_permsort = dim_pqsort(anom3_nomiss,2)
delete(anom3_permsort)
anom3_p05=anom3_nomiss(floattoint(0.05*dimsizes(anom3_nomiss)))
;(rank_p5)
anom3_p95=anom3_nomiss(floattoint(0.95*dimsizes(anom3_nomiss)))
print("started percentiles")
;================================================================================
; calculate empirical PDF
;================================================================================
opt = True
opt at bin_min = -50.
opt at bin_max = 50.
pdf1 = pdfx(hist_anom1, 100, opt)
printVarSummary(pdf1)
pdf2 = pdfx(rcp45_anom1, 100, opt)
printVarSummary(pdf2)
pdf3 = pdfx(rcp85_anom1, 100, opt)
More information about the ncl-talk
mailing list