[ncl-talk] nan value for cape function

Mary Haley haley at ucar.edu
Tue Jan 22 09:00:43 MST 2019


Please CC ncl-talk at ucar.edu when following up with a question that was
originally posted on ncl-talk, unless we ask you to take it offline.

Thanks for the code, but I still can't debug this without having access to
the data.

This code was written to be used with WRF data, which I can't tell from
your script if this is what you have.

When we ask for a "clean script", what we mean is a very minimal code that
we can run to see if we can reproduce the error.

In this case, the best thing to do is to write all the variables that are
being passed to wrf_cape_3d to a NetCDF file, and then the clean script
would only need to read these variables back in and call wrf_cape_3d.

So, in your script, add the following code before you call wrf_cape_3d:

system("rm wrfcapebug.nc")
fout = addfile("wrfcapebug.nc","c")
fout->level_ECMWF_3D = level_ECMWF_3D
fout->TK_decode      = TK_decode
fout->rv_levels      = rv_levels
fout->GPH_decode     = GPH_decode
fout->z2D_decode     = z2D_decode
fout->sp_decode      = sp_decode

When you run the script, a NetCDF file called "wrfcapebug.nc" will get
created that has the variables needed by wrf_cape_3d.

You can then send me the wrfcapebug.nc file (it's okay to send it just to
me and not to ncl-talk at ucar.edu).

The clean script would look like this:

f = addfile("wrfcapebug.nc","r")
level_ECMWF_3D = f->level_ECMWF_3D
TK_decode      = f->TK_decode
rv_levels      = f->rv_levels
GPH_decode     = f->GPH_decode
z2D_decode     = f->z2D_decode
sp_decode      = f->sp_decode
cape = wrf_cape_3d
(100*level_ECMWF_3D,TK_decode,rv_levels,GPH_decode/9.5,abs(z2D_decode/9.8),sp_decode,False)

Thanks,

--Mary


On Sun, Jan 20, 2019 at 11:23 PM nafiseh pegahfar <pegahfar at inio.ac.ir>
wrote:

> Sorry  taking up your time.
> I can't join github.
> Hence, I attached my code and the figure.
> the problem is that "cape_1000minus925" is ranged between
> "min=77.92554515113014" and " max=3696.247648956266", while the figure
> shows NaN values. for example cape_1000minus925 at lat=20 and lon=60 is NaN.
> It would be highly appreciated if you help me in this issue.
>
> Variable: cape_1000minus925
> Type: double
> Total Size: 52488 bytes
>             6561 values
> Number of Dimensions: 2
> Dimensions and sizes:    [latitude | 81] x [longitude | 81]
> Coordinates:
>             latitude: [15.5..25.5]
>             longitude: [58.5..68.5]
> Number Of Attributes: 1
>   _FillValue :    9.969209968386869e+36
> (0)    min=77.92554515113014   max=3696.247648956266
> (0)    lat20_lon60_cape_diff=9.969209968386869e+36
>
>
>
>
>
> Best Regards
> =================================
> Nafiseh Pegahfar
> Assistant Professor
> Iranian National Institute for Oceanography and Atmospheric Science
> (http://www.inio.ac.ir)
> Phone: (0098)21- 66944873-5 Ext. 224
> Fax: (0098)21- 66944869
> Email: (pegahfar at inio.ac.ir)
> (pegahfar at ut.ac.ir)
> =================================
>
> -----Original Message-----
> From: Mary Haley <haley at ucar.edu>
> To: nafiseh pegahfar <pegahfar at inio.ac.ir>
> Cc: Ncl-talk <ncl-talk at ucar.edu>
> Date: Mon, 14 Jan 2019 09:04:19 -0700
> Subject: Re: [ncl-talk] nan value for cape function
>
>
> We cannot debug this problem with the information you've given us, because
> I don't know exactly how you are calling the routine.
>
> Please use our GitHub issues page to submit a bug report and provide a
> small, clean program that illustrates the error:
>
> https://github.com/NCAR/ncl/issues
>
> Thanks,
>
> --Mary
>
>
> On Thu, Jan 10, 2019 at 9:42 PM nafiseh pegahfar <pegahfar at inio.ac.ir>
> wrote:
>
>> Hello,
>> Thank you for your kindly attention.
>> I checked and all units were correct as:
>>
>> level=925,00
>> TK=300.6299140816899
>> rv=0.008510922866573187
>> GPH=723.139880629395
>> z=0.7325572010323265
>> p=100078.4522848937
>>
>> while the NaN values still exist. The NaN values are occurred at places
>> with rv<0.01.
>>
>> Best Regards
>> =================================
>> Nafiseh Pegahfar
>> Assistant Professor
>> Iranian National Institute for Oceanography and Atmospheric Science
>> ( http://www.inio.ac.ir)
>> Phone: (0098)21- 66944873-5 Ext. 224
>> Fax: (0098)21- 66944869
>> Email: ( pegahfar at inio.ac.ir)
>> ( pegahfar at ut.ac.ir)
>> =================================
>>
>> -----Original Message-----
>> From: Mary Haley < haley at ucar.edu>
>> To: nafiseh pegahfar <pegahfar at inio.ac.ir>
>> Cc: " ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
>> Date: Thu, 10 Jan 2019 09:36:22 -0700
>> Subject: Re: [ncl-talk] nan value for cape function
>>
>> Hello,
>>
>> I think you need to check your input units again.  You didn't indicate
>> exactly how you are calling wrf_cape_3d, but if you read the documentation
>> at:
>>
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_cape_3d.shtml
>>
>> you will see that that the model pressure values need to be in units of
>> Pa, while the units of  surface pressure must be hPa. I'm not sure why the
>> function was written this way, but you need to make sure you have the
>> correct units.
>>
>> If you continue to have problems, please respond back to ncl-talk with
>> this information. It would help if you could provide a short test program
>> that shows the values you are inputting and the incorrect values that are
>> coming from the function. Also, we need to know what version of NCL you're
>> running.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>> On Tue, Jan 8, 2019 at 9:23 PM nafiseh pegahfar <pegahfar at inio.ac.ir >
>> wrote:
>>
>>> To whom it may concern,
>>>
>>> I used "wrf_cape_3d" function to calculate Cape. for this aim I
>>> used 3D vand
>>> 2D values. unfortunately in some points (based on lat/lon)  NaN value for
>>> cape is seen. I am sure that all data have correct units. Input values for a
>>>
>>>
>>>
>>>
>>> point is reported as below:
>>>
>>> cape=9.969209968386869e+36
>>>
>>> level=92500
>>> TK=300.6299140816899
>>> rv=0.008510922866573187
>>> GPH=723.139880629395
>>> z=0.7325572010323265
>>> p=100078.4522848937
>>> I think where rv value is less that 0.01, this nan value appears.
>>> please help me to overcome to these nan values
>>>
>>>
>>> Best Regards
>>> =================================
>>> Nafiseh Pegahfar
>>> Assistant Professor
>>> Iranian National Institute for Oceanography and Atmospheric Science
>>> ( http://www.inio.ac.ir)
>>> Phone: (0098)21- 66944873-5 Ext. 224
>>> Fax: (0098)21- 66944869
>>> Email: ( pegahfar at inio.ac.ir)
>>> ( pegahfar at ut.ac.ir)
>>> =================================
>>> _______________________________________________
>>> 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/20190122/7319ac26/attachment.html>


More information about the ncl-talk mailing list