A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

SpatIndex

This R package provides a simple way of computing spatially-distributed drought and extreme indices.
https://github.com/obaezvil/spatindex

Last synced: over 1 year ago
JSON representation

Acceptance Criteria

Repository metadata

Spatial indices to monitor global change

README.md

SpatIndex

Spatial indices to monitor droughts and global change

This R package provides a simple way of computing spatially-distributed drought and extreme indices. The users can compute meteorological, agricultural, and hydrological indices as well as the extreme CLIMDEX indices by providing raster files of the required hydroclimatological variables. The drought and extreme indices that are implemented in SpatIndex are summarised in the following figure:

Installation

Install the development version from GitHub:

remotes::install_github("obaezvil/SpatInex")

Drought analysis

The drought indices implemented in the SpatIndex package are:

Index Function name
Percent of Normal Precipitation spatial_pni()
Deciles spatial_deciles()
Standardised Precipitation Index spatial_spi()
Standardised Precipitation Evapotranspiration Index spatial_spei()
Vegetation Condition Index spatial_vci()
Temperature Condition Index spatial_tci()
Vegetation Health Index spatial_vhi()
Empirical Standardised Soil Moisture Index spatial_essmi()
z-score (can be used with multiple variables) spatial_zscore(´)
Combined Drought Index spatial_cdi()
Standardised Streamflow Index ssi()
Standardised Snow Water Equivalent Index spatial_swei()

If the user wants to calculate the SPI-12 using the reference period 1981--2010, they could do it as follows:

spi_12 <- spatial_spi(P_data, scale = 12,  ref_start = "1981-01", ref_end = "2010-12")

Where:

  • P_data: a 'SpatRaster' object that contains spatially-distributed monthly precipitation data that will be used to calculate the SPI. This 'SpatRaster' must include the dates of the respective layers (they can be set with the function time of the terra package).

  • scale: Integer value representing the time scale at which the SPI will be computed.

  • ref_start and ref_end: optional values that represent the starting and ending point of the period of reference used for computing the index. The date should be introduced as '%Y-%m'. For example: "1989-02".

The following figure shows the spatially distributed SPI-12 values over Chile for 2013 using CR2METv2.5:

This package is very useful to apply diverse drought indices using multiple gridded datasets. As an example, the next figure shows diverse hydrological (SSI and SWEI), agricultural (VCI, VHI, and ESSMI), and meteorological (Percent of Normal and Deciles) indices. These indices were calculated using diverse datasets over the Tascadero catchment (241 km$^2$) in Chile.

Extreme events analysis

These functions have the same name as the indices. For example, if the user wants to calculate the maximum 1-day precipitation (Rx1day):

rx1day <- Rx1day(rst.path, vct = NULL,  temporal.scale = c("total", "annual"),
                  start.date,  end.date,  date.fmt = "%Y-%m-%d",  pattern = NULL)

Where:

  • rst.path File path to daily raster files for the period of analysis. These files should include the date in any format.

  • vct Vector file of the study area (Optional). It will be used to crop the spatial extent of the raster files if required. This parameter is set to 'NULL'; therefore, the index will be calculated over the entire raster extent by default.

  • temporal.scale either 'total' to use all the period of record (i.e., all the files in the parent folder 'rst.path'), or 'annual' to compute the index annually (From Jan to Dec).

  • start.date Position where the dates of the raster files start. For example, for files named 'ProductA_1989-02-28.tif', the start.date will indicate the position where the date starts (i.e., 10).

  • end.date Position where the dates of the raster files end. For example, for files named 'ProductA_1989-02-28.tif', the end.date will indicate the position where the date ends (i.e., 19).

  • date.fmt Format of the dates included in the file names (default = "%Y-%m-%d").

  • pattern Set to NULL. Is there a specific pattern to list the raster files?

An example of the implementation of Rx1day over Sub-Saharan Africa for 1981--2021 can be observed in the following Figure:

Vignette

An introductory vignette on how to use the SpatIndex package and how to use its functions is coming soon!


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: over 1 year ago

Total Commits: 149
Total Committers: 2
Avg Commits per committer: 74.5
Development Distribution Score (DDS): 0.007

Commits in past year: 67
Committers in past year: 1
Avg Commits per committer in past year: 67.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
obaezvil o****l@g****m 148
Oscar Manuel Baez Villanueva 6****l 1

Committer domains:


Issue and Pull Request metadata

Last synced: over 1 year ago

Total issues: 3
Total pull requests: 0
Average time to close issues: about 9 hours
Average time to close pull requests: N/A
Total issue authors: 2
Total pull request authors: 0
Average comments per issue: 1.67
Average comments per pull request: 0
Merged pull request: 0
Bot issues: 0
Bot pull requests: 0

Past year issues: 3
Past year pull requests: 0
Past year average time to close issues: about 9 hours
Past year average time to close pull requests: N/A
Past year issue authors: 2
Past year pull request authors: 0
Past year average comments per issue: 1.67
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/obaezvil/spatindex

Top Issue Authors

  • wisemuck (2)
  • Mtrsh (1)

Top Pull Request Authors


Top Issue Labels

Top Pull Request Labels

Score: 2.9957322735539913