# [ncl-talk] PDF and CDF with Weibull distribution

Dennis Shea shea at ucar.edu
Mon Apr 29 08:01:22 MDT 2019

```NCL is *not* a statistics package and ncl-talk is not an expert on assorted
distributions.
Other tools [*R*, Matlab, Python] may be a better option.
For sure, *R* has multiple functions that may be useful.
-------
*http://www.ncl.ucar.edu/Document/Functions/Built-in/weibull.shtml*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/weibull.shtml>

Example one shows a comparison of NCL's and R's result.
---

TRMM: [time | 733] x [latitude | 120] x [longitude | 100]

>From experience, daily TRMM has **MANY** 0 values.
You *may* want to sett all 0 value to _FillValue

TRMM = *where*(*ismissing*(TRMM),TRMM at _FillValue, TRMM)

; Weibull at each grid point

wTRMM  = *weibull*(TRMM, False, 0)             ; wTRMM(*2*,120,100)
wTRMM at long_name = "Weibull: Grid point: Shape, Scale"
copy_VarCoords(TRMM(0,:,:), wTRMM(0,:,:))

*printVarSummary*(wTRMM)
*printMinMax*(wTRMM,0)
*print*("---")

; Weibull over entire region

WTRMM  = *weibull*(*ndtooned*(TRMM), False, 0)   ; WTRMM(*2*)
WTRMM at long_name = "Weibull: All points: Shape, Scale"
printVarSummary(WTRMM)
print(WTRMM,0)
print("---")

=========================================

opt = True opt at confidence = 0.90

wTRMM  = *weibull*(TRMM, opt, 0 )             ; wTRMM(6,120,100)
wTRMM at long_name = "Weibull: Grid point: Shape, Scale; ShapeLow,
ShapeHigh, ScaleLow, ScaleHigh"
copy_VarCoords(TRMM(0,:,:), wTRMM(0,:,:))
*printVarSummary*(wTRMM)
*printMinMax*(wTRMM,0)
*print*("---")

WTRMM  = *weibull*(*ndtooned*(TRMM), opt, 0)            ; WTRMM(*6*)
WTRMM at long_name = "Weibull: All points: Shape, Scale; ShapeLow,
ShapeHigh, ScaleLow, ScaleHigh"
print(WTRMM,0)
print("---")

==========================================

*You* will have to calculate the CDF and PDF. NCL does not have
functions to do this.

Good Luck

On Sat, Apr 27, 2019 at 9:19 PM Md. Jalal Uddin <dmjalal90 at gmail.com> wrote:

> Hi all,
>
> I want to calculate PDF and CDF with Weibull distribution using shape 5
> and scale 2 parameters. I found one function in NCL that calculate the
> extreme value (
> https://www.ncl.ucar.edu/Document/Functions/Ext_val/extval_weibull.shtml
>  ).
>
> However, I don't want to calculate the extreme value. I would like to
> produce a similar figure in the attached figure (adapted from Prat and
> Nelson 2013a).
>
> Any suggestions would be appreciated.
>
> Variable: TRMM
> Type: float
> Total Size: 35184000 bytes
>             8796000 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 733] x [latitude | 120] x [longitude | 100]
> Coordinates:
>             time: [   0..131112]
>             latitude: [0.125..29.875]
>             longitude: [75.125..99.875]
> Number Of Attributes: 7
>   long_name :   precipitation (mm/hr)
>   _FillValue :  -9999.9
>   missing_value :       -9999.9
>
>
> Best regards,
> Jalal
>
> --
> *Md. Jalal Uddin*
> MSc in Applied Meteorology (English Language)
> Nanjing University of Information, Science and Technology, China
> B.Sc. in Disaster Management (Hons.)
> Patuakhali Science and Technology University, Bangladesh.
> Cell: +8613260859092, +8801792052662
> Web: www.dmjalal90.weebly.com
> Skype: dmjalal90
> _______________________________________________
> 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/20190429/5dc76b7a/attachment.html>
```