[ncl-talk] Query about probability density functions

Giorgio Graffino g.graffino at tim.it
Wed Sep 11 09:35:38 MDT 2024


Thanks Dave,
 
The Fortran code looks straightforward. The last bit is for converting 
the pdf into frequency ("if flag is set", according to the 
comment), but the same code is also present in the contributed.ncl code. 
I'm assuming the flag isn't set, otherwise the conversion would be done 
twice. 
 
Unfortunately I'm not getting any closer to solve this problem. Simply 
dividing the NCL pdfs by 100 make them much smaller than Python or IDL 
pdfs. I don't know if anyone ever encountered this issue before.
 
Cheers,
Giorgio
 
------ Messaggio Originale ------
Da: dave.allured at noaa.gov
A: g.graffino at tim.it Cc: ncl-talk at ucar.edu
Inviato: mercoledì, settembre 11º 2024, 04:58 PM
Oggetto: Re: [ncl-talk] Query about probability density functions
 
Giorgio, the fortran routine is at ni/src/lib/nfpfort/xy1pdf77.f in the 
NCL v6.6.2 source code.

 

 
On Wed, Sep 11, 2024 at 8:01 AM Giorgio Graffino via ncl-talk 
<ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu> > wrote:
 
Hi Dennis,
Thank you for pointing out that detail.
I've found the code of the pdfx function in here 
(https://github.com/NCAR/ncl/blob/develop/ni/src/examples/gsun/contributed.ncl 
<https://github.com/NCAR/ncl/blob/develop/ni/src/examples/gsun/contributed.ncl> 
) and the frequency is computed as pdf = 100d0*pdf/nMax. I tried to 
normalize the pdf by multiplying the frequency pdf by the number of data 
and divide by 100, but the results is very different depending on the 
number of data to compute the pdf. Also, the results are different from 
similar computations using Python, especially with large number of data. 
Without knowing what the Fortran routine does (and I can't find it), I 
don't know how to normalize NCL to match Python.
Any suggestions?
Cheers,
Giorgio
 
------ Messaggio Originale ------
Da: shea at ucar.edu <mailto:shea at ucar.edu>
A: g.graffino at tim.it <mailto:g.graffino at tim.it>  Cc: ncl-talk at ucar.edu 
<mailto:ncl-talk at ucar.edu>
Inviato: lunedì, settembre 9º 2024, 08:15 PM
Oggetto: Re: [ncl-talk] Query about probability density functions
 
 From the pdfx 
<https://www.ncl.ucar.edu/Document/Functions/Contributed/pdfx.shtml> 
documentation:  "The PDF units are percent [%]."
 
Divide by 100.
 

 
On Mon, Sep 9, 2024 at 10:26 AM Giorgio Graffino via ncl-talk 
<ncl-talk at mailman.ucar.edu <mailto:ncl-talk at mailman.ucar.edu> > wrote:
 
Hello NCL experts,
I'm using pdfx to compute probability density functions 
(https://www.ncl.ucar.edu/Document/Functions/Contributed/pdfx.shtml 
<https://www.ncl.ucar.edu/Document/Functions/Contributed/pdfx.shtml> ). 
I noticed that the cumulative density functions sum up to 100 in NCL, 
instead of 1 as per definition. Why is that? How can I normalize them 
back to 1?
 
Thanks for your help.
Cheers,
Giorgio

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240911/7f846b64/attachment.htm>


More information about the ncl-talk mailing list