diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 732a4ab..1c0227a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout repository diff --git a/Bounding Box Transformation.ipynb b/notebooks/Bounding Box Transformation.ipynb similarity index 100% rename from Bounding Box Transformation.ipynb rename to notebooks/Bounding Box Transformation.ipynb diff --git a/GEDI_11SLT.jpeg b/notebooks/GEDI_11SLT.jpeg similarity index 100% rename from GEDI_11SLT.jpeg rename to notebooks/GEDI_11SLT.jpeg diff --git a/GEDI_11SLT.jpeg.aux.xml b/notebooks/GEDI_11SLT.jpeg.aux.xml similarity index 100% rename from GEDI_11SLT.jpeg.aux.xml rename to notebooks/GEDI_11SLT.jpeg.aux.xml diff --git a/GEDI_11SLT.tif b/notebooks/GEDI_11SLT.tif similarity index 100% rename from GEDI_11SLT.tif rename to notebooks/GEDI_11SLT.tif diff --git a/Multi-Polygons from Raster Geometry.ipynb b/notebooks/Multi-Polygons from Raster Geometry.ipynb similarity index 100% rename from Multi-Polygons from Raster Geometry.ipynb rename to notebooks/Multi-Polygons from Raster Geometry.ipynb diff --git a/Multi-raster.ipynb b/notebooks/Multi-raster.ipynb similarity index 100% rename from Multi-raster.ipynb rename to notebooks/Multi-raster.ipynb diff --git a/Open Raster at Multi-Point.ipynb b/notebooks/Open Raster at Multi-Point.ipynb similarity index 100% rename from Open Raster at Multi-Point.ipynb rename to notebooks/Open Raster at Multi-Point.ipynb diff --git a/Open Raster at Point.ipynb b/notebooks/Open Raster at Point.ipynb similarity index 100% rename from Open Raster at Point.ipynb rename to notebooks/Open Raster at Point.ipynb diff --git a/pyproject.toml b/pyproject.toml index 7f0fcf1..0760f7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "rasters" -version = "1.8.0" +version = "1.9.0" description = "raster processing toolkit" readme = "README.md" authors = [ @@ -47,8 +47,8 @@ dev = [ "twine" ] -[tool.setuptools.package-data] -rasters = ["*.txt"] +[tool.setuptools.packages.find] +exclude = ["notebooks*", "examples*"] [project.urls] "Homepage" = "https://github.com/python-rasters/rasters" diff --git a/rasters/__init__.py b/rasters/__init__.py index 6106c98..49331fd 100644 --- a/rasters/__init__.py +++ b/rasters/__init__.py @@ -1,9 +1,4 @@ from .rasters import * +from .version import __version__ -from os.path import join, abspath, dirname - -with open(join(abspath(dirname(__file__)), "version.txt")) as f: - version = f.read() - -__version__ = version __author__ = "Gregory H. Halverson" diff --git a/rasters/raster.py b/rasters/raster.py index 0d93457..72fde10 100644 --- a/rasters/raster.py +++ b/rasters/raster.py @@ -127,7 +127,7 @@ def __array_prepare__(self, other: Union[np.ndarray, Raster], *args, **kwargs) - return array - def __array_wrap__(self, other: Union[np.ndarray, Raster], **kwargs) -> Raster: + def __array_wrap__(self, other: Union[np.ndarray, 'Raster'], context=None, return_scalar=None, **kwargs) -> 'Raster': if isinstance(other, Raster): other = other.array elif isinstance(other, np.ndarray): diff --git a/rasters/version.py b/rasters/version.py new file mode 100644 index 0000000..22431a4 --- /dev/null +++ b/rasters/version.py @@ -0,0 +1,3 @@ +from importlib.metadata import version + +__version__ = version("rasters") diff --git a/rasters/version.txt b/rasters/version.txt deleted file mode 100644 index 27f9cd3..0000000 --- a/rasters/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.8.0 diff --git a/tests/test_import_dependencies.py b/tests/test_import_dependencies.py new file mode 100644 index 0000000..19ce3d3 --- /dev/null +++ b/tests/test_import_dependencies.py @@ -0,0 +1,29 @@ +import pytest + +# List of dependencies +dependencies = [ + "affine", + "astropy", + "geopandas", + "h5py", + "matplotlib", + "msgpack", + "msgpack_numpy", + "numpy", + "pandas", + "PIL", + "pykdtree", + "pyproj", + "pyresample", + "pytest", + "rasterio", + "scipy", + "shapely", + "six", + "skimage", +] + +# Generate individual test functions for each dependency +@pytest.mark.parametrize("dependency", dependencies) +def test_dependency_import(dependency): + __import__(dependency) diff --git a/tests/test_input.tif b/tests/test_input.tif new file mode 100644 index 0000000..a91dde9 Binary files /dev/null and b/tests/test_input.tif differ diff --git a/tests/test_open_geotiff.py b/tests/test_open_geotiff.py new file mode 100644 index 0000000..eac6c97 --- /dev/null +++ b/tests/test_open_geotiff.py @@ -0,0 +1,9 @@ +import os + +def test_open_geotiff(): + """Test opening a GeoTIFF file using rasterio.""" + geotiff_path = os.path.join(os.path.dirname(__file__), "test_input.tif") + from rasters.raster import Raster + raster = Raster.open(geotiff_path) + assert raster.count > 0, "GeoTIFF should have at least one band" + assert raster.width > 0 and raster.height > 0, "GeoTIFF should have valid dimensions"