Fix crs of buidrain data - #598
Conversation
OnnoEbbens
left a comment
There was a problem hiding this comment.
Nice work! I just have some minor remarks.
| depth_method : str, optional | ||
| The method to transform the depth of buisdrainage to the model Dataset. The | ||
| default is "mode". | ||
| fix_crs : bool, optional |
There was a problem hiding this comment.
maybe add a reference to this PR. The image in the PR speaks a thousand bookparts.
There was a problem hiding this comment.
good idea, will add a link to the docstring
| "nbconvert", | ||
| "openpyxl", | ||
| "numpy<2.5.0", # until there is a new version of netCDF4 (now 1.7.4) this solves "Setting the shape on a NumPy array has been deprecated" | ||
| "affine<3.0.1", # until there are newer versions of rasterio (now 1.5.1) and rioxarray (now 0.23.0), this solves "Use @ matmul instead of * mul operator for matrix multiplication" |
There was a problem hiding this comment.
But you did fix the matmul right? Is this <3.0.1 still necessary?
There was a problem hiding this comment.
I fixed it in our own code. But it still needs to be fixed in methods within rasterio and rioxarray, that we use.
There was a problem hiding this comment.
Not sure what is happening with these changes but I assume it is some fix for RWS bathymetry download?
There was a problem hiding this comment.
Yes, the FeatureServer is not avialable anymore, but the MapServer is. Then in Python 3.12, the stuff with the env-variable GDAL_DISABLE_READDIR_ON_OPEN was needed, otherwise it would look for non-existing files and fail.
The original data for pipe drainage (buisdrainage) contains a wrong coordinate system, causing the data to be shifted to the northeast by more than 100 m. This PR fixes this issue by adding the argument
fix_crstonlmod.read.nhi.discretize_buisdrainage. The value of this argument by default isFalse, so existing models that use this method will not change, but the user will see a warning.This PR also solves some of the
Use "@" matmul instead of "*"warnings, and a bathemetry-error.The following code:
produces the image below. The data is placed too far northeast, see the offset near the roads and the pixels in the river.

When we set
fix_crstoTruein the code above, we get the following image, in which you can see that the data now aligns with the background map.