forked from NCAR/geocat-viz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from NCAR/main
[pull] main from NCAR:main
- Loading branch information
Showing
6 changed files
with
49 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -57,6 +45,10 @@ jobs: | |
run: | | ||
conda list | ||
- name: tests | ||
run: | | ||
python -m pytest | ||
link-check: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |