Skip to content

Commit

Permalink
Merge pull request #28 from NCAR/main
Browse files Browse the repository at this point in the history
[pull] main from NCAR:main
  • Loading branch information
jukent authored May 1, 2024
2 parents 28aad3e + 08ab2ef commit 862f525
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 27 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,35 @@ on:
- cron: '0 0 * * *' # Daily “At 00:00”
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Python (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "macos-14", "windows-latest"]
python-version: [ "3.9", "3.11", "3.12" ]
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
- name: conda_setup
uses: conda-incubator/setup-miniconda@v3
if: matrix.os != 'macos-14'
with:
activate-environment: geocat_viz_build
channel-priority: strict
python-version: ${{ matrix.python-version }}
channels: conda-forge
environment-file: build_envs/environment.yml
- name: conda_setup_m1

- name: environment setup
uses: conda-incubator/setup-miniconda@v3
if: matrix.os == 'macos-14'
with:
installer-url: https://github.com/conda-forge/miniforge/releases/download/23.11.0-0/Mambaforge-23.11.0-0-MacOSX-arm64.sh
activate-environment: geocat_viz_build
channel-priority: strict
python-version: ${{ matrix.python-version }}
channels: conda-forge
environment-file: build_envs/environment.yml

- name: Install geocat-viz
run: |
python -m pip install . --no-deps
Expand All @@ -57,6 +45,10 @@ jobs:
run: |
conda list
- name: tests
run: |
python -m pytest
link-check:
runs-on: ubuntu-latest
defaults:
Expand All @@ -65,22 +57,24 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
- name: conda_setup

- name: environment setup
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: gv-docs
channel-priority: strict
python-version: 3.9
channels: conda-forge
environment-file: build_envs/docs.yml

- name: Install geocat-viz
run: |
python -m pip install .
- name: check conda list
run: |
conda list
- name: Make docs with linkcheck
run: |
cd docs
Expand Down
8 changes: 4 additions & 4 deletions build_envs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ dependencies:
- make
- matplotlib
- sphinx
- pip
- cmaps
- numpy
- xarray
- metpy
- pint
- pytest
- pytest-mpl
- geocat-datafiles
- pip:
- pre-commit
- scikit-learn
- pre-commit
- scikit-learn
12 changes: 12 additions & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
Release Notes
=============

v2024.04.0 (unreleased)
---------------------------

Internal Changes
^^^^^^^^^^^^^^^^
* Remove M1 workaround for CI and tokens that are no longer needed by `Katelyn FitzGerald`_ in (:pr:`232`)

Testing
^^^^^^^
* Add basic testing infrastructure by `Katelyn FitzGerald`_ and `Julia Kent`_ in (:pr:`233`)


v2024.03.0 (March 26, 2024)
---------------------------
This release deprecates ``TaylorDiagram`` method names ``add_xgrid()`` and
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ install_requires =
setuptools
scikit-learn
metpy
tests_require =
pytest
pytest-mpl

[options.packages.find]
where = src
Expand All @@ -64,7 +67,7 @@ docs =

[tool:pytest]
python_files = test_*.py
testpaths = test
testpaths = tests

[aliases]
test = pytest
Empty file added tests/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
import matplotlib as mpl

from geocat.viz.util import truncate_colormap


def test_truncate_colormap():
cmap = mpl.colormaps['terrain']
truncated_cmap = truncate_colormap(cmap, 0.1, 0.9)

assert isinstance(truncated_cmap, mpl.colors.LinearSegmentedColormap)
assert truncated_cmap(0.0) == cmap(0.1)
assert truncated_cmap(1.0) == cmap(0.9)

0 comments on commit 862f525

Please sign in to comment.