A common framework#
or more verbosely:
A common framework for developing post-processing methods#
Context#
xsnow is the powerful link between snow cover simulation datasets and sophisticated post-processing tools that assess avalanche hazard-relevant metrics from the raw data. As such, its scope is well-defined:
Read and write simulation data into
an efficient and flexible data model, as well as
Facilitate a flexible application of post-processing tools
in an easy-to-share manner.
While the first two objectives are described in detail in the xsnow tutorials, this part focuses on the latter two—xsnow’s extension strategy that allows everybody in the community to write their own post-processing algorithms and analysis workflows on top of xsnow’s powerful base.
Objectives#
The objectives of the extension strategy are to
Create a common framework for developing post-processing methods
Provide guidelines for building extensions to the
xsnowpackageShow how to extend xsnow’s core data class
xsnowDatasetwith custom dimensions and variables for post-processed dataEnable a flexible, consistent structure for computing, storing, and accessing post-processed data
Principles of the extension strategy#
Customization: Every stakeholder (research group, warning agency) can implement an extension that satisfies their need.
Independence: Anyone can implement extensions on their platforms and keep them private or share them publicly with the community.
Specificity: xsnow provides a flexible yet lean foundation, and everyone can extend that base with exactly the extensions they need without having to deal with unwanted extensions, unused dimensions, or cluttered method registries.
Chainability: Extensions can be chained in the desired order to facilitate the user workflow.
Built-in extensions versus externally hosted extensions#
xsnow ships several built-in extensions. They act as templates for other extensions, and, more importantly, they extend xsnow’s core functionality with generic features that we expect a wider audience to benefit from. Ideally, these built-in extensions are generic, customizable, and modular enough that they won’t change much over time.
More experimental extensions or those that implement specific hardcoded workflows should remain hosted outside the xsnow repository. Similarly, extensions that are sensitive to specific versions of their dependencies need to be hosted externally (e.g., this may be the case for machine learning models that were fit with a specific dependency version).
Application scenarios that require extensions to xsnow#
Three application scenarios
Adding new data variables that perfectly fit into the existing
xsnowDatasetstructure, such asScalars: HN24, HN72, HST, wind runs, etc
Layer properties: p_unstable, new stability indices, etc.
Adding new data streams and functionality beyond the existing
xsnowDatasetstructure, often adding new dimensions to the data model.Altering the existing core dimensions before applying scenarios 1 or 2, such as
aggregating existing locations into polygons and storing summary statistics about them.
You will find recipes for achieving these three objectives in:
Scenario 1: Adding new data variables
Scenario 2: Adding new functionality
Scneario 3: Altering the core dimensions