How to Calculate SPEI and SPI Indices using SPEI Package in RStudio
HTML-код
- Опубликовано: 5 фев 2025
- In this video, I have clearly shown the steps required to calculate SPEI and SPI indices using SPEI package in RStudio.
#pleasesubscribe
#sharingiscaring
Thank you very much Mr. Fitsum, I was having trouble understanding the method, but you have helped me a lot.
Thanks so much for your breif explanation!
good job man....it is very helpfull
Exactly what I needed. Thank you!
This was unbelievably useful!
Good job done mate!
Hallo Fitsum, in your example, it only shows for one latitude point. But in real sense, you will be having multiple altitudes. How do you compute this given varying altitudes?
Hello Mr. Fitsum, i love your videos they are very useful! I would like to ask you, how can i plot my SPI results, in this video you made it to the SPEI.
i would aprecciate if you can help me, greetings from Colombia.
Hello Fitsum how are you? I am working on preparing SPEI map for multiple stations using R studio, provided that I have monthly precipitation, minimum and maximum temperature for 500 Geographic coordinates?
Thank you very much for the video, it was extremely helpful. I have a question regarding computing SPEI when dealing with multiple locations. Appreciate if you could provide some guidance on how to do this.
Hello Mr. Fitsum, your videos are very useful! I would like to ask you,could you make video about statistical downscaling in R (package ClimDown) and how to prepare data for such kind of analysis in different format (netcdf and so on). Thank you in advance!!!
hello Ерболат Муканов, have you got any video about statistical downscaling in R? i am also looking for this but not yet obtained.
The SPEI can be used for drought indices (SDI). I heard that SPI can be used. Would it be correct to use that?
Amazing video. Thank you a million. If I have hundreds of stations, how should I do to obtain all the SPEI values?
hellos sir. I want to ask you some questions, how do yo know the value of gamma, beta and alpha for the SPEI calculation? Is the values for the gamma, alpha and beta is the same with SPI? Did you set up the value of gamma, alpha and beta manually in the R studio. Thank you in advance sir
can you say how to analyze the data. i am taking 30 yrs data. spi-3-6-12 which is relevant?
I do have a question though. How is it possible to extract to SPEI3, SPEI6 data to excel?
Thank you so much
hello! Sir, thank you for the video! But I have a question when i calculated SPEI, i got a -inf instead of results only for 1 year. I ve checked datasheet, and there everything is OK. Why have i gotten -inf? tnx
Hi. I get this warning when I type the formula:
[1] "Calculating the Standardized Precipitation Evapotranspiration Index (SPEI) at a time scale of 3. Using kernel type 'rectangular', with 0 shift. Fitting the data to a Gamma distribution. Using the ub-pwm parameter fitting method. Checking for missing values (`NA`): all the data must be complete. Using the whole time series as reference period. Input type is vector. No time information provided, assuming a monthly time series."
Can you help me please?
Thanks.
i am also getting the same error, did you manage to get it fixed? if yes, how?
HOW CAN I CALCULATE THE COMBINED DROUGHT INDEX by R studio and how can down-scaled data !! thank you !!
Hello. I have a question. Please ask me.
How to calculate SPI3, SPI6, SPI9 and SPI12? Thank you.
If you have the same dataset format please use the following functions to get respective index.
SPI3
@@Dr.Fitsum_Teshome If I use Precintcon Package. How to calculate SPI3,SPI6,SPI9 and SPI12?
Hello sir. I have plotted the SPI graph using plot(spi(ts(data$prcp, frequency = 12, start = c(1957,1)), scale = 1)) to get years on the time axis of the graph. But I noticed that there are also some grey lines in between the blue and red lines. Are these grey lines normal? Also, I have obtained 1-month SPI values which are exactly equal to zero for about 10 months in the same year and this has happened in multiple years. I wanted to ask if this is possible? Thank you.
Hi. Do you work with landsat or sentinel images? Can you please upload video about processing these images and analysis with python? Thank you.
Hi. How should we follow the spei calculation of the multi-station? can you show it with an R code? thanks.
thank you it's really helpful and I would be grateful if you can send some links for Rstudio
Please, how to calculate PCD and PCP on basis of monthly data with Rstudio. Thanks
Can you please tell me how can I make a spatial plot of SPEI
Is there anyone who has the same problem, that the plot.spei function just doesn't exist?
How do I calculate SPEI in R for varying latitudes ? For example, in lat = 7.3, I have many latitudes. How do I include all those ?
Thank you so much! I am curious If it is possible to calculate SPI and SPEI easily in raster format. Please, could you share If you know some tools/softwares for that?
Yes, it is possible. You can load and transform raster data into a dataframe, but it is kinda complicated. Dplyr can help a lot.
@@danielcantor6166 Thank you for your reply. Could you please explain what should I do with dplyr? Maybe you have some manuals. My mail is zhanassyl.kz@gmail.com
Thank you much 🙏💕
Thank you . Could you pls tell us how we can get SPEI package?
Which
R version you used?
is it possible to obtain spei scale of zero, tried in R studio, I didn't get it
Nice Work!, But how to add the SPI index to map with legends
can you say how to use netcdf data to find SPEI?
Hmm, to me it says: Error in as.matrix(Tmin) : object 'Addis' not found
Change the name of your data to addis
Mr. Fistum can you ask me how to calculate precipitation lost?
Fistum its really good jobs; perhaps I learn most from you. I really appreciate if you are able to convert time scale from (5, 10,15,20,25) to for an example (1981,1982,..., )so we can clearly identify which year is drought and which year is not, otherwise its little difficult to interpret the results from the graph
Check Magarsa's reply
For a video example: To plot a graph for SPEI-1 type the following command,
Plot(spei(ts(Addis$CWBAL,freq=12,start=c(1985,1)),1,ref.start=c(1985,1),ref.end=c(2017,1)))
"ts" is time series
"Addis" is station name
"CWBAL" is climatic water balance (Addis$PRCP-Addis$PET)
"freq" is frequency which is twelve months
@@Dr.Fitsum_Teshome, i have been able to plot all my scales 1,3,6 and 12 months, but when i tried plotting using this command to put the numbers in years.. by typing this command
Plot(spei(ts(standp$CWBAL,freq=12,start=c(1982,1)),1,ref.start=c(1982,1),ref.end=c(2018,1)))
the error message is
Error in Plot(spei(ts(standp$CWBAL, freq = 12, start = c(1982, 1)), 1, :
could not find function "Plot"
i pray you respond
may it not be "Plot" with a small "p"?
How to install hargreaves function in rstudio?
thank you
Nice Video. But How do I calculate SPI to get results for each year. This procedure gives results per month per year, but I want SPI per year NOT per month. What should I do?
Use SPI12
@@Dr.Fitsum_Teshome
Do you mean that since my hydrological year starts in October and ends in September the following year, I could extract the SPEI values for the month of September in each year to get the SPEI values at annual time scale?
I want the final output to be like this:
Year SPEI
1990 xx
1991 xx
1992 xx
I have seen the SPI package in R gives the results in the above format, but the problem is that I cant use it since it does not calculate SPEI
@@moseschisola9690 Yes
why you do not add any video to your channel?
please upload spei nd spi calculation in netcdf file format?
How can I add the SPEI results to the precipitation and temperature data table?
just append it as a column on the data table
How to extract SPEI data into excel?
thank you
Hi
In the results, the number appears large, such as
-9.869182e-01
How do I get rid of this
round(spei3_tho,digits=4)
Error in round(spei3_tho, digits = 4) :
non-numeric argument to mathematical function
This is not a big number
-9.869182e-01 = -9.869182*10-1
= -9.869182*0.1 which is -0.986918
E+01 means moving the decimal point one digit to the right, E+00 means leaving the decimal point where it is, and E-01 means moving the decimal point one digit to the left. Example: 1.00E+01 is 10, 1.33E+00 stays at 1.33, and 1.33E-01 becomes 0.133.
@@Dr.Fitsum_Teshome thanks
Nice Video, How do you change the period from 5,10,15,20 into the data period like 1985, 1986,1987 for instance.
Thank you
I am not clear with your question
Can you elaborate it more
@@Dr.Fitsum_Teshome Am asking about the time, is it possible to change years (as your data starts from 1985) to read from 1985 instead of the SPEI to read time in 5 years intarval (5,10,15)?
I dont think so
@@Dr.Fitsum_Teshome Owk thank you
@@thavhanyedzahumbulani3931 Yes it is possible. For example if you want to plot SPEI-1 graph which starts from 1985 and ends in 2017, type like this: plot(spei(ts(name af your data$PRCP-name af your data$PET,freq=12,start=c(1985,1)),1,ref.start=c(1985,1),ref.end=c(2017,1)))
Hello sir. Thank you for your video. Can I ask if I need to calculate the SPI so my data only consist of the precipitation data. And i uploaded the data set, the spi (file name$PRCP,3) but the outcome is NA. Anyone can help me? Thank you in advance! :)
I have an error:
Error: Data must not contain NAs
> spei3
Justyna K. Do you have missing data replaced by NA? If it is so remove it or share your dataset in fitsalem@gmail.com
@@Dr.Fitsum_Teshome Hello, How to fix the Error in spei(CWBAL, 3) : object 'CWBAL' not found? Thank you
What is the meaning of CWBAL
How to download Mann-Kendall trend test software program
how to fix
"Calculating reference evapotranspiration using the Hargreaves method. Using latitude (`lat`) to estimate extraterrestrial radiation. Checking for missing values (`NA`): all the data must be complete. Input type is vector. Assuming the data are monthly time series starting in January, all regular (non-leap) years."
Hi! How can I add dates to the plot?
PLS, HOW DO I ADDRESS THIS?
Can i get the excell sheet
how can we calculate spi3,spi6,spi9,spi12??
If you have the same dataset format please use the following functions to get respective index.
SPI3
Est ce que je peux changer la langue
alguien pudo cambiarle los valores del eje X a años?
Error in read.table(filename, header = TRUE) :
'file' must be a character string or connection
I am getting this error. Can you please help me on this?
String character but you need to specify column
@@Dr.Fitsum_Teshome Thanks for your reply.
Can you tell how we can predict drought using R or Python. Is SPI needed to train and predict drought?
Pls give me the excel. Sheet
HOW TO CHANGE 5, 10, 15 TO 1985, 1986, 1987
PLS, HOW DO I INTERPRET THE SPEI PLOTS? THANKS
hello sir I try to watch your video, it is good. I would like to ask one question. How to calculate Reconnce Drought Index (RDI) by using Rstudio?