Re: Segmentation fault (CAPE)

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 10 2010 - 16:30:29 MDT

Louis

We always recommend that people use printVarSummary
to see a variable's dimension sizes, shape and type.

   f3 = addfile("hgt.sfc.nc", "r")

   sfc = f3->hgt(0, :, :) ; <============
   printVarSummary(sfc) ; type SHORT

You need

   sfc = short2flt(f3->hgt(0, :, :))
   printVarSummary(sfc) ; type float

Good luck

>
>
> On 09/06/2010 05:05 AM, louis Vonder wrote:
> > Dear Ncl users,
> >
> > I don't know what is wrong the following script.
> > I am trying to calculate CAPE using NCEP/NCAR realnalys data.
> >
> > But I am getting this error message
> >
> > "Segmentation fault "
> >
> > Many thanks
> >
> > 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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> >
> > begin
> >
> > f1 = addfile("M00_JJA_air.1999.nc", "r")
> > f2 = addfile("M00_JJA_hgt.1999.nc", "r")
> > f3 = addfile("hgt.sfc.nc", "r")
> > f4 = addfile("M00_JJA_pres.sfc.1999.nc", "r")
> > f5 = addfile("M00_JJA_shum.1999.nc", "r")
> >
> > lon = f1->lon
> > lat = f1->lat
> > time = f1->time
> > plvl = f1->level
> >
> >
> > tk = f1->air
> > z = f2->hgt
> > pp = conform(tk, plvl, 1) ; make p same shape/rank/size as T
> > shum = f5->shum
> >
> > sfc = f3->hgt(0, :, :) ; A scalar or array containing surface
> height [m]
> > psfc = 100*(f4->pres) ; A scalar or array containing surface
> pressures (hPa)
> > zsfc = conform(psfc, sfc, (/1, 2/)) ; make sfc same
> shape/rank/size as zsfc
> >
> >
> > cinfo = wrf_cape_2d(pp, tk, shum, z, zsfc, psfc, False)
> >
> >
> > cape = cinfo(0,:,:,:)
> > ; cin = cinfo(1,:,:,:)
> > ; lcl = cinfo(2,:,:,:)
> > ; lfc = cinfo(3,:,:,:)
> >
> > cape@long_name= " convective available potential energy"
> > ; cin@long_name= " convective inhibition"
> > ; lcl@long_name= "lifted condensation level"
> > ; lfc@long_name="level of free convection"
> >
> >
> >
> > delete(z)
> > delete(pp)
> > delete(shum)
> >
> >
> >
> > ; output the regressed fields to a file
> >
> > system("rm -f cape_ncep_M00_JJA.1999.nc")
> > outfile = addfile("cape_ncep_M00_JJA.1999.nc", "c")
> >
> > outfile->cape = cape
> > ; outfile->cin = cin
> > ; outfile->lcl = lcl
> > ; outfile->lfc = lfc
> > end
> >
> >
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> --
> ======================================================
> Dennis J. Shea tel: 303-497-1361 |
> P.O. Box 3000 fax: 303-497-1333 |
> Climate Analysis Section |
> Climate & Global Dynamics Div. |
> National Center for Atmospheric Research |
> Boulder, CO 80307 |
> USA email: shea 'at' ucar.edu |
> ======================================================
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 10 15:30:34 2010

This archive was generated by hypermail 2.1.8 : Thu Sep 16 2010 - 11:05:24 MDT