Package 'CMIP6VisR'

Title: Visualization and Analysis of Coupled Model Intercomparison Project, Phase-6 (CMIP6) Hydroclimatic Data
Description: Data manipulation for Coupled Model Intercomparison Project, Phase-6 (CMIP6) hydroclimatic data. The files are archived in the Federated Research Data Repository (FRDR) (Rajulapati et al, 2024, <doi:10.20383/103.0829>). The data set is described in Abdelmoaty et al. (2025, <doi:10.1038/s41597-025-04396-z>).
Authors: Simon Michael Papalexiou [aut], Heba Abdelmoaty [aut], Konstantinos Andreadis [aut], Kevin Shook [ctb, cre]
Maintainer: Kevin Shook <[email protected]>
License: GPL-3
Version: 1.0.0
Built: 2025-03-04 06:15:47 UTC
Source: https://github.com/tychelab/cmip6visr

Help Index


Visualization and Analysis of CMIP6 Hydroclimatic Data

Description

Provides data manipulation, analyses and visualization for Coupled Model Intercomparison Project, Phase-6 (CMIP6) hydroclimatic data. The files are archived in the Federated Research Data Repository (FRDR) (Rajulapati et al., 2024)

Author(s)

Maintainer: Kevin Shook [email protected] [contributor]

Authors:

  • Simon Michael Papalexiou

  • Heba Abdelmoaty

  • Konstantinos Andreadis

References

Rajulapati, C., Abdelmoaty, H., Nerantzaki, S., Papalexiou, S. (2024). High-resolution future temperature and precipitation dataset for Canada, 2015 - 2100. Federated Research Data Repository. https://doi.org/10.20383/103.0829

See Also

Useful links:


Calculates basin-averaged daily precipitation

Description

Extracts the daily precipitation values from CMIP6 NetCDF files, and calculates the mean precipitation for a given basin for each time interval. The original files are in longitude-latitude projection, so the areas of the cells varies. The cell areas are used to weight the precipitation when computing the basin mean precipitation.

The CMIP6 data are arranged by zone in 9 files. As a given basin may lie over more than one zone, it may necessary to read in data from more than one NetCDF file when computing the basin mean precipitation.

Usage

cv_basin_daily_precip(
  netcdf_directory = ".",
  scenario = "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_",
  basin_zone_area = NULL,
  temp_file = TRUE
)

Arguments

netcdf_directory

Required. Directory containing NetCDF files.

scenario

Required. Full name of scenario to be used. This is the file name omitting the zone number.

basin_zone_area

Required. A list object returned by cv_clip_basin() which contains the zone numbers to be used, the basin area within each zone, and rasters of each zone containing the area of each element.

temp_file

If TRUE (the default) then temporary files will be used when extracting the values from the NetCDF files. This option is slower than keeping all the values in memory (which is what occurs if temp_file = TRUE), but allows the function to work with very large basins, which may require more memory than is available.

Value

Reruns a data frame with 2 columns: date and precipitation. The date is a standard R date over the interval 2015-01-01 to 2100-12-31, and the precipitation is the basin mean value.

Author(s)

Kevin Shook

See Also

cv_clip_basin

Examples

# This function is marked to not be tested as it requires local copies of the CMIP6 data files
# which are many GB in size
library(terra)
az_raster <- cv_zone_area_raster()
fpath <- system.file("extdata", "07BF001.shp", package = "CMIP6VisR")
basin_vector <- vect(fpath)
basin_areas <- cv_clip_basin(az_raster, basin_vector)
netcdf_directory <- "."
values <- cv_basin_daily_precip(netcdf_directory = netcdf_directory,
                               basin_zone_area = basin_areas,
                               temp_file = FALSE)

Get zones and areas that clip rasters from a given basin polygon

Description

Takes the SpatRaster that represents zones and areas and clips them from polygon basin

Usage

cv_clip_basin(za_rast, basin)

Arguments

za_rast

SpatRaster of the zones and areas

basin

SpatVector of the basin to clip to

Value

Returns a list with 3 elements: 1) raster (rasters of cell areas for each zone), 2) area total area of each zone in the basin, and 3) zone zone numbers.

Author(s)

Kostas Andreadis

See Also

cv_basin_daily_precip

Examples

{
library(terra)
az_raster <- cv_zone_area_raster()
fpath <- system.file("extdata", "07BF001.shp", package = "CMIP6VisR")
basin_vector <- vect(fpath)
basin_areas <- cv_clip_basin(az_raster, basin_vector)
}

Gets zones and areas for all grid locations

Description

Uses the data frame zone_grid_df. Returns a raster containing two layers, the zone (1-9) and the area (km^2^) for each grid location in the CMIP6 files. The raster raster returned has 415 rows (latitudes in 0.1 degrees) and 883 columns (longitudes in 0.1 degrees). The zone number is used to determine the file(s) to read in for computing the basin mean precipitation statistics for a given Canadian hydrometric basin. The

Usage

cv_zone_area_raster()

Value

Returns a terra SpatRaster object (415 rows x 883 columns x 2 layers) of all Canadian grid locations.

Author(s)

Heba Abdelmoaty Kevin SHook

Examples

zone_area_grid <- cv_zone_area_raster()
library(terra)
plot(zone_area_grid)

zone_grid_df

Description

A dataframe of zone values and areas for all CMIP6 grid cells

Usage

zone_grid_df

Format

A dateframe with 169584 rows and 4 columns.

Details

Variables:

long

Longitude

lat

Latitude

zone

Zone (0-9)

area

Grid cell area km2^2

Source

https://doi.org/10.20383/103.0829