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

i.albedo: Add test file #5402

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

codersmiti
Copy link
Contributor

This PR introduces a test suite for the i.albedo GRASS GIS module, focusing on various scenarios such as sensor-specific albedo calculations, output range validation, aggressive mode processing, and linear reflectance scaling.

Key updates in this PR include:

Functionality:

  • Verify albedo calculations for MODIS, Landsat, NOAA, and ASTER sensors using precomputed reference statistics.
  • Ensure that computed albedo values are remaining within the 0 to 1 range.

Linearity Test and Landsat Aggressive Mode:

  • Validate that aggressive mode processing reduces the dynamic range of output values compared to standard mode.
  • Confirm that albedo calculations scale linearly with input reflectance values.

Test Case Additions:

  • Sensor Tests: Validate albedo calculations for MODIS, Landsat, NOAA, and ASTER sensors against reference statistics.
  • Aggressive Mode Comparison: Compare standard and aggressive processing modes to verify dynamic range reduction and mean shift.
  • Output Range Validation: Ensure all albedo outputs are within the valid 0-1 range.
  • Linearity Test: Confirm that doubling input reflectance values results in doubled albedo outputs.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
@github-actions github-actions bot added Python Related code is in Python module imagery tests Related to Test Suite labels Mar 16, 2025
@codersmiti codersmiti changed the title i.albedo : add test file i.albedo: Add test file Mar 16, 2025
@@ -0,0 +1,164 @@
from grass.script import core
Copy link
Contributor

Choose a reason for hiding this comment

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

The standard way is
import grass.script as gs

flags="l",
overwrite=True,
)
stats = core.parse_command("r.info", map=self.output_raster, flags="r")
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use format=json and then you don't need to convert to float

Copy link
Contributor

Choose a reason for hiding this comment

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

r.univar below is the same

Copy link
Contributor Author

@codersmiti codersmiti Mar 26, 2025

Choose a reason for hiding this comment

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

Thank you for the feedback. I have fixed the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imagery module Python Related code is in Python tests Related to Test Suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants