Hi Adams,
Thank you for these very clear informations.
I hope that this function will be adapted in the futur for non-WRF data.
Cheers
--- En date de : Mer 15.9.10, Adam Phillips <asphilli@ucar.edu> a écrit :
De: Adam Phillips <asphilli@ucar.edu>
Objet: Re: [ncl-talk] Segmentation fault (CAPE)
À: "louis Vonder" <appopson@yahoo.fr>
Date: Mercredi 15 septembre 2010, 18h05
Hi Louis,
Just so you know I got a reply from wrf-help about using wrf_cape_2d,
after I asked them about the correct pressure units and whether there is
a range of valid pressure values that the function accepts:
"The code do want data in Pa and not hPa.
The code was written for WRF data, so we have not really tested this on
any other dataset, so it may be that the behaviour could be a bit
different on other datasets."
So the input units for the pressure array should be in Pa, and be
forwarned about using this function with non-WRF data in that it hasn't
been tested with non-WRF data. Adam
On 09/09/2010 10:13 AM, Adam Phillips wrote:
> Hi Louis,
> As my friend Dennis Shea likes to say, the first rule of data processing
> is to look at your own data. The first thing I did with your script was
> to identify where the segmentation fault was occurring by putting print
> statements in. The seg fault was occurring at the wrf_cape_3d line. The
> next step was to use printVarSummary to examine each of the input
> arrays. I discovered that your sfc/zsfc arrays were of type short, a
> type which NCL cannot perform calculations on. When I changed this line:
> sfc = f3->hgt(0, :, :)
> to this:
> sfc = short2flt(f3->hgt(0, :, :))
>
> your script worked.
>
> One thing to note: The documentation states that your input pressure
> levels should be in units of Pa, while you were passing in pressures in
> units of mb/hPa. When I converted your pp array to Pa, I received an
> error message:
> capecalc3d: Outside of lookup table bounds. prs,thte= 1000.00000000000
> 4.102741860923868E+031
>
> This seems to me to indicate that the documentation is incorrect, and
> that the input pressure levels should be in units of mb/hPa. I am trying
> to verify that. Adam
>
> On 09/09/2010 02:19 AM, louis Vonder wrote:
>> Dears Adam,
>>
>> You can find attached files that I used.
>>
>> Regards
>>
>> Louis
>>
>> --- En date de : *Mar 7.9.10, Adam Phillips /<asphilli@ucar.edu>/* a
>> écrit :
>>
>>
>> De: Adam Phillips <asphilli@ucar.edu>
>> Objet: Re: [ncl-talk] Segmentation fault (CAPE)
>> À: ncl-talk@ucar.edu
>> Date: Mardi 7 septembre 2010, 23h37
>>
>> Hi Louis,
>> Can you put print statements in to identify which line the seg fault is
>> occurring? That would help the group in diagnosing what the issue
>> is... Adam
>>
>> 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
>>
>> --
>> __________________________________________________
>> Adam Phillips
>> asphilli@ucar.edu </mc/compose?to=asphilli@ucar.edu>
>> National Center for Atmospheric Research tel: (303) 497-1726
>> Climate and Global Dynamics Division fax: (303) 497-1333
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-- __________________________________________________ Adam Phillips asphilli@ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 Climate and Global Dynamics Division fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 16 00:33:18 2010
This archive was generated by hypermail 2.1.8 : Thu Sep 16 2010 - 11:05:24 MDT