[ncl-talk] NaN value using the wrf_cape_2d function

Guido Cioni guidocioni at gmail.com
Wed Apr 6 04:21:16 MDT 2016


Guilherme, you should pose this question on the ncl-talk dedicated to WRF (wrfhelp at ucar.edu <mailto: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 <https://www.ncl.ucar.edu/Support/talk_archives/2010/att-0235/rip_cape.f> 

Guido Cioni
http://guidocioni.altervista.org <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 <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 <mailto:guilherme.martins at inpe.br> || jgmsantos at gmail.com <mailto:jgmsantos at gmail.com>
> Skype: guilherme.martins.
> Homepage: https://sites.google.com/site/jgmsantos <https://sites.google.com/site/jgmsantos>
> Currículo Lattes: http://lattes.cnpq.br/5997657584785803 <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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160406/ab5eeb07/attachment.html 


More information about the ncl-talk mailing list