diff --git a/scripts/create_examples.py b/scripts/create_examples.py index e37b31b..ec3c0d8 100755 --- a/scripts/create_examples.py +++ b/scripts/create_examples.py @@ -17,9 +17,8 @@ from tempfile import TemporaryDirectory import stactools.core.copy -from pystac import Catalog, CatalogType - import stactools.noaa_cdr.stac +from pystac import Catalog, CatalogType from stactools.noaa_cdr.ocean_heat_content import stac as ocean_heat_content_stac from stactools.noaa_cdr.sea_ice_concentration import stac as sea_ice_concentration_stac from stactools.noaa_cdr.sea_surface_temperature_optimum_interpolation import ( diff --git a/scripts/create_item_assets.py b/scripts/create_item_assets.py index d0111fa..2d6cf22 100755 --- a/scripts/create_item_assets.py +++ b/scripts/create_item_assets.py @@ -11,9 +11,8 @@ from tempfile import TemporaryDirectory import orjson -from pystac import Item - import stactools.noaa_cdr.stac +from pystac import Item from stactools.noaa_cdr.sea_ice_concentration import stac as sea_ice_stac from stactools.noaa_cdr.sea_surface_temperature_optimum_interpolation import ( stac as oisst_stac, diff --git a/scripts/extract_netcdf_asset_metadata.py b/scripts/extract_netcdf_asset_metadata.py index 5a19ba7..96d7352 100755 --- a/scripts/extract_netcdf_asset_metadata.py +++ b/scripts/extract_netcdf_asset_metadata.py @@ -18,11 +18,10 @@ from typing import Dict import fsspec +import stactools.noaa_cdr.ocean_heat_content import xarray from tqdm import tqdm -import stactools.noaa_cdr.ocean_heat_content - metadata: Dict[str, Dict[str, str]] = {} for href in tqdm(list(stactools.noaa_cdr.ocean_heat_content.iter_noaa_hrefs())): key = os.path.splitext(os.path.basename(href))[0] diff --git a/src/stactools/noaa_cdr/profile.py b/src/stactools/noaa_cdr/profile.py index 0e6d0f6..d518d62 100644 --- a/src/stactools/noaa_cdr/profile.py +++ b/src/stactools/noaa_cdr/profile.py @@ -128,7 +128,8 @@ def build( ) if not data_type: raise ValueError( - f"No raster extension DataType found for numpy dtype: {data_array.dtype}" + f"No raster extension DataType found for numpy dtype:" + f"{data_array.dtype}" ) if data_type.startswith("float"): nodata: Any = numpy.nan @@ -221,7 +222,8 @@ def needs_vertical_flip(self) -> bool: def _parse_resolution(value: Any) -> float: if isinstance(value, str): - # Assume that the first part is a number and the rest are units, e.g. for ocean heat content + # Assume that the first part is a number and the rest are units, + # e.g. for ocean heat content return float(value.split(" ")[0]) else: return float(value) diff --git a/src/stactools/noaa_cdr/sea_ice_concentration/commands.py b/src/stactools/noaa_cdr/sea_ice_concentration/commands.py index c571af0..e439dc9 100644 --- a/src/stactools/noaa_cdr/sea_ice_concentration/commands.py +++ b/src/stactools/noaa_cdr/sea_ice_concentration/commands.py @@ -2,9 +2,8 @@ import click import pystac.utils -from click import Command, Group - import stactools.noaa_cdr.stac +from click import Command, Group from stactools.noaa_cdr.sea_ice_concentration import stac diff --git a/src/stactools/noaa_cdr/sea_surface_temperature_optimum_interpolation/commands.py b/src/stactools/noaa_cdr/sea_surface_temperature_optimum_interpolation/commands.py index e9754f6..8ef1626 100644 --- a/src/stactools/noaa_cdr/sea_surface_temperature_optimum_interpolation/commands.py +++ b/src/stactools/noaa_cdr/sea_surface_temperature_optimum_interpolation/commands.py @@ -2,11 +2,10 @@ import click import pystac.utils +import stactools.noaa_cdr.stac from click import Command, Group from pystac import CatalogType -import stactools.noaa_cdr.stac - from . import stac diff --git a/src/stactools/noaa_cdr/sea_surface_temperature_whoi/commands.py b/src/stactools/noaa_cdr/sea_surface_temperature_whoi/commands.py index c444e32..4f0533c 100644 --- a/src/stactools/noaa_cdr/sea_surface_temperature_whoi/commands.py +++ b/src/stactools/noaa_cdr/sea_surface_temperature_whoi/commands.py @@ -4,7 +4,6 @@ import pystac.utils from click import Command, Group from pystac import ItemCollection - from stactools.noaa_cdr.sea_surface_temperature_whoi import stac diff --git a/src/stactools/noaa_cdr/sea_surface_temperature_whoi/stac.py b/src/stactools/noaa_cdr/sea_surface_temperature_whoi/stac.py index 37b4c44..d1c5ff7 100644 --- a/src/stactools/noaa_cdr/sea_surface_temperature_whoi/stac.py +++ b/src/stactools/noaa_cdr/sea_surface_temperature_whoi/stac.py @@ -9,7 +9,6 @@ from pystac.extensions.item_assets import AssetDefinition, ItemAssetsExtension from pystac.extensions.raster import RasterExtension from pystac.extensions.scientific import ScientificExtension - from stactools.noaa_cdr.profile import BandProfile from .. import cog, dataset, stac, time diff --git a/tests/__init__.py b/tests/__init__.py index 075bbae..2f5de4f 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,10 +3,9 @@ import click from click.testing import CliRunner, Result -from stactools.testing.test_data import TestData - from stactools.noaa_cdr import ocean_heat_content from stactools.noaa_cdr.commands import create_noaa_cdr_command +from stactools.testing.test_data import TestData external_data: Dict[str, Any] = { "oisst-avhrr-v02r01.20220913.nc": { diff --git a/tests/sea_ice_concentration/test_stac.py b/tests/sea_ice_concentration/test_stac.py index 059dbe9..918ded2 100644 --- a/tests/sea_ice_concentration/test_stac.py +++ b/tests/sea_ice_concentration/test_stac.py @@ -6,7 +6,6 @@ from pystac.extensions.projection import ProjectionExtension from pystac.extensions.raster import RasterExtension from pystac.extensions.scientific import ScientificExtension - from stactools.noaa_cdr.constants import CLASSIFICATION_EXTENSION_SCHEMA from stactools.noaa_cdr.sea_ice_concentration import cog, stac diff --git a/tests/sea_surface_temperature_whoi/test_commands.py b/tests/sea_surface_temperature_whoi/test_commands.py index c307f2f..dafdce6 100644 --- a/tests/sea_surface_temperature_whoi/test_commands.py +++ b/tests/sea_surface_temperature_whoi/test_commands.py @@ -12,7 +12,8 @@ def test_create_cog_items(tmp_path: Path) -> None: "SEAFLUX-OSB-CDR_V02R00_SST_D20210831_C20211223.nc" ) result = run_command( - f"noaa-cdr sea-surface-temperature-whoi create-cog-items {path} {tmp_path}/out.json" + f"noaa-cdr sea-surface-temperature-whoi create-cog-items {path} {tmp_path}" + "/out.json" ) assert result.exit_code == 0, result.output item_collection = ItemCollection.from_file(str(tmp_path / "out.json")) diff --git a/tests/test_profile.py b/tests/test_profile.py index 3edf129..7fe96b6 100644 --- a/tests/test_profile.py +++ b/tests/test_profile.py @@ -1,5 +1,4 @@ import xarray - from stactools.noaa_cdr.profile import BandProfile from . import test_data diff --git a/tests/test_time.py b/tests/test_time.py index 40f04c7..d22f43a 100644 --- a/tests/test_time.py +++ b/tests/test_time.py @@ -2,7 +2,6 @@ from typing import Tuple import pytest - from stactools.noaa_cdr import time from stactools.noaa_cdr.time import TimeResolution