Skip to content

Conversation

@cleherny
Copy link
Contributor

The function assert_year in the master branch is not working properly. New propositions.

@cleherny cleherny requested a review from GwenaelleSa October 17, 2024 15:25
@stdl-s-sonarqube

This comment has been minimized.

Copy link
Member

@GwenaelleSa GwenaelleSa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me as is.
In the info printed with logger, it seems obvious to you that the year column is "year_tile", but is it indicated somewhere? Because it could be logic for someone else that the year column is just "year".

except:
if img_src=='XYZ' and year=='multi-year':
if year=='multi-year':
logger.error("Option 'multi-year' chosen but the tile geodataframe does not contain a year column. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the tile geodataframe does not contain the "year_tile" column."

Copy link
Contributor Author

@cleherny cleherny Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified but I kept 'year'

sys.exit(1)

if img_src=='WMS':
logger.error("Connector=WMS, delete the year column in the tile geodataframe")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I don't know if it is necessary to stop the code. Wouldn't it be enough to just warn that the year will not be considered? It would be the same as for the MIL connector and the FOLDER connector only use it for the id decomposition.
I would change the beginning of the message with something like "The connector WMS does not support a specific year, ...".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it was my first intention.
But here if the script is not exited, it leads to an error afterward because the id column contains the year info as well. It is produced if a year is provided when running prepare_data.py. So in this case the tile gdf has to be reprocessed without year.
But we can add what you suggest in case a year argument is set in the config file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the message according to your suggestion.

Copy link
Contributor Author

@cleherny cleherny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback.
Actually a tile gdf with a column year is provided to the script generate_tilesets.py. It is then renamed 'year_tile' to be differenciate from the 'year_label' in generate_tilesets.py. So for the user it is clearer to keep 'year'.

except:
if img_src=='XYZ' and year=='multi-year':
if year=='multi-year':
logger.error("Option 'multi-year' chosen but the tile geodataframe does not contain a year column. "
Copy link
Contributor Author

@cleherny cleherny Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified but I kept 'year'

sys.exit(1)

if img_src=='WMS':
logger.error("Connector=WMS, delete the year column in the tile geodataframe")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it was my first intention.
But here if the script is not exited, it leads to an error afterward because the id column contains the year info as well. It is produced if a year is provided when running prepare_data.py. So in this case the tile gdf has to be reprocessed without year.
But we can add what you suggest in case a year argument is set in the config file.

sys.exit(1)

if img_src=='WMS':
logger.error("Connector=WMS, delete the year column in the tile geodataframe")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the message according to your suggestion.

@cleherny cleherny changed the title Correct error in asser_year Correct error in assert_year Oct 18, 2024
@stdl-s-sonarqube
Copy link

Passed

Analysis Details

1 Issue

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 1 Code Smell

Coverage and Duplications

  • Coverage No coverage information (0.00% Estimated after merge)
  • Duplications 0.00% Duplicated Code (0.00% Estimated after merge)

Project ID: swiss-territorial-data-lab_object-detector_AYZ4zWIzr7JdaaSXwexc

View in SonarQube

@cleherny cleherny merged commit eda9536 into master Oct 18, 2024
1 check passed
@cleherny cleherny deleted the ch/correct_assert_year branch October 18, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants