From ab774da3780d45d39bd227f1b07b2aba89e7e10a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 21:59:43 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/source/toctree_filter.py | 1 + integration_tests/features/environment.py | 1 + integration_tests/features/steps/compare_images.py | 1 + polar2grid/_glue_argparser.py | 1 + polar2grid/add_coastlines.py | 1 + polar2grid/add_colormap.py | 1 + polar2grid/core/script_utils.py | 1 + polar2grid/grids/config_helper.py | 1 + polar2grid/grids/manager.py | 1 + polar2grid/readers/amsr2_l1b.py | 1 + polar2grid/readers/amsr2_l2_gaasp.py | 1 + polar2grid/readers/avhrr_l1b_aapp.py | 1 + polar2grid/readers/clavrx.py | 1 + polar2grid/readers/modis_l1b.py | 1 + polar2grid/readers/modis_l2.py | 1 + polar2grid/readers/viirs_edr.py | 1 + polar2grid/readers/viirs_edr_active_fires.py | 1 + polar2grid/readers/viirs_edr_flood.py | 1 + polar2grid/readers/viirs_l1b.py | 1 + polar2grid/readers/virr_l1b.py | 1 + polar2grid/tests/__init__.py | 1 + polar2grid/tests/_abi_fixtures.py | 1 + polar2grid/tests/_avhrr_fixtures.py | 1 + polar2grid/tests/_fixture_utils.py | 1 + polar2grid/tests/_viirs_fixtures.py | 1 + polar2grid/tests/conftest.py | 1 + polar2grid/tests/test_add_coastlines.py | 1 + polar2grid/tests/test_add_colormap.py | 1 + polar2grid/tests/test_compare.py | 1 + polar2grid/tests/test_filters/test_day_night.py | 1 + polar2grid/tests/test_glue.py | 8 +++++--- .../tests/test_resample/test_resample_scene.py | 12 +++++++----- polar2grid/utils/config.py | 1 + polar2grid/utils/create_awips_debug_tiles.py | 1 + polar2grid/utils/warnings.py | 1 + polar2grid/writers/awips_tiled.py | 1 + polar2grid/writers/cf.py | 1 + polar2grid/writers/geotiff.py | 1 + polar2grid/writers/hdf5.py | 1 + 39 files changed, 49 insertions(+), 8 deletions(-) diff --git a/doc/source/toctree_filter.py b/doc/source/toctree_filter.py index d8a6906d..e3ffa0c4 100644 --- a/doc/source/toctree_filter.py +++ b/doc/source/toctree_filter.py @@ -4,6 +4,7 @@ for more information. """ + import re from docutils.parsers.rst import directives diff --git a/integration_tests/features/environment.py b/integration_tests/features/environment.py index 7fd0862c..c016d027 100644 --- a/integration_tests/features/environment.py +++ b/integration_tests/features/environment.py @@ -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 diff --git a/integration_tests/features/steps/compare_images.py b/integration_tests/features/steps/compare_images.py index 0d03e0b7..ee6575fd 100644 --- a/integration_tests/features/steps/compare_images.py +++ b/integration_tests/features/steps/compare_images.py @@ -1,4 +1,5 @@ """Various behavior test steps.""" + import glob import os import re diff --git a/polar2grid/_glue_argparser.py b/polar2grid/_glue_argparser.py index 856f07f3..51c86b00 100644 --- a/polar2grid/_glue_argparser.py +++ b/polar2grid/_glue_argparser.py @@ -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 diff --git a/polar2grid/add_coastlines.py b/polar2grid/add_coastlines.py index 60509863..280a4e5a 100644 --- a/polar2grid/add_coastlines.py +++ b/polar2grid/add_coastlines.py @@ -28,6 +28,7 @@ # Madison, WI 53706 # david.hoese@ssec.wisc.edu """Script to add coastlines and borders to a geotiff while also creating a PNG.""" + from __future__ import annotations import argparse diff --git a/polar2grid/add_colormap.py b/polar2grid/add_colormap.py index d31bc56a..c9e23d88 100644 --- a/polar2grid/add_colormap.py +++ b/polar2grid/add_colormap.py @@ -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 diff --git a/polar2grid/core/script_utils.py b/polar2grid/core/script_utils.py index e66f1001..66c9a00c 100644 --- a/polar2grid/core/script_utils.py +++ b/polar2grid/core/script_utils.py @@ -38,6 +38,7 @@ """ + __docformat__ = "restructuredtext en" import argparse diff --git a/polar2grid/grids/config_helper.py b/polar2grid/grids/config_helper.py index dc616810..779eb194 100644 --- a/polar2grid/grids/config_helper.py +++ b/polar2grid/grids/config_helper.py @@ -27,6 +27,7 @@ to a user's own grid configuration file. """ + from __future__ import annotations import os diff --git a/polar2grid/grids/manager.py b/polar2grid/grids/manager.py index 9483475b..74232777 100644 --- a/polar2grid/grids/manager.py +++ b/polar2grid/grids/manager.py @@ -28,6 +28,7 @@ # Madison, WI 53706 # david.hoese@ssec.wisc.edu """Utilities and accessor functions to grids and projections used in polar2grid.""" + from __future__ import annotations import logging diff --git a/polar2grid/readers/amsr2_l1b.py b/polar2grid/readers/amsr2_l1b.py index 13403d0b..6dfe3907 100644 --- a/polar2grid/readers/amsr2_l1b.py +++ b/polar2grid/readers/amsr2_l1b.py @@ -68,6 +68,7 @@ for more information on generating these NRL-like PNGs. """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/readers/amsr2_l2_gaasp.py b/polar2grid/readers/amsr2_l2_gaasp.py index c6bbd770..1c9fda61 100644 --- a/polar2grid/readers/amsr2_l2_gaasp.py +++ b/polar2grid/readers/amsr2_l2_gaasp.py @@ -47,6 +47,7 @@ +-----------------------------------+--------------------------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/readers/avhrr_l1b_aapp.py b/polar2grid/readers/avhrr_l1b_aapp.py index a58867f8..59019496 100644 --- a/polar2grid/readers/avhrr_l1b_aapp.py +++ b/polar2grid/readers/avhrr_l1b_aapp.py @@ -49,6 +49,7 @@ +--------------------+--------------------------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/readers/clavrx.py b/polar2grid/readers/clavrx.py index d9483cad..2a5678f8 100644 --- a/polar2grid/readers/clavrx.py +++ b/polar2grid/readers/clavrx.py @@ -67,6 +67,7 @@ +------------------------+---------------------------------------------+ """ + from __future__ import annotations import os diff --git a/polar2grid/readers/modis_l1b.py b/polar2grid/readers/modis_l1b.py index 4f2cdb6b..b762b393 100644 --- a/polar2grid/readers/modis_l1b.py +++ b/polar2grid/readers/modis_l1b.py @@ -132,6 +132,7 @@ angle is less than 90 degrees. """ + from __future__ import annotations import argparse diff --git a/polar2grid/readers/modis_l2.py b/polar2grid/readers/modis_l2.py index 858a35dd..1ca4f3a3 100644 --- a/polar2grid/readers/modis_l2.py +++ b/polar2grid/readers/modis_l2.py @@ -63,6 +63,7 @@ +--------------------+--------------------------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/readers/viirs_edr.py b/polar2grid/readers/viirs_edr.py index a6064a50..d8faa0f4 100644 --- a/polar2grid/readers/viirs_edr.py +++ b/polar2grid/readers/viirs_edr.py @@ -80,6 +80,7 @@ +---------------------------+-----------------------------------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup, BooleanOptionalAction diff --git a/polar2grid/readers/viirs_edr_active_fires.py b/polar2grid/readers/viirs_edr_active_fires.py index a1804414..91d61faa 100644 --- a/polar2grid/readers/viirs_edr_active_fires.py +++ b/polar2grid/readers/viirs_edr_active_fires.py @@ -51,6 +51,7 @@ | T13 | M-Band 13 Temperature (AFMOD Resolution Only) | +---------------------------+-----------------------------------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/readers/viirs_edr_flood.py b/polar2grid/readers/viirs_edr_flood.py index 54dac116..30a58d4f 100644 --- a/polar2grid/readers/viirs_edr_flood.py +++ b/polar2grid/readers/viirs_edr_flood.py @@ -37,6 +37,7 @@ | WaterDetection | Channel 1 Reflectance Band | +---------------------------+-----------------------------------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/readers/viirs_l1b.py b/polar2grid/readers/viirs_l1b.py index 1759a741..b0fbc9c9 100644 --- a/polar2grid/readers/viirs_l1b.py +++ b/polar2grid/readers/viirs_l1b.py @@ -155,6 +155,7 @@ angle is less than 100 degrees. """ + from __future__ import annotations __docformat__ = "restructuredtext en" diff --git a/polar2grid/readers/virr_l1b.py b/polar2grid/readers/virr_l1b.py index b4cc8800..bf61c652 100644 --- a/polar2grid/readers/virr_l1b.py +++ b/polar2grid/readers/virr_l1b.py @@ -64,6 +64,7 @@ | true_color | Ratio sharpened rayleigh corrected true color |N/A | +---------------------------+-----------------------------------------------------+-------------------------+ """ + from __future__ import annotations from argparse import ArgumentParser, _ArgumentGroup diff --git a/polar2grid/tests/__init__.py b/polar2grid/tests/__init__.py index 67f569a6..308387d0 100644 --- a/polar2grid/tests/__init__.py +++ b/polar2grid/tests/__init__.py @@ -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")) diff --git a/polar2grid/tests/_abi_fixtures.py b/polar2grid/tests/_abi_fixtures.py index 9fb2e114..f801fe66 100644 --- a/polar2grid/tests/_abi_fixtures.py +++ b/polar2grid/tests/_abi_fixtures.py @@ -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 diff --git a/polar2grid/tests/_avhrr_fixtures.py b/polar2grid/tests/_avhrr_fixtures.py index 4fc976c2..2691de7a 100644 --- a/polar2grid/tests/_avhrr_fixtures.py +++ b/polar2grid/tests/_avhrr_fixtures.py @@ -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 diff --git a/polar2grid/tests/_fixture_utils.py b/polar2grid/tests/_fixture_utils.py index 510830c0..917da31d 100644 --- a/polar2grid/tests/_fixture_utils.py +++ b/polar2grid/tests/_fixture_utils.py @@ -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 diff --git a/polar2grid/tests/_viirs_fixtures.py b/polar2grid/tests/_viirs_fixtures.py index 2513e10a..38e7e96b 100644 --- a/polar2grid/tests/_viirs_fixtures.py +++ b/polar2grid/tests/_viirs_fixtures.py @@ -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 diff --git a/polar2grid/tests/conftest.py b/polar2grid/tests/conftest.py index 44c5df6b..7fde67b3 100644 --- a/polar2grid/tests/conftest.py +++ b/polar2grid/tests/conftest.py @@ -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 diff --git a/polar2grid/tests/test_add_coastlines.py b/polar2grid/tests/test_add_coastlines.py index 802156b0..83f7c05f 100644 --- a/polar2grid/tests/test_add_coastlines.py +++ b/polar2grid/tests/test_add_coastlines.py @@ -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 diff --git a/polar2grid/tests/test_add_colormap.py b/polar2grid/tests/test_add_colormap.py index 28c31413..19067691 100644 --- a/polar2grid/tests/test_add_colormap.py +++ b/polar2grid/tests/test_add_colormap.py @@ -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 diff --git a/polar2grid/tests/test_compare.py b/polar2grid/tests/test_compare.py index 0cb2aacd..b779a823 100644 --- a/polar2grid/tests/test_compare.py +++ b/polar2grid/tests/test_compare.py @@ -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 diff --git a/polar2grid/tests/test_filters/test_day_night.py b/polar2grid/tests/test_filters/test_day_night.py index 24682a1b..4228e3f5 100644 --- a/polar2grid/tests/test_filters/test_day_night.py +++ b/polar2grid/tests/test_filters/test_day_night.py @@ -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 diff --git a/polar2grid/tests/test_glue.py b/polar2grid/tests/test_glue.py index a666ac7a..a7402b4e 100644 --- a/polar2grid/tests/test_glue.py +++ b/polar2grid/tests/test_glue.py @@ -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 diff --git a/polar2grid/tests/test_resample/test_resample_scene.py b/polar2grid/tests/test_resample/test_resample_scene.py index dba4cd7d..8632e5b9 100644 --- a/polar2grid/tests/test_resample/test_resample_scene.py +++ b/polar2grid/tests/test_resample/test_resample_scene.py @@ -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, diff --git a/polar2grid/utils/config.py b/polar2grid/utils/config.py index 4fdfe24f..a7e2c5bd 100644 --- a/polar2grid/utils/config.py +++ b/polar2grid/utils/config.py @@ -21,6 +21,7 @@ # input into another program. # Documentation: http://www.ssec.wisc.edu/software/polar2grid/ """Helpers for setting up the Polar2Grid environment and configuration.""" + import importlib.metadata as impm import importlib.resources as impr import os diff --git a/polar2grid/utils/create_awips_debug_tiles.py b/polar2grid/utils/create_awips_debug_tiles.py index c8f952c3..435b11b0 100644 --- a/polar2grid/utils/create_awips_debug_tiles.py +++ b/polar2grid/utils/create_awips_debug_tiles.py @@ -21,6 +21,7 @@ # input into another program. # Documentation: http://www.ssec.wisc.edu/software/polar2grid/ """Helper script for generating debug AWIPS Tiled files for verifying AWIPS client behavior.""" + import contextlib import os import sys diff --git a/polar2grid/utils/warnings.py b/polar2grid/utils/warnings.py index f6b5dae3..f1ed50ea 100644 --- a/polar2grid/utils/warnings.py +++ b/polar2grid/utils/warnings.py @@ -1,4 +1,5 @@ """Warnings or utilities for dealing with warnings.""" + from __future__ import annotations import contextlib diff --git a/polar2grid/writers/awips_tiled.py b/polar2grid/writers/awips_tiled.py index 440f71a4..5b6795f2 100644 --- a/polar2grid/writers/awips_tiled.py +++ b/polar2grid/writers/awips_tiled.py @@ -81,6 +81,7 @@ see the Satpy documentation :mod:`here `. """ + import logging from argparse import BooleanOptionalAction diff --git a/polar2grid/writers/cf.py b/polar2grid/writers/cf.py index 52866272..7d0ba7ba 100644 --- a/polar2grid/writers/cf.py +++ b/polar2grid/writers/cf.py @@ -26,6 +26,7 @@ different grids, the CF compliant workaround is to save the datasets to separate files. """ + import json import logging diff --git a/polar2grid/writers/geotiff.py b/polar2grid/writers/geotiff.py index ec0e0375..3be3a6f3 100644 --- a/polar2grid/writers/geotiff.py +++ b/polar2grid/writers/geotiff.py @@ -38,6 +38,7 @@ as transparent in most image viewers. """ + import argparse import logging import os diff --git a/polar2grid/writers/hdf5.py b/polar2grid/writers/hdf5.py index f892144b..2240dfc1 100644 --- a/polar2grid/writers/hdf5.py +++ b/polar2grid/writers/hdf5.py @@ -40,6 +40,7 @@ longitude and latitude data in the file, instructions for output-filename patterns, and product selection. """ + from __future__ import annotations import logging