|
1 | | -# Climate Cube Math |
| 1 | +# CubeDynamics (`cubedynamics`) |
2 | 2 |
|
3 | | -`cubedynamics` provides streaming access to climate data cubes plus reusable |
4 | | -statistics, vegetation-index helpers, and QA visualizations for understanding |
5 | | -Sentinel-2, GRIDMET, PRISM, and related datasets. This repository also |
6 | | -includes a MkDocs site and reproducible vignette that document the package. |
| 3 | +CubeDynamics is a streaming-first climate cube math library for building |
| 4 | +multi-source climate data cubes (PRISM, gridMET, NDVI/Sentinel, etc.) and |
| 5 | +computing correlations, variance, and trends without downloading entire |
| 6 | +collections. |
| 7 | + |
| 8 | +## Features |
| 9 | + |
| 10 | +- **Streaming and chunked access** to climate datasets so analyses can begin |
| 11 | + before downloads finish. |
| 12 | +- **Climate lexcubes** – multi-dimensional cubes of climate statistics for |
| 13 | + comparing vegetation, weather, and derived metrics over shared axes. |
| 14 | +- **Correlation, synchrony, and variance cubes** that summarize temporal |
| 15 | + patterns such as drought stress, phenology shifts, and teleconnections. |
| 16 | +- **Notebook-friendly helpers** for Jupyter, VS Code, and workflow runners. |
| 17 | +- **Cloud and big-data ready** primitives that lean on `xarray`, `dask`, and |
| 18 | + lazy execution. |
7 | 19 |
|
8 | 20 | ## Installation |
9 | 21 |
|
10 | | -You can install the latest library directly from the repository: |
| 22 | +Once the package is published on PyPI you will be able to install it with: |
| 23 | + |
| 24 | +```bash |
| 25 | +pip install cubedynamics |
| 26 | +``` |
| 27 | + |
| 28 | +Until then install directly from GitHub: |
11 | 29 |
|
12 | 30 | ```bash |
13 | | -pip install git+https://github.com/CU-ESIIL/climate_cube_math.git |
| 31 | +pip install "git+https://github.com/CU-ESIIL/climate_cube_math.git@main" |
14 | 32 | ``` |
15 | 33 |
|
16 | | -During development use an editable install from the repo root: |
| 34 | +Developers can work against the repo in editable mode: |
17 | 35 |
|
18 | 36 | ```bash |
19 | 37 | python -m pip install -e . |
20 | 38 | ``` |
21 | 39 |
|
22 | | -## Quick start |
| 40 | +## Quickstart |
23 | 41 |
|
24 | 42 | ```python |
25 | 43 | import cubedynamics as cd |
26 | 44 |
|
27 | | -s2 = cd.load_s2_cube( |
28 | | - lat=43.89, |
29 | | - lon=-102.18, |
30 | | - start="2023-06-01", |
31 | | - end="2023-09-30", |
32 | | - edge_size=512, |
| 45 | +# Example: stream a gridMET cube for a region and compute a variance cube |
| 46 | +cube = cd.stream_gridmet_to_cube( |
| 47 | + aoi_geojson, |
| 48 | + variable="pr", |
| 49 | + dates=("2000-01", "2020-12"), |
33 | 50 | ) |
34 | | - |
35 | | -ndvi = cd.compute_ndvi_from_s2(s2) |
36 | | -ndvi_z = cd.zscore_over_time(ndvi) |
37 | | -``` |
38 | | - |
39 | | -The same package still ships the ruled time hull helpers used in the training |
40 | | -materials: |
41 | | - |
42 | | -* `cubedynamics.demo.make_demo_event()` builds a small GeoDataFrame that mimics |
43 | | - how a fire perimeter evolves through time. |
44 | | -* `cubedynamics.hulls.plot_ruled_time_hull()` converts that data into a 3D ruled |
45 | | - surface so the temporal pattern can be inspected visually. |
46 | | - |
47 | | -## Documentation and vignette |
48 | | - |
49 | | -The public website is generated from the `docs/` folder using MkDocs Material |
50 | | -and includes: |
51 | | - |
52 | | -1. A concise landing page that explains the project goals. |
53 | | -2. A rendered copy of `docs/vignette.ipynb` so visitors can step through the |
54 | | - example without leaving the site. |
55 | | -3. An API reference driven by `mkdocstrings` that documents the core |
56 | | - `cubedynamics` modules. |
57 | | - |
58 | | -To preview the site locally run: |
59 | | - |
60 | | -```bash |
61 | | -mkdocs serve |
| 51 | +var_cube = cd.variance_cube(cube) |
| 52 | +var_cube.to_netcdf("gridmet_variance.nc") |
62 | 53 | ``` |
63 | 54 |
|
64 | | -## Repository layout |
65 | | - |
66 | | -``` |
67 | | -code/cubedynamics/ # installable Python package |
68 | | - data/ # Sentinel-2, GRIDMET, PRISM loaders |
69 | | - indices/ # vegetation index helpers |
70 | | - stats/ # anomaly, rolling, correlation utilities |
71 | | - viz/ # QA and lexcube visualization helpers |
72 | | - utils/ # chunking, reference pixel helpers |
73 | | - demo.py # demo GeoDataFrame generator |
74 | | - hulls.py # ruled time hull plotting helper |
75 | | - __init__.py |
76 | | -
|
77 | | -docs/ |
78 | | - index.md # landing page |
79 | | - api.md # mkdocstrings API reference |
80 | | - vignette.ipynb # notebook rendered on the site |
81 | | - stylesheets/ |
82 | | - extra.css # small cosmetic tweaks for MkDocs Material |
83 | | -
|
84 | | -.github/workflows/pages.yml # deploys the docs site to GitHub Pages |
85 | | -mkdocs.yml # MkDocs configuration |
86 | | -pyproject.toml # package metadata |
87 | | -``` |
| 55 | +Additional helpers can build NDVI z-score cubes, compute rolling correlation vs |
| 56 | +an anchor pixel, or export “lexcubes” for downstream dashboards. Follow the docs |
| 57 | +for more end-to-end examples while the streaming implementations are finalized. |
88 | 58 |
|
89 | | -With this layout you only need to touch two places when extending the project: |
90 | | -add or update Python modules inside `code/cubedynamics/` and describe those |
91 | | -changes through Markdown or notebooks in `docs/`. |
| 59 | +## Documentation |
92 | 60 |
|
93 | | -## Installation |
| 61 | +Full documentation: https://cu-esiil.github.io/climate_cube_math/ |
94 | 62 |
|
95 | | -For the streaming-first package preview install directly from GitHub: |
| 63 | +The GitHub Pages site hosts the narrative docs, quickstart, concepts, and API |
| 64 | +notes for CubeDynamics. Use `mkdocs serve` to preview changes locally. |
96 | 65 |
|
97 | | -```bash |
98 | | -pip install "git+https://github.com/CU-ESIIL/climate_cube_math.git@main" |
99 | | -``` |
| 66 | +## Contributing |
100 | 67 |
|
101 | | -Once published to PyPI the goal is to allow a simple install: |
| 68 | +Contributions are welcome! Open an issue or pull request if you would like to |
| 69 | +add new data sources, improve the streaming primitives, or expand the |
| 70 | +statistical recipes. Please keep tests streaming-first (favor chunked I/O and |
| 71 | +mocked responses when possible) and include documentation updates alongside code |
| 72 | +changes. |
102 | 73 |
|
103 | | -```bash |
104 | | -pip install cubedynamics |
105 | | -``` |
| 74 | +## Citation |
106 | 75 |
|
107 | | -`cubedynamics` follows a streaming-first philosophy that prefers chunked IO over |
108 | | -full downloads. The accompanying pytest suite encodes this expectation by |
109 | | -running streaming markers by default and skipping download-marked tests unless |
110 | | -explicitly requested. |
| 76 | +If you use CubeDynamics in academic work, cite the project using the metadata in |
| 77 | +[`CITATION.cff`](CITATION.cff). A formal publication is planned; until then |
| 78 | +please cite the software release and repository. |
0 commit comments