API Reference¶
isku
¶
__all__
module-attribute
¶
__all__ = [
"ExtractionTemplate",
"GridWeightingRegions",
"ProjectionTemplate",
"RegionExtractor",
"build_extraction_template",
"build_projection_template",
"extract_regions",
"project",
]
ExtractionTemplate
¶
Bases: Protocol
Template for pre and post region extraction transformation
See Also
build_extraction_template: Quickly build extraction template from functions for regionalization with pre/post transformations. extract_regions: Apply a template to extract a new regionalized dataset from gridded data. RegionExtractor: Protocol for regionalizing, or extracting regions from a dataset.
GridWeightingRegions
¶
Bases: RegionExtractor
Regions that can be extracted from regularly-gridded data after weighting grid points
'weights' dataset must have "lat", "lon", "weight", "region".
Raises:
-
ValueError–If 'weights' is missing "lat", "lon", "weight" or "region" variables.
See Also
extract_regions: Extract new regionalized dataset. build_extraction_template: Quickly build extraction template from functions for regionalization. RegionExtractor: Protocol for regionalizing, or extracting regions from a dataset.
extract_regions
¶
Regionalize input gridded data after multiplying 'ds' by weights and summing the product within each region.
'ds' must have "lat", "lon" coordinates exactly matching "lat", "lon" in weights.
RegionExtractor
¶
Bases: Protocol
Protocol for extracting regions from gridded data
See Also
extract_regions: Apply a template to extract a new regionalized dataset from gridded data with pre/post transformations. ExtractionTemplate: Technical protocol for a workflow with pre/post regionalization transformations.
extract_regions
¶
Extract and aggregate gridded dataset points into regionalized dataset
ProjectionTemplate
¶
Bases: Protocol
Template for projecting a model with pre and post processing.
See Also
build_projection_template: Build a projection template from simple functions.
build_extraction_template
¶
build_extraction_template(
*, pre: Callable[[Dataset], Dataset], post: Callable[[Dataset], Dataset]
) -> ExtractionTemplate
Build a template of tranformation steps applied to input gridded data, pre/post regionalization, to create a derived variable as output
This function is a quick and simple way to build an ExtractionTemplate from two simple functions.
These steps should be general. They may contain logic for sanity checks on inputs and outputs, calculating derived variables and climate indices, adding or checking metadata or units. Avoid including logic for cleaning, or harmonizing input data, especially if it is specific to a single project's usecase. Generally avoid using a single strategy to output multiple unrelated variables.
See Also
extract_regions: Apply a template to extract a new regionalized dataset from gridded data. build_extraction_template: Quickly build extraction template from functions for regionalization. ExtractionTemplate: The underlaying protocol for a workflow that extracts a regionalized dataset.
extract_regions
¶
extract_regions(
ds: Dataset, *, template: ExtractionTemplate, regions: RegionExtractor
) -> Dataset
Use transformations in 'template' to extract 'regions' from gridded dataset, 'ds', returning a regionalized dataset
This function specifically does not just regionalize through zonal aggregation. It uses 'template' to apply pre/post regionalization transformations to create new datasets and variables.
See Also
build_extraction_template: Quickly build extraction workflow from functions for regionalization.
build_projection_template
¶
build_projection_template(
*,
pre: Callable[[Dataset], Dataset],
project: Callable[[Dataset], Dataset],
post: Callable[[Dataset], Dataset],
) -> ProjectionTemplate
Use simple functions to quickly build a model to project effects, impacts and/or damages.
This function is a quick and simple way to build an ProjectionTemplate from three simple functions.
See Also
project: Apply a projection template to a dataset. ProjectionTemplate: Technical ProjectionTemplate protocol.