<html><head></head><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:16px"><div id="yiv0931390268yui_3_16_0_1_1449203162812_3623" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;">Dear NCL User,</div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3625" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3627" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3629" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;">I was run SPI scripts as below and it worked, but I want the output this script is netCDF or csv, does anyone know how to do this? Please help me.</div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3631" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3633" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3635" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3637" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3639" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;">Thank you very much,</div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3641" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3643" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3645" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3647" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3649" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;">Misna</div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3651" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3653" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3655" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><br id="yiv0931390268yui_3_16_0_1_1449203162812_3657" class=""></div><div id="yiv0931390268yui_3_16_0_1_1449203162812_3621" dir="ltr" class="" style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px;"><pre id="yiv0931390268yui_3_16_0_1_1449203162812_3620" class="" style="font-size: 12.8px; color: rgb(0, 0, 0); word-wrap: break-word;">;----------------------------- ------------------------------ -----------
; spi_2.ncl
;
; Concepts illustrated:
; - Computing the Standardized Precipitation Index (SPI)
; - Reading data from the GPCP (Global Precipitation Climatology Project)
;----------------------------- ------------------------------ -----------
load "$NCARG_ROOT/lib/ncarg/ nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/ nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/ nclscripts/csm/contributed. ncl"
diri = "./"
fili = "<a rel="nofollow" target="_blank" href="http://v22_gpcp.1979-2010.nc/" id="yiv0931390268yui_3_16_0_1_1449203162812_3677" class="" style="color: rgb(17, 85, 204);">V22_GPCP.1979-2010.nc</a>"
f = addfile(diri+fili, "r")
prc = flt2dble(f->PREC)
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 = f->date
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 ("ps","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: 1979-2010 (GPCP)" ; 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</pre><div dir="ltr" id="yui_3_16_0_1_1450062684368_7304" class=""><br id="yui_3_16_0_1_1450062684368_7306" class=""></div></div></div></body></html>