Skip to content

Commit

Permalink
Merge branch 'main' into split-levels
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones committed Jan 12, 2024
2 parents 708296f + 97c90ba commit c90077a
Show file tree
Hide file tree
Showing 21 changed files with 342 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: 'monthly'
interval: "monthly"
39 changes: 39 additions & 0 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: codspeed-benchmarks

on:
# Run on pushes to the main branch
push:
branches:
- "main"
# Run on pull requests
pull_request:
# `workflow_dispatch` allows CodSpeed to trigger backtest
# performance analysis in order to generate initial data.
workflow_dispatch:

jobs:
benchmarks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
with:
# environment-file is not assumed anymore
environment-file: ci/environment.yml
create-args: >-
python=3.10
# now called cache-environment
cache-environment: true

- name: Install package
run: |
python -m pip install . --no-deps
- name: Conda list information
run: |
conda env list
conda list
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
16 changes: 10 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Daily “At 00:00”
- cron: "0 0 * * *" # Daily “At 00:00”

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -23,20 +23,24 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10'] #TODO: add 3.11 once sparse/numba support it
python-version: ["3.9", "3.10"] #TODO: add 3.11 once sparse/numba support it
timeout-minutes: 20
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Install Conda environment from environment.yml
uses: mamba-org/provision-with-micromamba@main
uses: mamba-org/setup-micromamba@v1
with:
# environment-file is not assumed anymore
environment-file: ci/environment.yml
cache-downloads: true
extra-specs: |
create-args: >-
python=${{ matrix.python-version }}
# now called cache-environment
cache-environment: true

- name: Install package
run: |
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'carbonplan/ndpyramid'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.9
Expand All @@ -39,7 +39,7 @@ jobs:
else
echo "✅ Looks good"
fi
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist
Expand All @@ -48,11 +48,11 @@ jobs:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: 3.9
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
Expand All @@ -73,12 +73,12 @@ jobs:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
- name: Publish package to PyPI
uses: pypa/[email protected].8
uses: pypa/[email protected].11
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -16,17 +16,17 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.276'
rev: "v0.1.9"
hooks:
- id: ruff
args: ['--fix']
args: ["--fix"]

- repo: https://github.com/keewis/blackdoc
rev: v0.3.8
rev: v0.3.9
hooks:
- id: blackdoc

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
rev: v4.0.0-alpha.8
hooks:
- id: prettier
23 changes: 23 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "mambaforge-4.10"

# Build documentation in the doc/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally declare the Python requirements required to build your docs
conda:
environment: ci/doc.yml
python:
install:
- method: pip
path: .
28 changes: 12 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<p align='left'>
<a href='https://carbonplan.org/#gh-light-mode-only'>
<img
src='https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png'
height='48px'
/>
</a>
<a href='https://carbonplan.org/#gh-dark-mode-only'>
<img
src='https://carbonplan-assets.s3.amazonaws.com/monogram/light-small.png'
height='48px'
/>
</a>
<p align="left" >
<a href='https://carbonplan.org'>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://carbonplan-assets.s3.amazonaws.com/monogram/light-small.png">
<img alt="CarbonPlan monogram." height="48" src="https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png">
</picture>
</a>
</p>

# ndpyramid

A small utility for generating ND array pyramids using Xarray and Zarr.

[![CI](https://github.com/carbonplan/ndpyramid/actions/workflows/main.yaml/badge.svg)](https://github.com/carbonplan/ndpyramid/actions/workflows/main.yaml)
![MIT License](https://badgen.net/badge/license/MIT/blue)
![PyPI](https://img.shields.io/pypi/v/ndpyramid)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/ndpyramid.svg)](https://anaconda.org/conda-forge/ndpyramid)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

# installation

Expand Down Expand Up @@ -74,8 +70,8 @@ See the docstrings for more details about input parameters and options.

## license

All the code in this repository is [MIT](https://choosealicense.com/licenses/mit/) licensed, but we request that you please provide attribution if reusing any of our digital content (graphics, logo, articles, etc.).
All the code in this repository is [MIT](https://choosealicense.com/licenses/mit/)-licensed, but we request that you please provide attribution if reusing any of our digital content (graphics, logo, articles, etc.).

## about us

CarbonPlan is a non-profit organization working on the science and data of carbon removal. We aim to improve the transparency and scientific integrity of carbon removal and climate solutions through open data and tools. Find out more at [carbonplan.org](https://carbonplan.org/) or get in touch by [opening an issue](https://github.com/carbonplan/ndpyramid/issues/new) or [sending us an email](mailto:[email protected]).
CarbonPlan is a nonprofit organization that uses data and science for climate action. We aim to improve the transparency and scientific integrity of climate solutions with open data and tools. Find out more at [carbonplan.org](https://carbonplan.org/) or get in touch by [opening an issue](https://github.com/carbonplan/ndpyramid/issues/new) or [sending us an email](mailto:[email protected]).
14 changes: 14 additions & 0 deletions ci/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: ndpyramid-docs
channels:
- conda-forge
- nodefaults
dependencies:
- python=3.9
- pre-commit
- pip
- sphinx>=5.0
- sphinx-book-theme >= 0.3.0
- numpydoc
- myst-parser
- pip:
- -e ..
3 changes: 3 additions & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
- numpy
- pip
- pooch
- pre-commit
- pydantic>=1.10
- pyproj
- pytest
Expand All @@ -24,3 +25,5 @@ dependencies:
- xesmf
- zarr
- cf_xarray>=0.8.0
- pip:
- pytest-codspeed
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ codecov:
comment: false

ignore:
- 'tests/*.py'
- 'setup.py'
- "tests/*.py"
- "setup.py"

coverage:
precision: 2
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Binary file added docs/_static/monogram-dark-cropped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/monogram-light-cropped.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
api
===

.. currentmodule:: ndpyramid


Top level API
~~~~~~~~~~~~~

.. autosummary::
:toctree: generated/

pyramid_coarsen
pyramid_reproject
pyramid_regrid
59 changes: 59 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information


import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# sys.path.insert(os.path.abspath('..'))

print('python exec:', sys.executable)
print('sys.path:', sys.path)


project = 'ndpyramid'
copyright = '2023, carbonplan'
author = 'carbonplan'
release = 'v0.1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',]

autosummary_generate = True


templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# Sphinx project configuration
source_suffix = ['.rst', '.md']


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output


html_title = 'ndpyarmid'
html_theme_options = {
'logo': {
'image_light': '_static/monogram-dark-cropped.png',
'image_dark': '_static/monogram-light-cropped.png',
}
}
html_theme = 'sphinx_book_theme'
html_title = ''
repository = 'carbonplan/ndpyarmid'
repository_url = 'https://github.com/carbonplan/ndpyramid'

html_static_path = ['_static']
Loading

0 comments on commit c90077a

Please sign in to comment.