Skip to content

Commit

Permalink
Merge branch 'main' into dockathys
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed May 9, 2024
2 parents 7b04465 + a959a9d commit 5a50782
Show file tree
Hide file tree
Showing 60 changed files with 84 additions and 110 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
CONDA_PREFIX=$(python -c "import sys; print(sys.prefix)")
echo "CONDA_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ env.CONDA_PREFIX }}
key: ubuntu-latest-3.10-conda-${{ hashFiles('continuous_integration/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
CONDA_PREFIX=$(python -c "import sys; print(sys.prefix)")
echo "CONDA_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ env.CONDA_PREFIX }}
key: ${{ matrix.os }}-${{matrix.python-version}}-conda-${{ hashFiles('continuous_integration/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-sdist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Publish package to PyPI
# upload to PyPI on every release for a tag starting with 'v'
if: github.event.action == 'published' && startsWith(github.event.release.tag_name, 'v')
uses: pypa/[email protected].11
uses: pypa/[email protected].14
with:
user: __token__
password: ${{ secrets.pypi_password }}
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.9'
rev: 'v0.4.3'
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args: [--unsafe]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-4
rev: v3.8.0-1
hooks:
- id: shfmt-src # native (requires Go to build)
args: ["-i", "4"]
Expand Down
21 changes: 10 additions & 11 deletions build_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ dependencies:
- conda-pack
- configobj
- curl
- dask>=2023.11.0
- distributed>=2023.11.0
- dask>=2024.2.1
- distributed>=2022.2.1
- donfig>=0.8.1
- ffmpeg
- fontconfig
Expand All @@ -24,24 +24,23 @@ dependencies:
- pycoast>=1.7.0
- pydecorate>=0.4.0
- pyhdf
- pykdtree>=1.3.10
- pyorbital>=1.8.0
- pykdtree>=1.3.11
- pyorbital>=1.8.2
- pyproj>=3.6.1
- pyresample>=1.27.1
- pyshp
- pyresample>=1.28.2
- pyshp>=2.3.1
- pyspectral>=0.13.0
- python=3.11
- python-geotiepoints>=1.7.1
- pyyaml
- python-geotiepoints>=1.7.2
- pyyaml>=6.0.1
- rasterio>=1.3.9
- requests
- setuptools
- six
- trollimage>=1.22.2
- trollimage>=1.23.1
- trollsift>=0.5.1
- scipy
- zarr
- xarray>=2023.11.0
- xarray>=2024.2.0
- fsspec
- s3fs
- pip:
Expand Down
2 changes: 1 addition & 1 deletion continuous_integration/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
- scipy
- zarr
- xarray
- pytest
- pytest <8.0
- pytest-cov
- pytest-lazy-fixture
- sphinx
Expand Down
4 changes: 4 additions & 0 deletions create_conda_software_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ for bash_file in *.sh; do
sed -i "s/# __SWBUNDLE_ENVIRONMENT_INJECTION__/source \$POLAR2GRID_HOME\/bin\/env.sh/g" "$bash_file"
done

# Softlink bin/ scripts in python runtime so env.sh adds them to PATH
cd ${PYTHON_RUNTIME_BASE}/bin
find ../../../bin/ -name "*.sh" ! -name "*env*" -exec ln -s {} . \;

echo "Copying Satpy auxiliary data to software bundle..."
mkdir -p ${SATPY_DATA_DIR} || oops "Could not create polar2grid auxiliary data directory"
# don't include large geotiff files that we don't use in P2G/G2G
Expand Down
1 change: 1 addition & 0 deletions doc/source/toctree_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
for more information.
"""

import re

from docutils.parsers.rst import directives
Expand Down
1 change: 1 addition & 0 deletions integration_tests/features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Configure behave tests."""

import os
import shutil
import sys
Expand Down
1 change: 1 addition & 0 deletions integration_tests/features/steps/compare_images.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Various behavior test steps."""

import glob
import os
import re
Expand Down
1 change: 1 addition & 0 deletions polar2grid/_glue_argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Argument parsing and script setup for the main glue.py script."""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions polar2grid/add_coastlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Madison, WI 53706
# [email protected]
"""Script to add coastlines and borders to a geotiff while also creating a PNG."""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions polar2grid/add_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Add a colortable to an existing GeoTIFF."""

import os
import sys

Expand Down
1 change: 1 addition & 0 deletions polar2grid/core/script_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"""

__docformat__ = "restructuredtext en"

import argparse
Expand Down
1 change: 1 addition & 0 deletions polar2grid/grids/config_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
to a user's own grid configuration file.
"""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions polar2grid/grids/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Madison, WI 53706
# [email protected]
"""Utilities and accessor functions to grids and projections used in polar2grid."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/amsr2_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
for more information on generating these NRL-like PNGs.
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/amsr2_l2_gaasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
+-----------------------------------+--------------------------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/avhrr_l1b_aapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
+--------------------+--------------------------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/clavrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
+------------------------+---------------------------------------------+
"""

from __future__ import annotations

import os
Expand Down
2 changes: 1 addition & 1 deletion polar2grid/readers/fci_l1c_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"nir_13",
"nir_16",
"nir_22",
"ir_23",
"ir_38",
"wv_63",
"wv_73",
"ir_87",
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/modis_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
angle is less than 90 degrees.
"""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/modis_l2.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
+--------------------+--------------------------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/viirs_edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
+---------------------------+-----------------------------------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup, BooleanOptionalAction
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/viirs_edr_active_fires.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
| T13 | M-Band 13 Temperature (AFMOD Resolution Only) |
+---------------------------+-----------------------------------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/viirs_edr_flood.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| WaterDetection | Channel 1 Reflectance Band |
+---------------------------+-----------------------------------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/viirs_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
angle is less than 100 degrees.
"""

from __future__ import annotations

__docformat__ = "restructuredtext en"
Expand Down
1 change: 1 addition & 0 deletions polar2grid/readers/virr_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
| true_color | Ratio sharpened rayleigh corrected true color |N/A |
+---------------------------+-----------------------------------------------------+-------------------------+
"""

from __future__ import annotations

from argparse import ArgumentParser, _ArgumentGroup
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Tests for polar2grid."""

import os

TEST_ETC_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), "etc"))
1 change: 1 addition & 0 deletions polar2grid/tests/_abi_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Test fixtures representing ABI gridded data."""

from __future__ import annotations

import pytest
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/_avhrr_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Test fixtures representing AVHRR swath data."""

from __future__ import annotations

import dask.array as da
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/_fixture_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Shared utilities between fixtures."""

from __future__ import annotations

from datetime import datetime
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/_viirs_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Test fixtures representing VIIRS swath data."""

from __future__ import annotations

import dask.array as da
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Test initialization and fixtures."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/test_add_coastlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Basic usability tests for the add_coastlines script."""

from __future__ import annotations

import contextlib
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/test_add_colormap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Basic usability tests for the add_colormap script."""

from __future__ import annotations

import os
Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Tests for the compare.py script."""

import os
from glob import glob

Expand Down
1 change: 1 addition & 0 deletions polar2grid/tests/test_filters/test_day_night.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# input into another program.
# Documentation: http://www.ssec.wisc.edu/software/polar2grid/
"""Tests day/night filtering."""

import dask.array as da
import numpy as np
import pytest
Expand Down
8 changes: 5 additions & 3 deletions polar2grid/tests/test_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ def extra_viirs_comp_and_enh(extra_viirs_composite_path, extra_viirs_enhancement
@contextlib.contextmanager
def prepare_glue_exec(create_scene_func, max_computes=0, use_polar2grid=True):
use_str = "1" if use_polar2grid else "0"
with set_env(USE_POLAR2GRID_DEFAULTS=use_str), mock.patch(
"polar2grid.glue._create_scene"
) as create_scene, dask.config.set(scheduler=CustomScheduler(max_computes)):
with (
set_env(USE_POLAR2GRID_DEFAULTS=use_str),
mock.patch("polar2grid.glue._create_scene") as create_scene,
dask.config.set(scheduler=CustomScheduler(max_computes)),
):
create_scene.return_value = create_scene_func
yield

Expand Down
12 changes: 7 additions & 5 deletions polar2grid/tests/test_resample/test_resample_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ def test_resample_single_result_per_grid(

from polar2grid.filters.resample_coverage import ResampleCoverageFilter

with dask.config.set(scheduler=CustomScheduler(max_computes)), mock.patch(
"satpy.resample.resample", wraps=resample
) as satpy_resample, mock.patch(
"polar2grid.resample._resample_scene.ResampleCoverageFilter", wraps=ResampleCoverageFilter
) as resamp_cov:
with (
dask.config.set(scheduler=CustomScheduler(max_computes)),
mock.patch("satpy.resample.resample", wraps=resample) as satpy_resample,
mock.patch(
"polar2grid.resample._resample_scene.ResampleCoverageFilter", wraps=ResampleCoverageFilter
) as resamp_cov,
):
input_scene.load(exp_names)
scenes_to_save = resample_scene(
input_scene,
Expand Down
Loading

0 comments on commit 5a50782

Please sign in to comment.