Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyinterp shim #47

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7091407
fixed yaml
kthyng Sep 8, 2021
ea39c36
fixed yaml
kthyng Sep 8, 2021
e8a8e33
mock imports to try to get docs to work
kthyng Sep 8, 2021
bbdda38
hopefully fix for docs
kthyng Sep 14, 2021
69a1b95
precommit changes
kthyng Sep 14, 2021
d56919c
try to fix docs env in case that is problem
kthyng Sep 14, 2021
1a8e0e0
maybe this will help
kthyng Sep 14, 2021
bd9a335
readthedocs yml revert
kthyng Sep 14, 2021
af0decc
Add rough support for Pyinterp for systems without xesmf.
yosoyjay Feb 23, 2022
7a291ff
support for python < 3.9 + skip xesmf tests if not installed
yosoyjay Mar 7, 2022
eff1992
add support for emulating locstream using pyinterp for omsa demo
yosoyjay Mar 17, 2022
0883630
Add temp pyinterp shim
yosoyjay Mar 17, 2022
b7f9742
[wip] update interp methods + more type hints
yosoyjay Apr 14, 2022
bf63391
[wip] more type hints and simplification
yosoyjay Apr 14, 2022
d195bfd
[wip] improved import detection for libs
yosoyjay Apr 14, 2022
2e06364
[wip] add docstrings
yosoyjay Apr 14, 2022
e145a4e
add typehints and verify works with existing tests and demo notebooks
yosoyjay Apr 14, 2022
8dc405e
remove unused import
yosoyjay Apr 14, 2022
6a061a4
apply linting
yosoyjay Apr 15, 2022
c778bc0
add additional build and test for python 3.9, macos, and windows
yosoyjay Apr 15, 2022
48900c1
add pyinterp to setup.cfg + environment.yml, drop python 3.6
yosoyjay Apr 15, 2022
fb3449e
remove pyinterp from setup.cfg fails in docs/env
yosoyjay Apr 15, 2022
ac66988
Change type hints for list for 3.8 and add some more
yosoyjay Apr 15, 2022
4713cc0
[wip] resolving testing approaches in-prep for merge to main
yosoyjay Apr 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 40 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,37 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.8"]
os: ["macos-latest", "ubuntu-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9"]
steps:
- uses: actions/checkout@v2
- name: Cache conda
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Cache Linux/macOS (x86) Conda environment
if: ${{ runner.os != "windows-latest" }}
uses: actions/cache@v1
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}.yml') }}
- uses: conda-incubator/setup-miniconda@v2

- name: Cache Windows Conda environment
if: ${{ runner.os == "windows-latest" }}
uses: actions/cache@v1
env:
# Increase this value to reset cache if ci/environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-py${{ matrix.python-version }}-win.yml') }}

- name: Build and activate Linux/macOS Conda environment
if: ${{ runnor.os != "windows-latest" }}
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*" # activate this to build with mamba.
channels: conda-forge, defaults # These need to be specified to use mamba
Expand All @@ -29,14 +47,29 @@ jobs:

activate-environment: test_env_extract_model
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: Set up conda environment

- name: Build and activate Linux/macOS Conda environment
if: ${{ runnor.os == "windows-latest" }}
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*" # activate this to build with mamba.
channels: conda-forge, defaults # These need to be specified to use mamba
channel-priority: true
environment-file: ci/environment-py${{ matrix.python-version }}-win.yml

activate-environment: test_env_extract_model
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!

- name: Install package in environment
shell: bash -l {0}
run: |
python -m pip install -e . --no-deps --force-reinstall
- name: Run Tests

- name: Run tests
shell: bash -l {0}
run: |
pytest --cov=./ --cov-report=xml

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
21 changes: 21 additions & 0 deletions ci/environment-py3.7-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: test-env
channels:
- conda-forge
dependencies:
- python=3.7
- cf_xarray>=0.6
- cmocean
- dask
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- xarray
- xcmocean
- pytest
- pip:
- codecov
- pytest-cov
- coverage[toml]
7 changes: 2 additions & 5 deletions ci/environment-py3.7.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: test_env_extract_model
name: test-env
channels:
- conda-forge
dependencies:
- python=3.7
############## These will have to be adjusted to your specific project
- cartopy
- cf_xarray
- cmocean
- dask
- jupyter
- jupyterlab
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- xarray
- xcmocean
- xesmf
##############
- pytest
- pip:
- codecov
Expand Down
21 changes: 21 additions & 0 deletions ci/environment-py3.8-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: test-env
channels:
- conda-forge
dependencies:
- python=3.8
- cf_xarray>=0.6
- cmocean
- dask
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- xarray
- xcmocean
- pytest
- pip:
- codecov
- pytest-cov
- coverage[toml]
7 changes: 2 additions & 5 deletions ci/environment-py3.8.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: test_env_extract_model
name: test-env
channels:
- conda-forge
dependencies:
- python=3.8
############## These will have to be adjusted to your specific project
- cartopy
- cf_xarray
- cmocean
- dask
- jupyter
- jupyterlab
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- xarray
- xcmocean
- xesmf
##############
- pytest
- pip:
- codecov
Expand Down
21 changes: 21 additions & 0 deletions ci/environment-py3.9-win.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: test-env
channels:
- conda-forge
dependencies:
- python=3.9
- cf_xarray>=0.6
- cmocean
- dask
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- xarray
- xcmocean
- pytest
- pip:
- codecov
- pytest-cov
- coverage[toml]
22 changes: 22 additions & 0 deletions ci/environment-py3.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test-env
channels:
- conda-forge
dependencies:
- python=3.9
- cf_xarray>=0.6
- cmocean
- dask
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- xarray
- xcmocean
- xesmf
- pytest
- pip:
- codecov
- pytest-cov
- coverage[toml]
8 changes: 6 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ channels:
dependencies:
# Required for full project functionality (dont remove)
- pytest
<<<<<<< HEAD
- cf_xarray>=0.6
=======
# Examples (remove and add as needed)
- cartopy
- cf_xarray
>>>>>>> origin/main
- cmocean
- dask
- jupyter
- jupyterlab
- matplotlib
- netcdf4
- numpy
- pip
- pyinterp
- requests
- scipy
- xarray
- xcmocean
- xesmf
Expand Down
10 changes: 5 additions & 5 deletions extract_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

import cf_xarray as cfxr # noqa: F401
import requests # noqa: F401

from pkg_resources import DistributionNotFound, get_distribution

import extract_model.accessor

from .extract_model import argsel2d, sel2d, select # noqa: F401
from .utils import filter, order, preprocess, sub_bbox, sub_grid
import extract_model.accessor # noqa: F401

from .extract_model import (argsel2d, make_output_ds, sel2d, # noqa: F401
select)
from .pyinterp_shim import PyInterpShim # noqa: F401
from .utils import filter, order, preprocess, sub_bbox, sub_grid # noqa: F401

try:
__version__ = get_distribution("extract_model").version
Expand Down
Loading