[ncl-talk] SPI calculation

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


I fixed the issue. Please ignore my last mail.

Soma

On Thu, Nov 29, 2018, 11:07 Soma Roy <somaroy892 at gmail.com wrote:

> Hello Mary,
>
> I am using the attached script. Modified it as per your hints. But getting
> some errors at run time.
>
> printVarSummary of the data is as follows;
> Variable: prc
> Type: double
> Total Size: 73560960 bytes
>             9195120 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 528] x [lat | 129] x [lon | 135]
> Coordinates:
>             time: [ 360..1068]
>             lat: [ 6.5..38.5]
>             lon: [66.5.. 100]
> Number Of Attributes: 3
>   _FillValue :  -999
>   long_name :   GRIDDED RAINFALL
>   missing_value :       -999
>  : min=0   max=222.9121398925781
>
> I am getting the following errors;
> fatal:Dimension sizes of left hand side and right hand side of assignment
> do not match
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 47 in
> file spi_2.ncl
>
> fatal:NclOneDValGetClosestIndex: Non-monotonic coordinate value being
> used, can't complete coordinate subscript
> fatal:Could not obtain coordinate indexes, unable to perform subscript
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 82 in
> file spi_2.ncl
>
> Please kindly inform me how to correct it.
>
> Thanking you,
> Soma
>
>
> On Thu, Nov 29, 2018 at 9:51 AM Soma Roy <somaroy892 at gmail.com> wrote:
>
>> 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/8e33efde/attachment.html>


More information about the ncl-talk mailing list