From 62ad74d815c34611f1a081da5b1f44004b48bbb9 Mon Sep 17 00:00:00 2001 From: Turgeon-Pelchat Date: Thu, 21 Nov 2024 15:22:48 -0500 Subject: [PATCH 1/2] bump version 3.0.0 -> 3.1.0 --- VERSION | 2 +- geo_inference/__init__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 56fea8a..a0cd9f0 100755 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.0 \ No newline at end of file +3.1.0 \ No newline at end of file diff --git a/geo_inference/__init__.py b/geo_inference/__init__.py index 571b01f..de47928 100755 --- a/geo_inference/__init__.py +++ b/geo_inference/__init__.py @@ -1,4 +1,4 @@ """Geo-inference: Extract features from high-resolution geospatial imagery using foundation models""" __author__ = "Victor Alhassan" -__version__ = "3.0.0" +__version__ = "3.1.0" diff --git a/pyproject.toml b/pyproject.toml index 9e1851b..fddba6f 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ geo_inference = "geo_inference.geo_inference:main" include = ["geo_inference*"] [tool.bumpver] -current_version = "3.0.0" +current_version = "3.1.0" version_pattern = "MAJOR.MINOR.PATCH" commit_message = "bump version {old_version} -> {new_version}" commit = true From e6487ec2fcfba27602a00af8e11379b1ba8d7d3d Mon Sep 17 00:00:00 2001 From: Mathieu Turgeon-Pelchat Date: Tue, 3 Dec 2024 11:42:15 -0500 Subject: [PATCH 2/2] fix issue with bands_requested when using cmd line --- geo_inference/geo_inference.py | 4 ++-- geo_inference/utils/helpers.py | 6 +++--- tests/utils/test_helpers.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/geo_inference/geo_inference.py b/geo_inference/geo_inference.py index d634958..d97858e 100755 --- a/geo_inference/geo_inference.py +++ b/geo_inference/geo_inference.py @@ -261,12 +261,12 @@ async def async_run_inference(self, ): if self.json is None: aoi_dask_array = xr.concat( - [aoi_dask_array[i - 1, :, :] for i in bands_requested], + [aoi_dask_array[int(i) - 1, :, :] for i in bands_requested], dim="band" ) else: aoi_dask_array = da.stack( - [aoi_dask_array[i - 1, :, :] for i in bands_requested], + [aoi_dask_array[int(i) - 1, :, :] for i in bands_requested], axis =0, ) except Exception as e: diff --git a/geo_inference/utils/helpers.py b/geo_inference/utils/helpers.py index 64fd618..8ff89c3 100755 --- a/geo_inference/utils/helpers.py +++ b/geo_inference/utils/helpers.py @@ -448,8 +448,8 @@ def cmd_interface(argv=None): parser.add_argument( "-br", "--bands_requested", - nargs=1, - help="bands_requested in this format['Red','Green','Blue'] or [1,2,3]", + nargs="*", + help="bands_requested in this format '-b Red Green Blue' or '-br 1 2 3'", ) parser.add_argument( @@ -512,7 +512,7 @@ def cmd_interface(argv=None): model = args.model[0] if args.model else None bbox = args.bbox[0] if args.bbox else None work_dir = args.work_dir[0] if args.work_dir else None - bands_requested = args.bands_requested[0] if args.bands_requested else [] + bands_requested = args.bands_requested if args.bands_requested else [] workers = args.workers[0] if args.workers else 0 vec = args.vec[0] if args.vec else False yolo = args.yolo[0] if args.yolo else False diff --git a/tests/utils/test_helpers.py b/tests/utils/test_helpers.py index 1be1238..785c3ce 100755 --- a/tests/utils/test_helpers.py +++ b/tests/utils/test_helpers.py @@ -155,14 +155,14 @@ def test_cmd_interface_with_args(monkeypatch, test_data_dir): def test_cmd_interface_with_image(monkeypatch): # Mock the command line arguments - monkeypatch.setattr('sys.argv', ['prog', '-i', 'image.tif']) + monkeypatch.setattr('sys.argv', ['prog', '-i', 'image.tif', '-br', '1', '2', '3']) # Call the function result = cmd_interface() # Assert the result assert result == { "image": "image.tif", "bbox": None, - "bands_requested" : [], + "bands_requested" : ['1', '2', '3'], "workers": 0, "model": None, "work_dir": None,