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

fix: decimal not handled with modulus #136

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

renaudjester
Copy link
Collaborator

Found a bug with full test datasets where the decimals were not correctly handled

this would fail:

copernicusmarine subset -i cmems_obs_oc_blk_bgc_tur-spm-chl_nrt_l3-hr-mosaic_P1D-m -x 26.000661375661405 -X 26.000661375661405

@renaudjester renaudjester requested a review from uriii3 September 17, 2024 15:07
# Modulus with python return a negative value if the denominator is negative
# To counteract that, we add 360 if the result is < 0
modulus = modulus if modulus >= 0 else modulus + 360
return modulus - 180
return float(modulus - 180)
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we still need the float here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes :D To keep the types consistent

@renaudjester renaudjester merged commit 48fe4af into copernicusmarine-toolbox-v2 Sep 18, 2024
2 checks passed
@renaudjester renaudjester deleted the fix-decimal-imprecision branch September 18, 2024 06:50
renaudjester added a commit that referenced this pull request Oct 28, 2024
Fix a bug where the decimals for the longitude wouldn't be considered properly for the check of bounds
renaudjester added a commit that referenced this pull request Oct 28, 2024
Fix a bug where the decimals for the longitude wouldn't be considered properly for the check of bounds
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.

2 participants