Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compare_dswx_hls_products and dependencies gathered into new standalo… #213

Merged
merged 7 commits into from
Apr 3, 2023

Conversation

david-inglish
Copy link
Contributor

@david-inglish david-inglish commented Dec 29, 2022

…ne script

Description

Develop a PGE version of the compare_dswx_hls_products script to enable customization for PGE purposes.

Affected Issues

#208

Testing

Tested with output files from different releases

@JimHofman JimHofman marked this pull request as ready for review January 9, 2023 23:48
@david-inglish david-inglish marked this pull request as draft January 17, 2023 19:22
Copy link

@sjlewis-jpl sjlewis-jpl left a comment

Choose a reason for hiding this comment

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

Thank you for porting this over into our repos, I think having our own comparison script will be a good thing for the project in the long-run.

Most of my comments are in-line, including some changes to fully address the original ticket.

.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
.ci/scripts/dswx_compare_opera_pge.py Outdated Show resolved Hide resolved
@david-inglish david-inglish marked this pull request as ready for review March 17, 2023 18:52
Copy link

@sjlewis-jpl sjlewis-jpl left a comment

Choose a reason for hiding this comment

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

All of the issues with the actual comparisons are addressed well.

Every comparison has a "status" line starting with '[OK]. ', '[FAIL] ', or '[INFO] ', which is good. When the comparison fails, we should be consistent about where the additional info goes - either always before or always right after (and before reporting failure details, it should say what is being compared). I suggest having it go right after, as that saves a line identifying what is being reported on. I made some specific suggestions in-line with the code to address this point.

These changes might seem like nit-picking, but since this will (hopefully) be used by multiple teams, and think having really clear and intuitive output is important.

I attached two text files showing what the output looks like when a comparison succeeds vs fails, to see a concrete example of what I'm commenting on. The failed output was on two different granules, so pretty much everything was wrong.

comparison_failed_output.txt
comparison_succeeded_output.txt

# Don't fail for metadata fields that are not required to be the same
if k1 in metadata_exclude_list:
# We will just print the difference in the output
print(f'[INFO] {msg}')

Choose a reason for hiding this comment

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

These will print before the "Comparing metadata" message on line 140, which might be confusing. I suggest just appending these into the metadata_error_message string, or making another return argument to contain the info messages, and print them all at the same time. Probably good to group these together after the other metadata error messages.

Copy link
Contributor Author

@david-inglish david-inglish Mar 24, 2023

Choose a reason for hiding this comment

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

I am committing changes to address the most-recent comments.
Here is sample output for a few scenarios with the new changes:
comparison_all_ok.txt
comparison_band_difference_fail.txt

comparison_fail_num_band_geotransform_metadata.txt

flag_same_nbands = nbands_1 == nbands_2
flag_all_ok, flag_same_nbands_str = _get_prefix_str(flag_same_nbands, flag_all_ok)
prefix = PREFIX
print(f'{flag_same_nbands_str}Comparing number of bands')

Choose a reason for hiding this comment

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

Add the prefix at the beginning of this line, to keep the first 7 characters of each line clear of anything other than a comparison status.

Or you can remove it. If you put the error messages after the "[FAIL] Band 1 - Water classification (WTR)" line, you don't need this one.


flag_all_ok, flag_bands_are_equal_str = _get_prefix_str(flag_bands_are_equal,
flag_all_ok)
print(f'{flag_bands_are_equal_str} Band {b} -'

Choose a reason for hiding this comment

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

This has some extra spaces that mis-aligns the "Band {b}" part of the message.

Given my comment up above about removing the "Comparing DSWx bands..." line, replace those spaces with "Comparing ", so that it reads like one of these:

[FAIL] Comparing Band 1 - Water classification (WTR)
[OK]   Comparing Band 1 - Water classification (WTR)

At the very least, remove the extra extra spaces, so that "Band {b}" aligns with the rest of the output.

flag_all_ok, flag_bands_are_equal_str = _get_prefix_str(flag_bands_are_equal,
flag_all_ok)
print(f'{flag_bands_are_equal_str} Band {b} -'
f' {gdal_band_1.GetDescription()}"')

Choose a reason for hiding this comment

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

Extra double-quote at the end of the printed line

Copy link

@sjlewis-jpl sjlewis-jpl left a comment

Choose a reason for hiding this comment

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

The latest changes look good, and keep the spirit of my previous comments. Nice work!

Copy link
Collaborator

@collinss-jpl collinss-jpl 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 all the hard work on this @david-inglish, and thanks again to @sjlewis-jpl for weighing in!

@collinss-jpl collinss-jpl merged commit eafbe5f into main Apr 3, 2023
@collinss-jpl collinss-jpl deleted the 208-Develop-standalone-version-of-dswx_compare branch June 5, 2023 15:27
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