Re: Segmentation fault (core dumped)

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sat Jul 09 2011 - 17:49:58 MDT

Vishali,

It's hard to debug your problem without data files. Un

The "-x" option doesn't work well for code inside "if" or "do" loops,
because it echoes the whole block before it executes it, so you really
can't tell where the code is failing.

Since it appears to be failing the first time in the loop, try
commenting the "do" and "end do" lines, and just set nf=0 to see what
happens when you run it with "ncl -x".

--Mary

On Jul 5, 2011, at 4:27 AM, Vishali P. wrote:

> Hi again.
>
> I'm using 4x Daily NCEP/DOE AMIP-II Reanalysis wind data 1998 to
> 2004. I have a script to calculate unweighted seasonal means.
> As i was suggested before, I've tried to select region and levels,
> but the error stills the same.
>
> "Segmentation fault (core dumped)".
>
> Can anyone help me?
>
>
> Thank you in advance
>
> Vishali
>
>
> [1] My script
>
> load "$NCARG_ROOT/lib/ncarg/
> nclscripts/csm/contributed.ncl"
>
> yrStrt = 1998
> yrLast = 2004
> nyrs = yrLast-yrStrt+1
> klev = 2
> nlat = 8
> mlon = 8
> ntim = 12*nyrs ; number of months
>
> wMon = new ( (/ntim,klev,nlat,mlon/), "float", 1e20)
> tMon = new ( ntim, "double", "No_FillValue")
>
>
> diru = "/home/Vishali/Documents/dadosVentos/SpeedTest/"
> filu = systemfunc("cd "+diru+" ; ls wind*red.nc")
> nfilu = dimsizes(filu)
>
> ; calculate monthly means from 6hrly
> nmoStrt = 0
> nmoLast = 11
> do nf=0,nfilu-1
>
> print("nf="+nf+" "+filu(nf))
>
> f = addfile(diru+filu(nf), "r")
> w = f->WSpeed
> wMon(nmoStrt:nmoLast,:,:,:) = calculate_monthly_values(w,
> "avg",0, False)
> nmoStrt = nmoStrt+12
> nmoLast = nmoLast+12
> delete(w) ; may change size next iteration (leap yr)
> end do
> delete(wMon&time)
>
> printVarSummary(wMon) ; wMon(84,17,73,144)
>
> time = yyyymm_time(yrStrt, yrLast, "integer")
> wMon&time = time
>
> wMon!1 = "level" ; minor bug in "calculate_monthly_values"
> wMon&level = f->level
>
> printVarSummary(wMon)
> ; unweighted seasonal means
> wAllSea = wgt_runave_n_Wrap(wMon, 3, 0, 0)
> printVarSummary(wAllSea)
>
> wSea = wAllSea(::3,:,:,:) ; (28,14,73,144)
> printVarSummary(wSea)
>
>
>
> [2] Output with "ncl -x" command
>
>
> Loading file "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> +
> +
> + yrStrt = 1998
> + yrLast = 2004
> + nyrs = yrLast-yrStrt+1
> + klev = 2
> + nlat = 8
> + mlon = 8
> + ntim = 12*nyrs ; number of months
> +
> + wMon = new ( (/ntim,klev,nlat,mlon/), "float", 1e20)
> + tMon = new ( ntim, "double", "No_FillValue")
> +
> +
> + diru = "/home/Vishali/Documents/dadosVentos/SpeedTest/"
> + filu = systemfunc("cd "+diru+" ; ls wind*red.nc")
> + nfilu = dimsizes(filu)
> +
> + ; calculate monthly means from 6hrly
> + nmoStrt = 0
> + nmoLast = 11
> + do nf=0,nfilu-1
> +
> + print("nf="+nf+" "+filu(nf))
> +
> + f = addfile(diru+filu(nf), "r")
> + w = f->WSpeed
> + wMon(nmoStrt:nmoLast,:,:,:) = calculate_monthly_values(w,
> "avg",0, False)
> + nmoStrt = nmoStrt+12
> + nmoLast = nmoLast+12
> + delete(w) ; may change size next iteration (leap yr)
> + end do
> (0) nf=0 wind.1998.red.nc
> Segmentation fault (core dumped)
>
>
>
> [3] Output of 1st data file
>
> Variable: f (file variable)
>
> filename: wind.1998.red
> path: wind.1998.red.nc
> file global attributes:
> CDI : Climate Data Interface version 1.4.3
> Conventions : CF-1.0
> history : Tue Jul 05 10:48:34 2011: cdo sellevel,1000,10 wind.
> 1998.reduzido.nc wind.1998.red.nc
> Wed Jun 29 13:32:04 2011: cdo sellonlatbox,25,45,-28,-10 wind.
> 1998.nc wind.1998.reduzido.nc
> Mon Oct 18 11:24:43 2010: cdo mergetime wind1998a.nc wind1998b.nc
> wind.1998.nc
> CDO : Climate Data Operators version 1.4.3 (http://www.mpimet.mpg.de/cdo
> )
> dimensions:
> lon = 8
> lat = 8
> lev = 2
> time = 1460 // unlimited
> variables:
> float lon ( lon )
> long_name : Longitude
> units : degrees_east
> standard_name : longitude
>
> float lat ( lat )
> long_name : Latitude
> units : degrees_north
> standard_name : latitude
>
> double lev ( lev )
> long_name : pressure
> units : Pa
> axis : z
>
> double time ( time )
> units : hours since 1800-01-01 00:00:00
> calendar : standard
>
> float WSpeed ( time, lev, lat, lon )
> long_name : Wind Speed
> standard_name : eastward_wind
> units : m/s
> _FillValue : -32767
> valid_range : ( -140, 174.989990234375 )
> parent_stat : Other
> statistic : Individual Obs
> level_desc : Pressure Levels
> dataset : NCEP/DOE AMIP-II Reanalysis (Reanalysis-2)
> var_desc : u-wind
> GRIB_name : UGRD
> GRIB_id : 33
> least_significant_digit : 1
> precision : 2
> actual_range : ( -87.30000305175781, 129.5 )
> unpacked_valid_range : ( -140, 175 )
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Jul 9 17:50:07 2011

This archive was generated by hypermail 2.1.8 : Tue Jul 12 2011 - 15:03:53 MDT