- 积分
- 18
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-8-27
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
给大家推荐两个算SPI的网站,一个是http://drought.unl.edu/Monitorin ... ableSPIProgram.aspx(不会做成链接形式请见谅,复制粘贴),可以下载SPI_sL_6.exe,还有一个是Matlab的方法,代码如下:
%%% Programmed by Taesam Lee, Dec.03,2009% INRS-ETE, Quebec, Canadafunction [Z]=SPI(Data,scale,nseas)%Standardized Precipitation Index % Input Data% Data : Monthly Data vector not matrix (monthly or seasonal precipitation)% scale : 1,3,12,48% nseas : number of season (monthly=12)% Example% Z=SPI(gamrnd(1,1,1000,1),3,12); 3-monthly scale, % Notice that the rest of the months of the fist year are removed.% eg. if scale =3, fist year data 3-12 SPI values are not estimated.%if row vector then make coloumn vector%if (sz==1) Data(:,1)=Data;enderase_yr=ceil(scale/12);% Data setting to scaled datasetA1=[];for is=1:scale, A1=[A1,Data(is:length(Data)-scale+is)];endXS=sum(A1,2);if(scale>1), XS(1:nseas*erase_yr-scale+1)=[]; endfor is=1:nseas tind=is:nseas:length(XS); Xn=XS(tind); [zeroa]=find(Xn==0); Xn_nozero=Xn;Xn_nozero(zeroa)=[]; q=length(zeroa)/length(Xn); parm=gamfit(Xn_nozero); Gam_xs=q+(1-q)*gamcdf(Xn,parm(1),parm(2)); Z(tind)=norminv(Gam_xs);end%Gamma parameter estimation and tranform希望能帮到会用的人,反正我现在是不太会用
|
|