[ncl-talk] SPI/SPI DROUGHT CLASSIFICATION

Dennis Shea shea at ucar.edu
Tue Apr 16 12:44:47 MDT 2019


???  => "somehow lost at the original dimension of the code
"spi(nrun,time,lat,lon)" that is leading to an error."

What was the error?  You MUST be explicit.
NOTE: If you are learning NCL, please read the User Manual at:
*http://www.ncl.ucar.edu/Document/Manuals/*
<http://www.ncl.ucar.edu/Document/Manuals/>

Attached is a simple code. The print statement are for **YOU** to look at
and understand.
Good luck



On Tue, Apr 16, 2019 at 8:56 AM Oluwaseun Ilori <wilseun at gmail.com> wrote:

> Thanks so much and I've attached my data ncdump -h .nc output here but
> somehow lost at the original dimension of the code "spi(nrun,time,lat,lon)"
> that is leading to an error.
>
> Thanks so much again.
>
> On Tue, Apr 16, 2019 at 3:34 AM Dennis Shea <shea at ucar.edu> wrote:
>
>> When you pose a 'help' question, you should *always* provide the output
>> from:
>>
>> %> ncdump -h SPI,nc
>>
>> or, equivalently,
>>
>> %> ncl_filedump SPI.nc
>>
>> or
>>
>>   f = addfile(....")
>>   spi = f->SPI
>>   printVarSummary(spi)
>>   pritMinMax(spi,0)
>>
>> otherwise, people are guessing.
>> =================
>>    nrun  = 3                     ; 3, 6, 12
>>    nmos = 12                  ; number of months/year
>>    NYRS  = 90
>>    NTIM =NYRS*nmos   ; TOTAL # of months
>>
>>    NYR30 = 30
>>    NTM30 = NYR30*nmos
>>    NSG30 = 3       ; # of 30-year segments
>>
>> Original dimensions:
>>
>>    spi(nrun,time)              ; station or location
>> or
>>    spi(nrun,time,lat,lon)    ; grid
>>
>> ;-----
>>    KNT = new((/nrun,NSG30/),"integer")
>> or
>>    KNT = new((/nrun,NSG30,nlat,mlon/),"integer")
>>
>>    spiCrit = -1.0   ;
>>    ntStrt  = 0
>>    ntLast = NTM30 -1        ; 360 months [30 years];  -1  is for NCL index
>>
>>    do ns=0,NSG30-1
>>         KNT(:, ns) = dim_num_n( spi(:,*ntStrt:ntLast*).le.spiCrit, 1)
>> or
>>        KNT(:, ns,:,:) = dim_num_n( spi(:,*ntStrt:ntLast,*:,:).le.spiCrit,
>> 1)
>>        ntStrt = ntStrt + NSG30
>>         ntLast = ntLast + NSG30
>>     end do
>>
>>   printVarSummary(KNT)
>>   printMinMax(KNT,0)
>>   print("=====")
>>
>>
>>
>> On Mon, Apr 15, 2019 at 4:35 AM Oluwaseun Ilori <wilseun at gmail.com>
>> wrote:
>>
>>> Thanks, I'll check them out.
>>>
>>> On Mon, Apr 15, 2019 at 2:39 AM Md. Jalal Uddin <dmjalal90 at gmail.com>
>>> wrote:
>>>
>>>> You can look at two functions that might help you.
>>>> count_unique_values
>>>>
>>>> https://www.ncl.ucar.edu/Document/Functions/Built-in/count_unique_values.shtml
>>>>
>>>>
>>>> where
>>>>  https://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml
>>>>
>>>> Good luck!
>>>>
>>>> On Mon, Apr 15, 2019 at 2:35 AM Oluwaseun Ilori <wilseun at gmail.com>
>>>> wrote:
>>>>
>>>>> Good day,
>>>>> Please I need help to perform drought classification base on McKee
>>>>> et., 1993. I'm having SPI.nc file that contain 3, 6, and 12months time
>>>>> scales for the period of 90 years (2011-2100). I want to use spi < - 1.0 to
>>>>> determine drought frequency for the first 30 years, second 30 years and the
>>>>> third 30 years and save it as nc file. I've been looking for any function
>>>>> that I could use to perform this task but none yet. Pleas could someone put
>>>>> me through cos I'm not so good in this but I love the output of ncl.
>>>>> Thanks in advance
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>>
>>>> --
>>>> *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
>>>> Facebook: jalal.hossen.39
>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>> Twitter: dmjalal90
>>>> Skype: dmjalal90
>>>>
>>>
>>>
>>> --
>>> *OLUWASEUN ILORI*
>>> *B.Tech(Hons) in Meteorology*
>>> *M.Tech in Meteorology and climate science*
>>>
>>> *Phone: +2347031000687 +2348069154213*
>>> *Federal University of Technology Akure. Nigeria.*
>>> *Facebook: *http://facebook.com/hilorywilson
>>> <https://www.facebook.com/hilorywilson>
>>> linkedln: https://www.linkedin.com/in/wilson-ilori-447952108
>>> Twitter: HiloryW
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>
> --
> *OLUWASEUN ILORI*
> *B.Tech(Hons) in Meteorology*
> *M.Tech in Meteorology and climate science*
>
> *Phone: +2347031000687 +2348069154213*
> *Federal University of Technology Akure. Nigeria.*
> *Facebook: *http://facebook.com/hilorywilson
> <https://www.facebook.com/hilorywilson>
> linkedln: https://www.linkedin.com/in/wilson-ilori-447952108
> Twitter: HiloryW
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190416/46b4108f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OluwaseunIlori_spi.ncl
Type: application/octet-stream
Size: 1373 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190416/46b4108f/attachment.obj>


More information about the ncl-talk mailing list