Skip to content

Commit

Permalink
Adds demo notebooks (#6)
Browse files Browse the repository at this point in the history
* adds demo notebooks

* changes CI to build off mamba to fix HDF5 error

* update env
  • Loading branch information
norlandrhagen authored Jun 20, 2024
1 parent 0cf349d commit 0ad6723
Show file tree
Hide file tree
Showing 7 changed files with 1,760 additions and 12 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Python
id: setup-python
uses: actions/setup-python@v5
- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml
environment-file: ci/environment.yml
cache-environment: true
create-args: >-
python=${{matrix.python-version}}
- name: Install pangeo-forge-ndpyramid
run: |
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,20 @@
[![CI](https://github.com/carbonplan/python-project-template/actions/workflows/main.yaml/badge.svg)](https://github.com/carbonplan/python-project-template/actions/workflows/main.yaml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)



## Usage

`pangeo-forge-ndpyramid` contains a apache-beam transform named `StoreToPyramid` which can be used with `pangeo-forge-recipes` to generate multiscale Zarr stores.
`pangeo-forge-ndpyramid` contains an apache-beam transform named `StoreToPyramid` which can be used with `pangeo-forge-recipes` to generate multiscale Zarr stores.
The two current implimented `ndpyramid` methods are `reproject` and `resample`.


### Examples

Examples for creating pyramids via pangeo-forge can be found in `notebooks/reproject_demo.ipynb` and `notebooks/resample.ipynb`.



```python

from pangeo_forge_ndpyramid import StoreToPyramid
Expand All @@ -33,7 +44,9 @@ with beam.Pipeline() as p:
target_root=target_root,
store_name='pyramid_store.zarr',
epsg_code='4326',
levels=3,
pyramid_method="resample",
pyramid_kwargs={"x": "longitude", "y": "latitude"},
levels=2,
combine_dims=pattern.combine_dim_keys,
)
)
Expand Down
13 changes: 13 additions & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: pangeo-forge-ndpyramid-tests
channels:
- conda-forge
- nodefaults
dependencies:
- pangeo-forge-recipes
- pip
- dask
- pyresample
- rioxarray
- pip:
- ndpyramid@git+https://github.com/carbonplan/ndpyramid

228 changes: 228 additions & 0 deletions notebooks/reproject_demo.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 0ad6723

Please sign in to comment.