The SpiRas Package is a specialized tool developed for pixel-wise computation of the Standardized Precipitation Index (SPI) using daily precipitation raster datasets. The SPI is a pivotal meteorological index used for assessing drought and flood risks based on long-term precipitation records1 2 3 4. By implementing a pixel-wise approach, SpiRas aims to facilitate a detailed understanding of hydrometeorological patterns and their broader climatic implications.
The SpiRas package is designed to handle daily precipitation raster data in NetCDF format. To support the users in understanding and utilizing SpiRas effectively, a sample dataset comprising of 11 years (2010-2020) of daily precipitation raster files have been included. The dataset is spatially organized into a 12x12 grid, covering 144 raster cells over a region in Central India, providing a comprehensive temporal range for analysis.
The raster data included in this package was sourced from the Indian Meteorological Department (IMD)5.
The main function within the package is spi_raster. It serves as a powerful wrapper function for a series of nested functions that collectively manage the entire SPI analysis workflow.
Syntax:
spi_raster(start_year, end_year_index, scale, start_month, end_month, file_path = NULL)
Arguments:
start_year: integer, representing the required starting year of the data for SPI calculation.
end_year_index: integer, representing the index of the desired end year in the .nc raster dataset.
scale: integer, representing the temporal scale for SPI computation.
start_month, end_month: integer, specifying the start and end month for which SPI raster will be produced, respectively.
file_path: optional, representing the path to the netCDF (.nc) raster data files. Defaults to NULL.
The spi_raster function is designed to provide you with essential outputs, including:
Aggregated Monthly Precipitation Data
File: monthly_precipitation_df.csv
It generates a structured data frame containing aggregated monthly
precipitation data based on the daily precipitation data for each cell,
which serves as a crucial input for SPI calculation.
Computed SPI Values at Specified Temporal Scales
File: SPI_df.csv
It produces a data frame containing computed SPI values for each cell at
user-specified temporal scale. SPI values are calculated for different
time intervals, such as 1-month, 3-month, 6-month. This versatility
allows you to gain insights into the dynamics of precipitation behavior,
identifying trends, anomalies, and critical patterns over different time
spans.
Cell-wise computed SPI values as GeoTIFF raster data
File Format: .tif
The spi_raster function goes a step further by providing computed SPI
values in the form of GeoTIFF (.tif) raster data.
This allows for detailed analysis and visualization of SPI data, enabling you to use it for wide array of research applications, such as but not limited to:
Meteorological drought/flood monitoring and assessment
Agricultural impact assessment and decision-making
Water resource management
Climate change studies
Let’s say we want to analyze agricultural drought patterns in a specific region of Central India from 2010 to 2020 using raster-based precipitation data.
In India, crop development is primarily divided into two key seasons:
To assess the impact of drought during these crucial crop-growing periods, we will compute the 6-month Standardized Precipitation Index (SPI) for each pixel. We’ll focus on June and October as our starting months since they mark the peak sowing periods for Kharif and Rabi crops, respectively. 6
result <- spi_raster(start_year = 2010, end_year_index = 11, scale = 6, start_month = 18, end_month = 130)
Note: The ‘file_path’ is not specified, therefore, the function automatically defaults to using the included sample daily precipitation raster data files in .nc format.
Detailed explanation of the parameters in the spi_raster function call:
start_year: Specified as 2011, indicating the starting year of the SPI computation.
end_year_index: Represent the indices for the range of years to be included. Here, end_year_index = 11 corresponds to 2020, covering 11 years in total.
scale: Defined as 6, representing a 6-month time scale for pixel-wise SPI calculation.
start_month, end_month: Specifies the initial and final months for SPI computation. For Kharif (June-November) and Rabi season (October-March), it starts with June 2011, which corresponds to month 18 in a sequential monthly numbering starting from January 2010 i.e. month 1 and continues until October 2020, which corresponds to month 130.
Together, these parameters compute pixel-wise 6-month SPI values from June 2011 to October 2020, covering the critical crop development stages to assess the impact of precipitation variability on crop health.
The result variable generates three key outputs:
## Year Month X1 X2 X3 X4 X5
## 1 2010 1 0.0000000 0.000000 0.000000 0.1474515 1.8603116
## 2 2010 2 5.1779737 6.099544 9.823442 11.9787455 12.0075741
## 3 2010 3 0.0000000 0.000000 0.895749 0.6228872 0.5438586
## 4 2010 4 0.2403977 0.000000 0.000000 0.0000000 0.0000000
## 5 2010 5 0.3339742 0.000000 0.000000 0.0000000 0.0000000
## 6 2010 6 30.6622320 26.276713 9.180071 60.0069032 153.5437604
## 7 2010 7 239.2280069 217.673416 283.446433 279.4449899 236.7826508
## 8 2010 8 225.3894577 256.071903 252.008108 236.6393456 238.4287505
## 9 2010 9 70.9007322 96.370695 107.425469 92.3211942 67.1742473
## 10 2010 10 0.0000000 0.000000 0.000000 0.0000000 0.0000000
## 11 2010 11 23.3925558 31.768461 15.745866 15.5702000 3.4157544
## 12 2010 12 0.6014998 1.610668 1.113194 2.6480954 0.0000000
## X Y SPI
## 1 76.25 24 NA
## 2 76.50 24 NA
## 3 76.75 24 NA
## 4 77.00 24 NA
## 5 77.25 24 NA
## 6 77.50 24 -1.275
## 7 77.75 24 -1.096
## 8 78.00 24 -1.375
## 9 78.25 24 -1.589
## 10 78.50 24 -1.563
## 11 78.75 24 -1.472
## 12 79.00 24 -1.350
Thus, the ‘result’ variable encapsulates three outputs, providing a comprehensive dataset for further analysis and interpretation.
For accurate cell-wise SPI computation, it is recommended to handle missing values within your data using an appropriate interpolation method.
It is crucial to exercise caution when selecting the index of the desired end year. This index must align with the order of precipitation raster data in your folder directory. Careful selection ensures that the spi_raster function processes the correct data for SPI computation.
If a custom ‘file_path’ is given, spi_raster function uses the data files from the provided location. However, if ‘file_path’ is set to ‘NULL’, the function automatically uses the .nc raster data included within the SpiRas Package.
When executing the example provided within the SpiRas package, the resulting output stored within the ‘result’ variable will be placed in the working directory associated with your R project.
This documentation provides a user-friendly and detailed overview of the SpiRas package, elucidating how it can be effectively utilized to your precipitation raster data. For comprehensive information and example, please refer to the SpiRas package documentation.
UCAR (University Corporation for Atmospheric Research). “Standardized Precipitation Index (SPI).” Climate Data Guide. [URL: https://climatedataguide.ucar.edu/climate-data/standardized-precipitation-index-spi]↩︎
Meteorological drought analysis using Standardized Precipitation Index over Luni River Basin in Rajasthan, India. [DOI: https://doi.org/10.1007/s42452-020-03321-w]↩︎
Drought monitoring and prediction using SPI, SPEI, and random forest model in various climates of Iran. [DOI: https://doi.org/10.2166/wcc.2021.287]↩︎
Using the standardized precipitation index for flood risk monitoring [DOI: https://doi.org/10.1002/joc.799]↩︎
Indian Meteorological Department (IMD). “Rainfall Data for SPI Calculation.” IMD Climate Monitoring and Prediction Group. Data Source.↩︎
Drought characterisation based on an agriculture-oriented standardised precipitation index. [DOI: https://doi.org/10.1007/s00704-018-2451-3]↩︎