https://github.com/brews/stcaf
Prototype framework for sea-level change modeling.
https://github.com/brews/stcaf
package prototype python sealevel
Last synced: over 1 year ago
JSON representation
Prototype framework for sea-level change modeling.
- Host: GitHub
- URL: https://github.com/brews/stcaf
- Owner: brews
- License: apache-2.0
- Created: 2025-03-13T19:20:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-26T23:29:09.000Z (over 1 year ago)
- Last Synced: 2025-03-27T00:26:32.057Z (over 1 year ago)
- Topics: package, prototype, python, sealevel
- Language: Python
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stcaf
[](https://github.com/brews/stcaf/actions/workflows/pythonpackage.yml)
[](https://codecov.io/gh/brews/stcaf)
Prototype framework for sea-level change modeling.
> [!CAUTION]
> This is a prototype. It is likely to change in breaking ways. It might delete all your data. Don't use it in production.
## Examples
This example reads in a NetCDF file with climate fields and applies models projecting components of sea level change, then integrates those components together.
```python
from stcaf import (
build_sealevel_component_model_registry,
Climate,
project_sealevel_components,
integrate_sealevel_components,
)
import xarray as xr
climate = Climate(xr.open_dataset("example_climate_file.nc"))
# Collect sea level component models registered as plugins.
registry = build_sealevel_component_model_registry()
# Run registered models.
components = project_sealevel_components(
climate,
[
registry["stcaf.bump"](),
registry["stcaf.bump"](bump=2.0),
],
)
integrated_sealevel = integrate_sealevel_components(components)
```
The "bump" model is a toy used for testing. It takes input "temperature" and adds 1 to it for each model step: preprocess, fit, project, postprocess. The result is output as "sea_level_change". Setting the `bump` parameter when the model is intialized changes the size of each bump.
Component models can be any object following the `stcaf.SealevelComponentModel` protocol. You can pass these instances in directly or use them through the registry by registering the object at the "stcaf.sealevel_component_models" entrypoint of a Python package. Plugins from installed packages are namespaced by the package name; meaning models are referenced from the registry like `registry["."]` to avoid naming conflicts.
## Installation
Install the unreleased bleeding-edge version of the package with:
```
pip install git+https://github.com/brews/stcaf
```
## Support
Source code is available online at https://github.com/brews/stcaf/. This software is open source and available under the Apache License, Version 2.0.
Please file issues in the issue tracker at https://github.com/brews/stcaf/issues.