-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update ahn.py #370
Update ahn.py #370
Conversation
AHN3: 'AHN3_05m_DSM', 'AHN3_05m_DTM', 'AHN3_5m_DSM' or 'AHN3_5m_DTM' | ||
AHN4: 'AHN4_DTM_05m', 'AHN4_DTM_5m', 'AHN4_DSM_05m' or 'AHN4_DSM_5m' | ||
The default is 'AHN4_DTM_5m'. | ||
AHN1: 'AHN1_5M' |
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.
Add explanation of M and R :)
if not r.ok: | ||
raise (HTTPError(f"Request not successful: {r.url}")) | ||
gdf = gpd.GeoDataFrame.from_features(r.json()["result"]["features"], crs=4326) | ||
gdf = gdf.to_crs(crs) |
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.
The transform here is happening using EPSG 28992, not our custom definition. Are we sure things are ending up in the right spot in NL?
nlmod/read/ahn.py
Outdated
"""Download AHN2. | ||
|
||
Parameters | ||
---------- | ||
extent : list, tuple or np.array | ||
extent | ||
identifier : TYPE, optional | ||
identifier : str, optional | ||
Possible values are 'AHN2_05M_I', 'AHN2_05M_N', 'AHN2_05M_R' and |
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.
explain differences between suffixes?
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.
One question about the transform from EPSG4326 to EPSG28992, whether that is currently correct, as compared to our background map methods?
For the rest some guidance on which identifier corresponds to which AHN product would be nice.
Otherwise looks good, so approving this PR.
This PR fixes issues #367 and #369, by adding support to AHN 5, and implementing a different way to retrieve the ahn-data.
This PR changes the way we retrieve the AHN data for all AHN-versions, to use the Ellipsis Drive (described in https://www.ahn.nl/dataroom).
get_ahn1
,get_ahn2
,get_ahn3
andget_ahn4
have been renamed toget_ahn1_legacy
,get_ahn2_legacy
,get_ahn3_legacy
andget_ahn4_legacy
, mainly so the user can test if the same output is returned by the new methods: new versions ofget_ahn1
,get_ahn2
,get_ahn3
,get_ahn4
andget_ahn5
have been implemented that use the files from Ellipsis Drive. These methods will always return a xarray DataArray, so the use of theas_data_array
-argument has been deprecated. Because the merging of the different tiles now takes place at the rioxarray-level (and not at the rasterio-level), the bug described in #369 is solved.The identifier-argument on the ellipsis-drive (which determines the resolution of the downloaded data and if a DTM or DSM is downloaded) is a bit different from the ones we used to use. Some logic has been implemented, so the new methods should also work with the old identifier-names.