Re: map of Standardized Precipitation Index (SPI)

From: Alessandra Giannini <alesall_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 13 2014 - 12:55:04 MDT


Hello Mamadou,

my ncl scripting may be obsolete by now, but the way I learned it when I di=
d, I would write something like this:

spi({time | 200007}, lat |: lon |:)

and make sure that "200007" is a value in the time array. It looks to me li=
ke it may not be the case, since:

time: [20060131.99930555..21001231.99930555]

or is it?

Hope this makes sense…

warm regards, alessandra







-- =

Alessandra Giannini
IRI for Climate and Society - The Earth Institute at Columbia University
P.O. Box 1000, Palisades NY 10964-8000
phone/fax: +1 845 680-4473/4864 - email: alesall@iri.columbia.edu

On Jun 13, 2014, at 2:31 PM, "mamadoulamine.mbaye@ucad.edu.sn" <mamadoulami=
ne.mbaye@ucad.edu.sn> wrote:

> Hi Maria,
> It fixes it, but I got another error:
> atal:NclOneDValGetClosestIndex: finish coordinate index out of range, can=
't continue
> fatal:Could not obtain coordinate indexes, unable to perform subscript
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 71 in fi=
le rainfall_SPI.ncl
> =

> ===
> res@gsnCenterString = yyyymm({200007})
> plot(0) = gsn_csm_contour_map_ce(wks,spi({200007},:,:), res) =

> ==
> How to get my coordinate indexes?
> =

> De : Maria Gehne - NOAA Affiliate <maria.gehne@noaa.gov>
> Envoyé : vendredi 13 juin 2014 09:32
> À : mamadoulamine.mbaye@ucad.edu.sn
> Cc : ncl-talk@ucar.edu USERS
> Objet : Re: [ncl-talk] map of Standardized Precipitation Index (SPI)
> =

> Hi Mamadou,
> =

> if you look at the documentation for yyyymm_time (http://www.ncl.ucar.edu=
/Document/Functions/Contributed/yyyymm_time.shtml) =

> you can see that the first and second argument have to be integers. Your =
yrStrt and yrLast are not integers. You can try =

> =

> year = yyyymm/100
> yrStrt = toint(year(0))
> yrLast = toint(year(ntim-1))
> =

> and see if that fixes your problem.
> =

> Maria
> =

> =

> =

> On Fri, Jun 13, 2014 at 9:53 AM, mamadoulamine.mbaye@ucad.edu.sn<mamadoul=
amine.mbaye@ucad.edu.sn> wrote:
> Hi,
> I am trying to compute and plot the map of Standardized Precipitation =
Index (SPI), but I got the following error:
> -------------------------------------------------------------------------=
--------
> Variable: prc
> Type: double
> Total Size: 2918400 bytes
> 364800 values
> Number of Dimensions: 3
> Dimensions and sizes: [time | 1140] x [lat | 20] x [lon | 16]
> Coordinates: =

> time: [20060131.99930555..21001231.99930555]
> lat: [18.75..9.25]
> lon: [-13.75..-6.25]
> Number Of Attributes: 2
> _FillValue : -8.999999873090293e+33
> missing_value : -8.999999873090293e+33
> (0) min=0 max=33.5802
> fatal:Argument type mismatch on argument (0) of (yyyymm_time) can not coe=
rce
> fatal:["Execute.c":8128]:Execute: Error occurred at or near line 33 in fi=
le rainfall_SPI.ncl
> =========================
==========================
====================
> here is the script :
> prc = flt2dble(f1->var1)
> pmsg = prc@_FillValue ; convenience
> =

> printVarSummary(prc)
> printMinMax(prc,0)
> =

> runlen = (/12,24/) =

> nrun = dimsizes(runlen)
> ;*********************************
> ; plot parameters
> ;*********************************
> dimprc = dimsizes(prc)
> ntim = dimprc(0)
> nlat = dimprc(1)
> mlon = dimprc(2)
> =

> yyyymm = f1->time
> yyyymm = yyyymm/100
> =

> year = yyyymm/100
> yrStrt = year(0)
> yrLast = year(ntim-1)
> nyear = yrLast-yrStrt+1
> yyyymm = yyyymm_time(yrStrt, yrLast, "integer") =

> yrfrac = (/ yyyymm_to_yyyyfrac(yyyymm, 0.0) /)
> =

> prc&time = (/ yyyymm /)
> =

> ;=
> =

> wks = gsn_open_wks ("x11","spi")
> gsn_define_colormap(wks,"BlueWhiteOrangeRed")
> gsn_reverse_colormap(wks) ; Reverse the color map.
> =

> res = True =

> res@gsnDraw = False ; don't draw
> res@gsnFrame = False ; don't advance frame
> res@gsnSpreadColors = True =

> =

> res@cnFillOn = True ; color Fill =

> res@cnFillMode = "RasterFill" ; Raster Mode
> res@cnLinesOn = False ; Turn off contour lines
> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res@cnMinLevelValF = -3.0 ; set min contour level
> res@cnMaxLevelValF = 3.0 ; set max contour level
> res@cnLevelSpacingF = 0.5 ; set contour spacing
> res@lbLabelBarOn = False ; turn off individual cb's
> =

> resP = True ; panel resources
> resP@txString = "SPI: 2006-2100 (BC_REMO_RCP45)" ; add center=
 string
> resP@gsnPanelLabelBar= True ; add common colorbar
> =

> plot = new ( 2, "graphic")
> =

> do nr=0,nrun-1
> spi = dim_spi_n(prc, runlen(nr), False, 0)
> =

> spi@long_name = "SPI"
> spi@units = "run="+runlen(nr)
> copy_VarCoords(prc, spi)
> =

> res@gsnCenterString = yyyymm({200007})
> plot(0) = gsn_csm_contour_map_ce(wks,spi({200007},:,:), res) =

> =

> res@gsnCenterString = yyyymm({201012})
> plot(1) = gsn_csm_contour_map_ce(wks,spi({200612},:,:), res) =

> =

> gsn_panel(wks,plot,(/2,1/),resP) ; now draw as one plot
> end do
> end
> =======
> I was trying to adapt the script from NCL scripts.
> Thanks in advance
> Mamadou
> Regards
> =

> =

> _______________________________________________
> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri Jun 13 06:55:27 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT