[ncl-talk] NaN value using the wrf_cape_2d function

Bill Ladwig ladwig at ucar.edu
Thu Apr 7 11:23:39 MDT 2016


Your units look correct in the script.  Pressure should be in Pa and
surface pressure should be in hPa.  The C wrapper converts the pressure to
hPa before calling the fortran routine, which expects hPa.

Do you have missing data values in your data set?  Since those files aren't
WRF model output files, I'm guessing your data has missing values (probably
for temperature).  If that's the case, the routine is going to use the
missing/fill values in the cape routines and crash.  You'll need to remove
or replace these values with something the algorithm can use (via
interpolation, std atmosphere, etc).

For the variable inputs to the cape routines, you can do a printVarSummary
on them to see if they contain missing values.

Bill

On Wed, Apr 6, 2016 at 5:56 AM, Guilherme Martins <jgmsantos at gmail.com>
wrote:

> Dear Guido,
>
> I used in Pa and the result is undef. I sent a e-mail to wrfhelp at ucar.edu.
>
> Thanks,
>
> Guilherme.
>
> Em qua, 6 de abr de 2016 às 07:21, Guido Cioni <guidocioni at gmail.com>
> escreveu:
>
>> Guilherme, you should pose this question on the ncl-talk dedicated to WRF
>> (wrfhelp at ucar.edu).
>>
>> It seems that the problem is related to THTE but, judging from the code,
>> it appears that this variable is computed based on pressure, so that if you
>> pass the wrong units you will eventually get a NaN. I think that you are
>> using hPa instead of Pa judging from the output message that you get (
>> *1016.5871875000000*). Try to use the correct units and see if you still
>> get an error. If it’s still the case please try to
>>
>>
>>    - pass to the function only a subset of the data in order to see if
>>    the vertical levels are too much for the routine to handle. In my case I
>>    omitted the first 30 upper vertical levels doing that:
>>    values=wrf_cape_2d(pres(:,31:149,:,:),temp(:,31:149,:,:),qvap(:,31:149,:,:),z(:,31:149,:,:),z(:,149,:,:),pres(:,149,:,:),False).
>>    I was getting a different error but maybe it’s worth trying also in your
>>    case..
>>    - do you have missing values in the data used for the computation of
>>    CAPE? Please mind that there is no control on missing data in that
>>    function, so that you need to remove them before.
>>
>> Cheers
>>
>> P.S. Just for reference, you can found the code of the deprecated
>> function, which I believe it is included in the new one, here
>> https://www.ncl.ucar.edu/Support/talk_archives/2010/att-0235/rip_cape.f
>>
>> Guido Cioni
>> http://guidocioni.altervista.org
>>
>> On 05 Apr 2016, at 21:35, Guilherme Martins <jgmsantos at gmail.com> wrote:
>>
>> Hi users,
>>
>> I'm using the wrf_cape_2d function to calculate CAPE. I wrote a script
>> and when I run it I receive the mesage below.
>>
>> *capecalc3d: Outside of lookup table bounds. prs,thte=
>> 1016.5871875000000                            NaN*
>>
>> I compared my units and variables with the link below and everything it's
>> okay.
>>
>>
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_cape_2d.shtml#Description
>>
>> Can anyone give me any tip?
>>
>> My script is in attachment.
>>
>> Thanks,
>>
>> Guiherme.
>> --
>>
>> ------------------------------------------------------------------------------------------
>> Dr. Guilherme Martins
>> Instituto Nacional de Pesquisas Espaciais (INPE)
>> Centro de Ciência do Sistema Terrestre (CCST) - Prédio CES
>> Grupo de Superfície-Biosfera-Atmosfera (GSBA)
>> Telefone (INPE/CP): +55 12 3186-9520 || Celular (TIM): +55 12 98152-8580
>> E-mail: guilherme.martins at inpe.br || jgmsantos at gmail.com
>> Skype: guilherme.martins.
>> Homepage: https://sites.google.com/site/jgmsantos
>> Currículo Lattes: http://lattes.cnpq.br/5997657584785803
>>
>> ------------------------------------------------------------------------------------------
>>
>> <ex01_wrf_cape_2d.ncl>_______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>
> ------------------------------------------------------------------------------------------
> Dr. Guilherme Martins
> Instituto Nacional de Pesquisas Espaciais (INPE)
> Centro de Ciência do Sistema Terrestre (CCST) - Prédio CES
> Grupo de Superfície-Biosfera-Atmosfera (GSBA)
> Telefone (INPE/CP): +55 12 3186-9520 || Celular (TIM): +55 12 98152-8580
> E-mail: guilherme.martins at inpe.br || jgmsantos at gmail.com
> Skype: guilherme.martins.
> Homepage: https://sites.google.com/site/jgmsantos
> Currículo Lattes: http://lattes.cnpq.br/5997657584785803
>
> ------------------------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160407/1dcc632a/attachment.html 


More information about the ncl-talk mailing list