1) Get familiar with caladaptR
2) Hands-on practice with:
a) importing Cal-Adapt into R via the API
b) best practices for working with climate data
c) data wrangling for visualization or analysis
d) working with climate data as rasters
3) Working Code Recipes
a) R Notebooks
b) Climate Data Cookbook:
foundational concepts
+ code recipes
+ working examples
+ practice
Cal-Adapt is California’s official portal for peer-reviewed climate data.
Datasets are selected with guidance and priorities from California State agencies.
Spatial extent of LOCA downscaled climate data layers:
Feature | Cal-Adapt website | Cal-Adapt FTP | caladapt-py | caladaptR |
Download rasters | ||||
Statewide | ✔ | ✔ | ✔ | ✔ |
User area-of-interest | ✔ | ✔ | ✔ | |
10 recommended GCMs | ✔ | ✔ | ✔ | ✔ |
All 32 GCMs | ✔ | ✔ | ||
Query features | ||||
Points (user-provided) | ✔ | ✔ | ✔ | |
Lines (user-provided) | ✔ | ✔ | ||
Polygons (user-provided) | ✔ | ✔ | ✔ | |
Polygons (presets, boundary layers) | ✔ | ✔ | ||
Other | ||||
Extract underlying tables from preset charts | ✔ |
More info:
The rolling average of maximum daily temperature will increase by X
Species A, B, & C are most likely to survive in the projected climate envelope.
caladaptr
is an API client package
caladaptR users need to know:
Start here: https://ucanr-igis.github.io/caladaptr/
In general, there are five steps to using caladaptR:
A complete example:
my_cap <- ca_loc_pt(coords = c(-121.4687, 38.5938)) %>%
ca_cvar(c("tasmax", "tasmin")) %>%
ca_gcm(c("HadGEM2-ES", "CNRM-CM5", "CanESM2", "MIROC5")) %>%
ca_scenario(scenarios[1:2]) %>%
ca_period("year") %>%
ca_years(start = 2040, end = 2060)
An API Request object consists of between 2 and 4 components:
1. Location (required, pick one)
ca_loc_aoipreset() | Query a preset location(s) |
ca_loc_pt() | Question point location(s) |
ca_loc_sf() | Query simple feature location(s) |
2. Dataset
Option 1 for downscaled modeled climate data from Scripps (including VIC)
Include all 4 of the following constructor functions:
ca_cvar() | Select the climate variable(s) (i.e., precip, temperature) |
ca_gcm() | Pick or more of the 10 Global Climate Models |
ca_period() | Select temporal aggregation period (year, month, day) |
ca_scenario() | Choose your emission scenario(s) |
Option 2 for Livneh datasets
Include all 3 of the following constructor functions:
ca_cvar() | Select the climate variable(s) (i.e., precip, temperature) |
ca_livneh | TRUE |
ca_period() | Select temporal aggregation period (year, month, day) |
Option 3 for any raster series
Specify any dataset by its ‘slug’:
ca_slug() | Select a dataset by its slug |
To find a slug, see Searching the Cal-Adapt Data Catalog.
3. Start & end dates (optional, pick one)
ca_years() | Specify start & end by year |
ca_dates() | Specify start & end by date |
4. Options (required for polygons)
ca_options() | Spatial aggregation function(s) |
sdzoo_cap <- ca_loc_pt(coords = c(-117.0, 33.1)) %>% ## specify a location
ca_cvar(c("tasmax", "tasmin")) %>% ## climate variables
ca_gcm(gcms[1:4]) %>% ## GCM(s)
ca_scenario(scenarios[1:2]) %>% ## emission scenarios(s)
ca_period("year") %>% ## temporal aggregation period
ca_years(start = 2040, end = 2060) ## start and end dates
## Cal-Adapt API Request
## Location(s):
## x: -117
## y: 33.1
## Variable(s): tasmax, tasmin
## Temporal aggregration period(s): year
## GCM(s): HadGEM2-ES, CNRM-CM5, CanESM2, MIROC5
## Scenario(s): rcp45, rcp85
## Dates: 2040-01-01 to 2060-12-31
##
## General issues
## - none found
## Issues for querying values
## - none found
## Issues for downloading rasters
## - none found
R Notebooks are written in “R Markdown”, which combines text and R code.
Tips
Every time you hit saves, it generates a HTML file in the background.
Remember when you’re in a R Notebook, the working directory is where the Rmd file resides.
Common error:
Error creating notebook: path for html_dependency. Path not found: /tmp/RtmpjR1sPw
In Notebook 1, you will:
Getting Help