-
-
Notifications
You must be signed in to change notification settings - Fork 339
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.emissivity: added test file for i.emissivity module #5127
base: main
Are you sure you want to change the base?
Conversation
self.temp_rasters.append("diff_raster") | ||
|
||
self.assertRasterMinMax("diff_raster", 0, 0.05) | ||
self.runModule("r.mask", flags="r") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to remove the mask before you test the outputs.
It should be enough to check with assertRasterFitsUnivar, e.g., the mean, min, max and non-null cells.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I have removed the mask before testing the outputs and updated the test to use assertRasterFitsUnivar
to check the mean, min and max as suggested.
def test_region_resolution(self): | ||
"""Test the module behaviour with different region resolutions.""" | ||
results = {} | ||
for res in [1, 0.1]: | ||
with self.subTest(res=res): | ||
self.runModule("g.region", n=10, s=0, e=10, w=0, res=res) | ||
self.runModule( | ||
"r.mapcalc", expression=f"{self.input_raster} = 0.6", overwrite=True | ||
) | ||
self.assertModule( | ||
"i.emissivity", | ||
input=self.input_raster, | ||
output=self.output_raster, | ||
overwrite=True, | ||
) | ||
results[res] = self.assertRasterMinMax(self.output_raster, 0, 1) | ||
|
||
self.assertAlmostEqual(results[1], results[0.1], delta=0.01) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see much value in this test for i.emissivity specifically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have replaced the previous test with the new one focused on default emissivity calculation using critical NDVI values. This ensures that if the module is changed in the future, the test will catch it by failing.
overwrite=True, | ||
) | ||
self.assertRasterExists(self.output_raster) | ||
self.assertRasterMinMax(self.output_raster, 0, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would test with assertRasterFitsUnivar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the test to use assertRasterFitsUnivar
for validation.
This PR introduces a comprehensive test suite for the
i.emissivity
GRASS GIS module. The test suite is designed to validate core functionality, assess statistical correctness, and handle edge cases to ensure robust module behavior.Key Updates in this PR:
Test Case Additions
Basic Functionality
test_emissivity_ndvi_range
).test_complex_mask
).Advanced Properties
test_region_resolution
).test_partial_null_values
).test_extreme_ndvi_values
).Performance
Future Enhancements
This test suite enhances the reliability of the
i.emissivity
module by covering a broad spectrum of cases. Looking forward to feedback and potential refinements!