[ncl-talk] SPI calculation

Soma Roy somaroy892 at gmail.com
Wed Nov 28 21:21:24 MST 2018


Thank you very much.

Soma

On Thu, Nov 29, 2018, 02:28 Mary Haley <haley at ucar.edu wrote:

> Soma,
>
> The spi_2.ncl script shows you how to calculate the yyyymm variable:
>
>   year    = yyyymm/100
>   yrStrt  = year(0)
>   yrLast  = year(ntim-1)
>   nyear   = yrLast-yrStrt+1
>   yyyymm  = yyyymm_time(yrStrt, yrLast, "integer")
>
> You don't need the "date" or "yyyymm" arrays, because you already have the
> year information. Use ispan to generate the "year" array and now you can
> get your yyyymm and yrfac values as needed:
>
>   year    = ispan(1970,2010,1)
>   ntim    = dimsizes(year)
>   yrStrt  = year(0)
>   yrLast  = year(ntim-1)
>   nyear   = yrLast-yrStrt+1
>   yyyymm  = yyyymm_time(yrStrt, yrLast, "integer")
>   yrfrac  = (/ yyyymm_to_yyyyfrac(yyyymm, 0.0) /)
>
> --Mary
>
>
>
>
>
>
>
>
> On Wed, Nov 28, 2018 at 1:05 PM Soma Roy <somaroy892 at gmail.com> wrote:
>
>> Thank you very much for the hint.
>> I will check it.
>>
>> But mannualy we can't set the "date" range in the script without using
>> CDO?
>>
>> Please kindly inform me.
>>
>> Thanking you,
>> Soma
>>
>>
>> On Thu, Nov 29, 2018, 01:28 Guilherme Martins <jgmsantos at gmail.com wrote:
>>
>>> I don't know if you use climate data operators or cdo software.
>>>
>>> You can set the data in your file.
>>>
>>> Exemple
>>>
>>> cdo settaxis,1970-01-01,00:00:00,1mon input.nc output.nc
>>>
>>> Guilherme.
>>>
>>>
>>> Em qua, 28 de nov de 2018 16:35, Soma Roy <somaroy892 at gmail.com
>>> escreveu:
>>>
>>>> Hello,
>>>>
>>>> I am trying to calculate standadize precipitation index using monthly
>>>> gridded dataset.
>>>>
>>>> Dimension of data is like below;
>>>> Rainfall(12x41) (months x years).
>>>>
>>>> I am using the script from the below link;
>>>> https://www.ncl.ucar.edu/Applications/Scripts/spi_2.ncl
>>>>
>>>> But in my dataset there is no variable as "date".
>>>>
>>>> Can we manually set the date range inside the script?
>>>>
>>>> I am using rainfall dataset for 1970-2010.
>>>>
>>>> Please kindly inform me how we can modify it over the same script.
>>>>
>>>> Thanking you,
>>>> Soma
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>> _______________________________________________
>> 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/20181129/daf4995f/attachment.html>


More information about the ncl-talk mailing list