55import xarray as xr
66
77__all__ = [
8- "ExtractionWorkflow " ,
8+ "ExtractionTemplate " ,
99 "GridWeightingRegions" ,
10- "ProjectionWorkflow " ,
10+ "ProjectionTemplate " ,
1111 "RegionExtractor" ,
12- "build_extraction_workflow " ,
13- "build_projection_workflow " ,
12+ "build_extraction_template " ,
13+ "build_projection_template " ,
1414 "extract_regions" ,
1515 "project" ,
1616]
1717
1818
19- class ExtractionWorkflow (Protocol ):
19+ class ExtractionTemplate (Protocol ):
2020 """
2121 Template for pre and post region extraction transformation
2222
2323 See Also
2424 --------
25- build_extraction_workflow : Quickly build extraction workflow from functions for regionalization with pre/post transformations.
26- extract_regions: Apply a workflow to extract a new regionalized dataset from gridded data.
25+ build_extraction_template : Quickly build extraction template from functions for regionalization with pre/post transformations.
26+ extract_regions: Apply a template to extract a new regionalized dataset from gridded data.
2727 RegionExtractor: Protocol for regionalizing, or extracting regions from a dataset.
2828 """
2929
@@ -46,8 +46,8 @@ class RegionExtractor(Protocol):
4646
4747 See Also
4848 --------
49- extract_regions: Apply a workflow to extract a new regionalized dataset from gridded data with pre/post transformations.
50- ExtractionWorkflow : Technical protocol for a workflow with pre/post regionalization transformations.
49+ extract_regions: Apply a template to extract a new regionalized dataset from gridded data with pre/post transformations.
50+ ExtractionTemplate : Technical protocol for a workflow with pre/post regionalization transformations.
5151 """
5252
5353 def extract_regions (self , ds : xr .Dataset ) -> xr .Dataset :
@@ -59,18 +59,18 @@ def extract_regions(self, ds: xr.Dataset) -> xr.Dataset:
5959
6060# This dataclass is a quick and simple way to get a concrete instance of the protocol.
6161@dataclass (frozen = True )
62- class _SimpleExtractionWorkflow ( ExtractionWorkflow ):
62+ class _SimpleExtractionTemplate ( ExtractionTemplate ):
6363 pre_extract : Callable [[xr .Dataset ], xr .Dataset ]
6464 post_extract : Callable [[xr .Dataset ], xr .Dataset ]
6565
6666
67- def build_extraction_workflow (
67+ def build_extraction_template (
6868 * , pre : Callable [[xr .Dataset ], xr .Dataset ], post : Callable [[xr .Dataset ], xr .Dataset ]
69- ) -> ExtractionWorkflow :
69+ ) -> ExtractionTemplate :
7070 """
71- Build a workflow of tranformation steps applied to input gridded data, pre/post regionalization, to create a derived variable as output
71+ Build a template of tranformation steps applied to input gridded data, pre/post regionalization, to create a derived variable as output
7272
73- This function is a quick and simple way to build an ExtractionWorkflow from two simple functions.
73+ This function is a quick and simple way to build an ExtractionTemplate from two simple functions.
7474
7575 These steps should be general. They may contain logic for sanity checks
7676 on inputs and outputs, calculating derived variables and climate indices,
@@ -81,11 +81,11 @@ def build_extraction_workflow(
8181
8282 See Also
8383 --------
84- extract_regions: Apply a workflow to extract a new regionalized dataset from gridded data.
85- build_extraction_workflow : Quickly build extraction workflow from functions for regionalization.
86- ExtractionWorkflow : The underlaying protocol for a workflow that extracts a regionalized dataset.
84+ extract_regions: Apply a template to extract a new regionalized dataset from gridded data.
85+ build_extraction_template : Quickly build extraction template from functions for regionalization.
86+ ExtractionTemplate : The underlaying protocol for a workflow that extracts a regionalized dataset.
8787 """
88- return _SimpleExtractionWorkflow (pre_extract = pre , post_extract = post )
88+ return _SimpleExtractionTemplate (pre_extract = pre , post_extract = post )
8989
9090
9191# Use class for segment weights because we're making assumptions/enforcements about the weight data's content and interactions...
@@ -102,8 +102,8 @@ class GridWeightingRegions(RegionExtractor):
102102
103103 See Also
104104 --------
105- extract_regions: Use SegmentWeights in a workflow to extract new regionalized dataset.
106- build_extraction_workflow : Quickly build extraction workflow from functions for regionalization.
105+ extract_regions: Extract new regionalized dataset.
106+ build_extraction_template : Quickly build extraction template from functions for regionalization.
107107 RegionExtractor: Protocol for regionalizing, or extracting regions from a dataset.
108108 """
109109
@@ -133,27 +133,27 @@ def extract_regions(self, ds: xr.Dataset) -> xr.Dataset:
133133
134134
135135def extract_regions (
136- ds : xr .Dataset , * , workflow : ExtractionWorkflow , regions : RegionExtractor
136+ ds : xr .Dataset , * , template : ExtractionTemplate , regions : RegionExtractor
137137) -> xr .Dataset :
138138 """
139- Use transformations in 'workflow ' to extract 'regions' from gridded dataset, 'ds', returning a regionalized dataset
139+ Use transformations in 'template ' to extract 'regions' from gridded dataset, 'ds', returning a regionalized dataset
140140
141- This function specifically does not just regionalize through zonal aggregation. It uses 'workflow ' to apply pre/post regionalization transformations to create new datasets and variables.
141+ 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.
142142
143143 See Also
144144 --------
145- build_extraction_workflow : Quickly build extraction workflow from functions for regionalization.
145+ build_extraction_template : Quickly build extraction workflow from functions for regionalization.
146146 """
147- return workflow .post_extract (regions .extract_regions (workflow .pre_extract (ds )))
147+ return template .post_extract (regions .extract_regions (template .pre_extract (ds )))
148148
149149
150- class ProjectionWorkflow (Protocol ):
150+ class ProjectionTemplate (Protocol ):
151151 """
152152 Template for projecting a model with pre and post processing.
153153
154154 See Also
155155 --------
156- build_projection_workflow : Build a projection workflow from simple functions.
156+ build_projection_template : Build a projection template from simple functions.
157157 """
158158
159159 def pre_project (self , d : xr .Dataset ) -> xr .Dataset :
@@ -177,43 +177,43 @@ def post_project(self, d: xr.Dataset) -> xr.Dataset:
177177
178178# This dataclass is a quick and simple way to get a concrete instance of the protocol.
179179@dataclass (frozen = True )
180- class _SimpleProjectionWorkflow ( ProjectionWorkflow ):
180+ class _SimpleProjectionTemplate ( ProjectionTemplate ):
181181 pre_project : Callable [[xr .Dataset ], xr .Dataset ]
182182 project : Callable [[xr .Dataset ], xr .Dataset ]
183183 post_project : Callable [[xr .Dataset ], xr .Dataset ]
184184
185185
186- def build_projection_workflow (
186+ def build_projection_template (
187187 * ,
188188 pre : Callable [[xr .Dataset ], xr .Dataset ],
189189 project : Callable [[xr .Dataset ], xr .Dataset ],
190190 post : Callable [[xr .Dataset ], xr .Dataset ],
191- ) -> ProjectionWorkflow :
191+ ) -> ProjectionTemplate :
192192 """
193193 Use simple functions to quickly build a model to project effects, impacts and/or damages.
194194
195- This function is a quick and simple way to build an ProjectionWorkflow from three simple functions.
195+ This function is a quick and simple way to build an ProjectionTemplate from three simple functions.
196196
197197 See Also
198198 --------
199- project: Apply a projection workflow to a dataset.
200- ProjectionWorkflow : Technical ProjectionWorkflow protocol.
199+ project: Apply a projection template to a dataset.
200+ ProjectionTemplate : Technical ProjectionTemplate protocol.
201201 """
202- return _SimpleProjectionWorkflow (
202+ return _SimpleProjectionTemplate (
203203 pre_project = pre ,
204204 project = project ,
205205 post_project = post ,
206206 )
207207
208208
209- def project (d : xr .Dataset , * , model : ProjectionWorkflow ) -> xr .Dataset :
209+ def project (d : xr .Dataset , * , model : ProjectionTemplate ) -> xr .Dataset :
210210 """
211211 Project a dataset of predictors, 'd', with 'model' to return a projected dataset
212212
213213 See Also
214214 --------
215- build_projection_workflow : Build a projection workflow from simple functions.
216- ProjectionWorkflow : Technical ProjectionWorkflow protocol.
215+ build_projection_template : Build a projection template from simple functions.
216+ ProjectionTemplate : Technical ProjectionTemplate protocol.
217217 """
218218 preprocessed = model .pre_project (d )
219219 projected = model .project (preprocessed )
0 commit comments