NRCan / geo-inference

A light-weight python package for extracting features from geospatial imagery
Other
2 stars 3 forks source link

[Bug] - Bands_requested does not accept list. #31

Closed mpelchat04 closed 2 weeks ago

mpelchat04 commented 1 month ago

The bands_requested parameter should be accepting list, currently supports only sequence of strings, which is not intuitive nor practical.

Current behavior

The parameter verification is wrong:

        if not isinstance(bands_requested, (Sequence, ListConfig)):
            raise ValueError(
                f"Requested bands should be a list."
                f"\nGot {bands_requested} of type {type(bands_requested)}"
            )

The message suggest a list is requested but it only checks for sequence or Listconfig.

Then, it is treated as a sequence nonetheless:

                    if bands_requested:
                        raster_bands_request = [int(b) for b in bands_requested.split(",")]

Suggested behavior

The parameter should be a list. There should not be any split of sequence, just treating the list as is.