| 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.1.0 |
| Built: | 2026-06-01 11:38:09 UTC |
| Source: | https://github.com/tychelab/cmip6visr |
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)
Maintainer: Kevin Shook [email protected] [contributor]
Authors:
Simon Michael Papalexiou
Heba Abdelmoaty
Konstantinos Andreadis
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
Useful links:
Takes the SpatRaster that represents zones and areas and
clips them from polygon basin.
cv_clip_basin(za_rast, basin)cv_clip_basin(za_rast, basin)
za_rast |
|
basin |
|
Returns a list with 3 elements:
raster (rasters of cell areas for each zone).
area (total area of each zone in the basin).
zone (zone numbers).
Kostas Andreadis
cv_extract_mean_basin_daily cv_extract_all_basin_daily
## Not run: 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) ## End(Not run)## Not run: 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) ## End(Not run)
Extracts the daily precipitation or temperature values from CMIP6 NetCDF files for all locations in a specified basin.
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.
cv_extract_all_basin_daily( netcdf_directory = ".", scenario = "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_", basin_zone_area = NULL, temp_file = TRUE, output_file_name = NULL )cv_extract_all_basin_daily( netcdf_directory = ".", scenario = "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_", basin_zone_area = NULL, temp_file = TRUE, output_file_name = NULL )
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. The first character of the scenario name is used to determine the name of the variable returned. |
basin_zone_area |
Required. A list object returned by |
temp_file |
If |
output_file_name |
If |
Returns a SpatRaster object of the daily precipitation for all
locations in the specified basin. Optionally writes the precipitation values to
a specified NetCDF file.
Kevin Shook
cv_clip_basin cv_extract_mean_basin_daily
# 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 <- "." all_precip <- cv_extract_all_basin_daily(netcdf_directory = netcdf_directory, basin_zone_area = basin_areas, temp_file = FALSE)# 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 <- "." all_precip <- cv_extract_all_basin_daily(netcdf_directory = netcdf_directory, basin_zone_area = basin_areas, temp_file = FALSE)
Extracts daily precipitation or temperature values from CMIP6 NetCDF files, and calculates the mean 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 values when computing the basin mean.
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 daily values.
cv_extract_mean_basin_daily( netcdf_directory = ".", scenario = "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_", basin_zone_area = NULL, temp_file = TRUE )cv_extract_mean_basin_daily( netcdf_directory = ".", scenario = "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_", basin_zone_area = NULL, temp_file = TRUE )
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. The first character of the scenario name is used to determine the name of the variable returned. |
basin_zone_area |
Required. A list object returned by |
temp_file |
If |
Returns a data frame with 2 columns: date and either precipitation or
temperature, depending on the scenario name. The
date is a standard R date over the interval 2015-01-01 to 2100-12-31, and the
precipitation or temperature is the basin mean value for each date.
Kevin Shook
cv_clip_basin cv_extract_all_basin_daily
# 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_extract_mean_basin_daily(netcdf_directory = netcdf_directory, basin_zone_area = basin_areas, temp_file = FALSE)# 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_extract_mean_basin_daily(netcdf_directory = netcdf_directory, basin_zone_area = basin_areas, temp_file = FALSE)
Extracts a daily time series from a single CMIP6 raster location, which can
be used to compare the CMIP6 values against station values. The location
of the data in the CMIP6 data (its zone and raster location) is found using
cv_find_point.
cv_extract_point_daily( variable_file_name = NULL, grid_lon = NULL, grid_lat = NULL )cv_extract_point_daily( variable_file_name = NULL, grid_lon = NULL, grid_lat = NULL )
variable_file_name |
Required. String containing the name of the NetCDF file with the CMIP6 daily precipitation or temperature, including the file path. |
grid_lon |
Required. Longitude of the grid cell containing the location,
as returned by |
grid_lat |
Required. Latitude of grid cell containing the location,
as returned by |
Returns a data frame with 2 columns: date and either precipitation
or temperature, depending on the file name. The
date is a standard R date over the interval 2015-01-01 to 2100-12-31, and the
precipitation or temperature is the value at the specified grid location. The returned time series
can be plotted using
cv_plot_TS, cv_plot_prob, and cv_plot_season.
Kevin Shook
cv_find_point cv_extract_all_basin_daily cv_extract_mean_basin_daily
## Not run: point_long <- -110.456 point_lat <- 52.19 point_loc <- cv_find_point(point_long, point_lat) point_loc precip_file <- "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_07.nc" grid_lon <- point_loc[1] grid_lat <- point_loc[2] point_precip <- cv_extract_point_daily(precip_file, grid_lon, grid_lat) ## End(Not run)## Not run: point_long <- -110.456 point_lat <- 52.19 point_loc <- cv_find_point(point_long, point_lat) point_loc precip_file <- "pr_day_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231_cannc_SPQM_07.nc" grid_lon <- point_loc[1] grid_lat <- point_loc[2] point_precip <- cv_extract_point_daily(precip_file, grid_lon, grid_lat) ## End(Not run)
Finds the closest CMIP6 raster location (zone and raster longitude and latitude) to a point specified by its longitude and latitude. The distances from the raster centres are found using functions from geosphere.
cv_find_point(longitude, latitude, fast = TRUE)cv_find_point(longitude, latitude, fast = TRUE)
longitude |
Required. Longitude (decimal degrees) of the point |
latitude |
Required. Latitude (decimal degrees) of the point |
fast |
Optional. If |
Returns a vector containing the raster cell coordinates (grid_lon,
grid_lat), zone number (zone), cell area (area) in
km and the distance (distance) between the between the point and cell centre (m).
Kevin Shook
{ point_long <- -110.456 point_lat <- 52.195 point_loc <- cv_find_point(point_long, point_lat) point_loc }{ point_long <- -110.456 point_lat <- 52.195 point_loc <- cv_find_point(point_long, point_lat) point_loc }
Plots the exceedance probabilities of non-zero values in a precipitation time
series as returned by cv_extract_mean_basin_daily(), vs the precipitation value.
Uses a logarithmic scale for the y-axis.
cv_plot_prob(data)cv_plot_prob(data)
data |
A data frame with two columns: |
A ggplot object displaying the probability of exceedance of nonzero precipitation. The returned plots look best when saved at the size 16.5 x 12 cm. You can easily change the font sizes using theme().
cv_extract_mean_basin_daily cv_plot_TS cv_plot_season
cv_plot_prob(eg_TS)cv_plot_prob(eg_TS)
Creates seasonal plots of a precipitation time series, as returned by cv_basin_daily_precip(). Assigns seasons based on the month,
computes the proportion of zero precipitation values (P0) and seasonal means for nonzero precipitation,
and generates a violin plot showing the seasonal distribution of precipitation.
cv_plot_season(data)cv_plot_season(data)
data |
A data frame with two columns: |
A ggplot object displaying the seasonal distribution of nonzero precipitation, with mean values and P0 labelled. The returned plots look best when saved at the size 16.5 x 14 cm. You can easily change the font sizes using theme().
cv_extract_mean_basin_daily cv_plot_TS cv_plot_prob
cv_plot_season(eg_TS)cv_plot_season(eg_TS)
Creates a time series plot from a data frame of precipitation data
as returned by cv_extract_mean_basin_daily(). Basic statistics (mean, standard deviation, and proportion of zero values),
are added to the title of the plot.
cv_plot_TS(data)cv_plot_TS(data)
data |
A data frame with two columns: |
A ggplot object displaying the precipitation time series with summary statistics in the title. The returned plots look best when saved at the size 16.5 x 6 cm You can easily change the font sizes using theme().
cv_extract_mean_basin_daily cv_plot_prob cv_plot_season
cv_plot_TS(eg_TS)cv_plot_TS(eg_TS)
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
cv_zone_area_raster()cv_zone_area_raster()
Returns a terra SpatRaster object (415 rows x 883 columns x 2 layers) of all Canadian grid locations.
Heba Abdelmoaty Kevin Shook
zone_area_grid <- cv_zone_area_raster() library(terra) plot(zone_area_grid)zone_area_grid <- cv_zone_area_raster() library(terra) plot(zone_area_grid)
A dataframe containing daily precipitation time series for a basin.
eg_TSeg_TS
A dataframe with 31,411 rows and 2 columns.
This timeseries represents a weighted average daily precipitation time series over the basin given in the package. It comes from one simulation of the CMIP6 model ACCESS-CM2 under the SSP1-2.6 scenario.
Variables:
Date of the observation (YYYY-MM-DD format)
Daily precipitation amount (mm)
CMIP6 simulation: "_ACCESS-CM2_ssp126_r2i1p1f1_gn_20150101-21001231"
A dataframe of zone values and areas for all CMIP6 grid cells
zone_grid_dfzone_grid_df
A dateframe with 169584 rows and 4 columns.
Variables:
Longitude
Latitude
Zone (0-9)
Grid cell area km
https://doi.org/10.20383/103.0829