-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
gdal_calc.py: allow "none" or a float for --NoDataValue #7793
Conversation
would you mind adding in autotest/pyscripts/test_gdal_calc.py a test case for --NoDataValue=none ? |
Done, though since I'm not familiar with the test suite I'm not sure exactly what's supposed to be tested for |
f"--overwrite --outfile {out[0]}", | ||
) | ||
|
||
check_file(out[0], input_checksum[0]) |
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.
with addition actually checking the nodata value on the output raster like the following (untested) :
check_file(out[0], input_checksum[0]) | |
check_file(out[0], input_checksum[0]) | |
ds = gdal.Open(out[0]) | |
assert ds.GetRasterBand(1).GetNoDataValue() is None |
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.
So perhaps I'll also add another test with --NoDataValue=<actual_float_number>
and check that it is also applied, so we can test both none
and a real value. Thanks
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.
What about now?
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.
test_gdal_calc_py_4 actually does -NoDataValue=999. It just lacks the testing of it. Would be better to add it there to minimize the number of lines & runtime
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.
Shall I add --NoDataValue=none
there as well?
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.
Shall I add --NoDataValue=none there as well?
it's probably OK to let it where you added it
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.
Ok, so hopefully now should be it?
we have formatting rules that fail with your commit https://github.com/OSGeo/gdal/actions/runs/5028424696/jobs/9019121500?pr=7793
|
Oops sorry, done. |
What does this PR do?
It allows specifying
--NoDataValue=none
, which was previously failing due totype=float
in theparser.add_argument
call.