Skip to content

Phenocam

This module contains functionality to download and load data from phenocam observations (https://phenocam.nau.edu/webcam/) using phenocamr as client.

Requires phenocamr R package. Install with

install.packages("phenocamr")
Example
from springtime.datasets import PhenocamrSite

dataset = PhenocamrSite(
    site="harvard$",
    years=(2019, 2020),
)
dataset.download()
df = dataset.load()
Example
from springtime.datasets import PhenocamrBoundingBox

dataset = PhenocamrBoundingBox(
    area={
        "name": "harvard",
        "bbox": [-73, 42, -72, 43],
    },
    years=(2019, 2020),
)
dataset.download()
df = dataset.load()

PhenocamVariables = Literal['midday_r', 'midday_g', 'midday_b', 'midday_gcc', 'midday_rcc', 'r_mean', 'r_std', 'g_mean', 'g_std', 'b_mean', 'b_std', 'gcc_mean', 'gcc_std', 'gcc_50', 'gcc_75', 'gcc_90', 'rcc_mean', 'rcc_std', 'rcc_50', 'rcc_75', 'rcc_90', 'max_solar_elev', 'smooth_gcc_mean', 'smooth_gcc_50', 'smooth_gcc_75', 'smooth_gcc_90', 'smooth_rcc_mean', 'smooth_rcc_50', 'smooth_rcc_75', 'smooth_rcc_90', 'smooth_ci_gcc_mean', 'smooth_ci_gcc_50', 'smooth_ci_gcc_75', 'smooth_ci_gcc_90', 'smooth_ci_rcc_mean', 'smooth_ci_rcc_50', 'smooth_ci_rcc_75', 'smooth_ci_rcc_90'] module-attribute

Variables available in phenocamr.

Phenocam

Bases: Dataset

Download and load data from phenocam

Attributes:

Name Type Description
years

timerange. For example years=[2000, 2002] downloads data for three years.

resample

Resample the dataset to a different time resolution. If None, no resampling.

veg_type Optional[str]

Vegetation type (DB, EN). Default is "all".

frequency Literal['1', '3', 'roistats']

Frequency of the time series product.

variables Sequence[PhenocamVariables]

Variables you want to download. When empty will download all the variables.

download() abstractmethod

Download the data.

Only downloads if data is not in CONFIG.cache_dir or CONFIG.force_override is TRUE.

load() abstractmethod

Load the dataset from disk into memory.

This may include pre-processing operations as specified by the context, e.g. filter certain variables, remove data points with too many NaNs, reshape data.

PhenocamrSite

Bases: Phenocam

PhenoCam time series for site.

Attributes:

Name Type Description
veg_type

Vegetation type (DB, EN). Default is "all".

frequency

Frequency of the time series product.

variables

Variables you want to download. When empty will download all the variables.

site str

Name of site. Append $ to get exact match.

rois Optional[List[int]]

The id of the ROI to download. Default is all ROIs at site.

years Optional[List[int]]

timerange. For example years=[2000, 2002] downloads data for three years.

resample Optional[List[int]]

Resample the dataset to a different time resolution. If None, no resampling.

download()

Download the data.

Only downloads if data is not in CONFIG.cache_dir or CONFIG.force_override is TRUE.

load()

Load the dataset from disk into memory.

This may include pre-processing operations as specified by the context, e.g. filter certain variables, remove data points with too many NaNs, reshape data.

PhenocamrBoundingBox

Bases: Phenocam

PhenoCam time series for sites in a bounding box.

Attributes:

Name Type Description
years

timerange. For example years=[2000, 2002] downloads data for three years.

resample

Resample the dataset to a different time resolution. If None, no resampling.

veg_type

Vegetation type (DB, EN). Default is "all".

frequency

Frequency of the time series product.

variables

Variables you want to download. When empty will download all the variables.

area NamedArea

A dictionary of the form {"name": "yourname", "bbox": [xmin, ymin, xmax, ymax]}.

download()

Download the data.

Only downloads if data is not in CONFIG.cache_dir or CONFIG.force_override is TRUE.

load()

Load the dataset from disk into memory.

This may include pre-processing operations as specified by the context, e.g. filter certain variables, remove data points with too many NaNs, reshape data.

list_sites()

List of phenocam sites.

Returns:

Type Description
geopandas.GeoDataFrame

Data frame containing phenocam sites

list_rois()

List of phenocam regions of interest (ROI).

Returns:

Type Description
geopandas.GeoDataFrame

Data frame containing phenocam Regions of Interest.