Re: SPI

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 29 2013 - 14:18:27 MDT

As noted before, you are using a climatology .... 12 values
at each grid point.

The dim_spi_n documentation clearly states:

===
x

Monthly precipitation of type 'float' or 'double' and any
dimensionality. The size of the specified dims must be divisable by 12.
Since a distribution is being fit, there should be a 'reasonably' large
sample size. At least 30 years is recommended.
===

That is 30*12 ... 360 values. You are using 12.

In a previous email, you asked for a suitable data set.
I sent you a WWW link. Please use that data set.

===

[a] Large numbers: Likely, some computational sensitivity when *very*
     small sample sizes are used.

[b] lots of fill values: The 1st rule of data processing
     is "look at your data"

    f = addfile("precip.mon.1981-2010.ltm.v6.nc","r")
    prc = f->precip
    printVarSummary(prc) ; lat: [-88.75..88.75] lon: [1.25..358.75]

    print("prc: min="+min(prc)+" ; max="+max(prc) )

    print(prc(0,:,{180})) ; all latitudes at 1st time step at Dateline

This latter shows that some latitudes are missing.
Likely, some grid points have most or all data missing.

===

On 7/29/13 1:34 PM, Setareh Rahimi wrote:
> Dear Mr/Mrs;
>
> I am trying to calculate Standardised Precipitation Index (SPI). I run the
> below codes, but the result I have got is not between (+3,-3), values more
> than +3 like 14, 20 are included in the output. I also got lots of fill
> values rather than a number.Could you please kindly advice me what it is
> wrong with the codes I run.
>
> Kind regards,
>
> f = addfile("precip.mon.1981-2010.ltm.v6.nc","r")
> prc = f->precip
> dimp = dimsizes(prc)
> ntim = dimp(0)
> nlat = dimp(1)
> mlon = dimp(2)
>
> len = (/3, 6/)
> klen = dimsizes(len)
> spi = new((/klen,ntim,nlat,mlon/) ,float,prc@_FillValue)
>
> do k=0,klen-1
> spi(k,:,:,:) = dim_spi_n(prc, len(k), False, 0)
> end do
>
> print(sprintf("%8.2f", prc) \
> +sprintf("%8.2f", spi(0,:,:,:)) \
> +sprintf("%8.2f", spi(1,:,:,:)) )
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 29 14:18:34 2013

This archive was generated by hypermail 2.1.8 : Thu Aug 01 2013 - 15:55:03 MDT