Overview

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.

Data

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.

Data Source

The raster data included in this package was sourced from the Indian Meteorological Department (IMD)5.

SpiRas Functionality

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:

  1. start_year: integer, representing the required starting year of the data for SPI calculation.

  2. end_year_index: integer, representing the index of the desired end year in the .nc raster dataset.

  3. scale: integer, representing the temporal scale for SPI computation.

  4. start_month, end_month: integer, specifying the start and end month for which SPI raster will be produced, respectively.

  5. file_path: optional, representing the path to the netCDF (.nc) raster data files. Defaults to NULL.

Function Outputs

The spi_raster function is designed to provide you with essential outputs, including:

  1. 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.

  2. 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.

  3. 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:

  1. Meteorological drought/flood monitoring and assessment

  2. Agricultural impact assessment and decision-making

  3. Water resource management

  4. Climate change studies

Example

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:

  1. start_year: Specified as 2011, indicating the starting year of the SPI computation.

  2. 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.

  3. scale: Defined as 6, representing a 6-month time scale for pixel-wise SPI calculation.

  4. 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.

Example Output

The result variable generates three key outputs:

  1. monthly_precipitation_df.csv: This output contains a structured data frame with aggregated monthly precipitation data based on the daily precipitation data for each cell, from 2010 to 2020.
##    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
  1. SPI_df.csv: This output includes a data frame that holds calculated SPI values for each cell, calculated at a 6-month temporal scale. In this data frame, X, Y and SPI represent the coordinates and SPI values corresponding to each cell of raster data.
##        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
  1. Computed 6-month cell-wise SPI values in the form of GeoTIFF (.tif) raster data from June 2011 to October 2020.

Thus, the ‘result’ variable encapsulates three outputs, providing a comprehensive dataset for further analysis and interpretation.

Important Note

Conclusion

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.

Authors

Reference


  1. UCAR (University Corporation for Atmospheric Research). “Standardized Precipitation Index (SPI).” Climate Data Guide. [URL: https://climatedataguide.ucar.edu/climate-data/standardized-precipitation-index-spi]↩︎

  2. Meteorological drought analysis using Standardized Precipitation Index over Luni River Basin in Rajasthan, India. [DOI: https://doi.org/10.1007/s42452-020-03321-w]↩︎

  3. 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]↩︎

  4. Using the standardized precipitation index for flood risk monitoring [DOI: https://doi.org/10.1002/joc.799]↩︎

  5. Indian Meteorological Department (IMD). “Rainfall Data for SPI Calculation.” IMD Climate Monitoring and Prediction Group. Data Source.↩︎

  6. Drought characterisation based on an agriculture-oriented standardised precipitation index. [DOI: https://doi.org/10.1007/s00704-018-2451-3]↩︎