[ncl-talk] SPEI (drought index) calculation...

qudsia zafar missquaddus at gmail.com
Thu Apr 17 23:59:08 MDT 2025


Hi Dennis,

As I couldn't find the direct function for spei calculation just like there
is for spi in NCL therefore i was trying to do things manually.

Till now I have used the  'dim_gamfit_n' function output (shape and scale
parameters)  as an input in the *cdfgam_p
<https://www.ncl.ucar.edu/Document/Functions/Built-in/cdfgam_p.shtml>
*function.
Now the probabilities (gridded data) acquired have to be transformed into
the 'standard normal distribution' resulting in the spei values with a mean
of 0 and standard deviation of 1.

An spei of 0 indicates near normal conditions, positive values indicate
wetter than average conditions and negative values are drier than average
conditions.

I was wondering if there is a function that transforms from cdfgam_p to the
standard normal distribution. As you have asked 'gmm_transform' is supposed
to acquire the necessary transformation to  'standard normal distribution'.
If you could have a look.

Thx.

qudsia



   -



On Fri, 18 Apr 2025 at 06:41, Dennis Shea <shea at ucar.edu> wrote:

> NCL's *cdfgam_p
> <https://www.ncl.ucar.edu/Document/Functions/Built-in/cdfgam_p.shtml> *documentation
> mentions 'gamma' functions from R, Matlab and Excel.
>
> What is your 'gmm_transform' supposed to return?
>
>
>
>
>
>
>
>
>
> On Thu, Apr 17, 2025 at 2:32 AM qudsia zafar via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Hi i am using cru datasets (ts 4.08) for precipitation and potential
>> evapotranspiration. I have done (precip_minus_pet = prc - pet) and then
>> I have used the function 'dim_gamfit_n' to estimate shape and scale
>> parameters for the gamma distribution fitting.
>>
>> However in the next step of spei calculation I need to do the following:
>>
>> spei = gmm_transform(precip_minus_pet, shape, scale)
>>
>> I have now all the three data (precip_minus_pet, shape, scale) but i
>> don't know if NCL has a gamma transformation function available? I have
>> seen 'cdfgam_p' but I don't know if this corresponds to the gamma
>> transform?. Kindly advise which function can be used in the final step of
>> spei calculation. Many Thx..
>>
>> qudsia
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20250418/6639d68e/attachment.htm>


More information about the ncl-talk mailing list