Skip to content

Commit

Permalink
Merge pull request #33 from mpelchat04/bbox
Browse files Browse the repository at this point in the history
Fix issue with bands_requested when using command line.
  • Loading branch information
mpelchat04 authored Dec 4, 2024
2 parents 9e02167 + e6487ec commit e7ceb9a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0
3.1.0
2 changes: 1 addition & 1 deletion geo_inference/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 2 additions & 2 deletions geo_inference/geo_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions geo_inference/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e7ceb9a

Please sign in to comment.