Solafune-Inc / solafune-tools

Tools for geodatabase creation and management
MIT License
9 stars 1 forks source link

Handle Naming Convention Inconsistency in User Defined Bands Input #8

Closed SulthanAbiyyu closed 5 months ago

SulthanAbiyyu commented 5 months ago

This pull request addresses a potential naming convention inconsistency in user-defined bands input when using the create_basemap function. When the bands parameter is set to "Auto", the function automatically populates the list of bands with the standard Sentinel-2 band names (e.g., 'B01', 'B02', ..., 'B12'). However, if the user sets the bands individually, there is a possibility of naming errors, such as using lowercase letters or abbreviated band names (e.g., 'b1' instead of 'B01').

To mitigate this inconsistency, I've implemented additional logic in the function to handle such cases. Now, when the bands parameter is set manually, the function checks each band name so that it is in accordance to the standard Sentinel-2 naming convention. If any discrepancies are found, it will raise an error and give the valid bands options. I've added a get_valid_bands() function in settings.py to ensure code reusability and centralize band name validation.

This pull request not only handle naming convention inconsistency before fetching the image, but also prevents the _setup_directories() function on image_fetcher.py from creating an unnecessary empty directory.

pkopparla commented 5 months ago

Awesome, thank you for the contribution and detailed explanation of the reasoning behind it. Much appreciated!