From b6d67ad162b6a78f7a56c738d583a65969c455bd Mon Sep 17 00:00:00 2001 From: trchudley Date: Thu, 13 Jun 2024 15:50:15 +0100 Subject: [PATCH 1/2] fix mosaic load bug on windows --- docs/appendix/version_updates.md | 1 + src/pdemtools/__init__.py | 2 +- src/pdemtools/load.py | 8 +++----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/appendix/version_updates.md b/docs/appendix/version_updates.md index a5f26bc..2f21997 100644 --- a/docs/appendix/version_updates.md +++ b/docs/appendix/version_updates.md @@ -2,6 +2,7 @@ | Version | Date | Notes | | ------- | ---- | ----- | +| 0.8.2 | June 2024 | Bug fix to address fail loading of mosaics on Windows systems | | 0.8.1 | June 2024 | Minor modification to hillshade script to allow for MacGregor _et al._ (2024) flow-aware hillshade. Supplementary notebook available in GitHub `notebooks` directory. | | 0.8.0 | May 2024 | Iceberg detection now corrects for sea surface; final additions to documentation before public conda/pip release. | 0.7.0 | March 2024 | Minor bug fixes and more detailed docstrings to support readthedocs | diff --git a/src/pdemtools/__init__.py b/src/pdemtools/__init__.py index 5e6c736..94920b4 100644 --- a/src/pdemtools/__init__.py +++ b/src/pdemtools/__init__.py @@ -6,6 +6,6 @@ from ._accessor import DemAccessor -__version__ = "0.8.1" +__version__ = "0.8.2" __all__ = ["search", "DemAccessor"] diff --git a/src/pdemtools/load.py b/src/pdemtools/load.py index cf66320..055490d 100644 --- a/src/pdemtools/load.py +++ b/src/pdemtools/load.py @@ -219,8 +219,8 @@ def from_id( if preview == True: browser_prefix = "https://polargeospatialcenter.github.io/stac-browser/#/external/pgc-opendata-dems.s3.us-west-2.amazonaws.com" - preview_fpath = os.path.join( - browser_prefix, dataset, "strips", version, "2m", geocell, f"{dem_id}.json" + preview_fpath = ( + f"{browser_prefix}/{dataset}/strips/{version}/2m/{geocell}/{dem_id}.json" ) return preview_fpath @@ -396,6 +396,4 @@ def _aws_link( raise ValueError(f"Input `resolution` must be one of ['2m', '10m', '32m']") # Return appropriate filepath. - return os.path.join( - prefix, dataset, "mosaics", version, resolution, row.supertile, fname - ) + return f"{prefix}/{dataset}/mosaics/{version}/{resolution}/{row.supertile}/{fname}" From 5a559dbb4a6a2cb5da09e2e0b922876cb764fe9e Mon Sep 17 00:00:00 2001 From: trchudley Date: Thu, 13 Jun 2024 15:54:07 +0100 Subject: [PATCH 2/2] fix mosaic load bug on windows --- src/pdemtools/load.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pdemtools/load.py b/src/pdemtools/load.py index 055490d..85071e2 100644 --- a/src/pdemtools/load.py +++ b/src/pdemtools/load.py @@ -225,15 +225,19 @@ def from_id( return preview_fpath # Construct DEM fpath - dem_fpath = os.path.join( - bucket, dataset, "strips", version, "2m", geocell, f"{dem_id}_dem.tif" - ) + dem_fpath = f'{bucket}/{dataset}/"strips"/{version}/2m/{geocell}/{dem_id}_dem.tif' + # dem_fpath = os.path.join( + # bucket, dataset, "strips", version, "2m", geocell, f"{dem_id}_dem.tif" + # ) # Construct bitmask fpath, if required if bitmask == True: - bitmask_fpath = os.path.join( - bucket, dataset, "strips", version, "2m", geocell, f"{dem_id}_bitmask.tif" + bitmask_fpath = ( + f'{bucket}/{dataset}/"strips"/{version}/2m/{geocell}/{dem_id}_bitmask.tif' ) + # bitmask_fpath = os.path.join( + # bucket, dataset, "strips", version, "2m", geocell, f"{dem_id}_bitmask.tif" + # ) else: bitmask_fpath = None