-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use shapes for DTM coverage #169
base: main
Are you sure you want to change the base?
Conversation
combined = pandas.concat([states, countries]) | ||
|
||
# handling by name (for most of them) | ||
names = [ |
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.
Can we automatically retrieve this list somewhere? Providers?
Why it's hardcoded?
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.
Like iterating over the DTM Provider subclasses and parse their names or something.
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.
Well they are not all treated the same so if we want to iterate over the providers automatically, then how do we treat some differently (like England, Scotland and the others in there)
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.
@kbrandwijk, can't we somehow make it in a universal way? So we don't need some weird list of strings and so on, just hit F5 and we're ready to go?
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.
Unfortunately not. Some providers don't match 1-on-1 with a country, so some need special handling.
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.
@kbrandwijk, can we implement somehow this special handling as a property or a method of a DTM Provider class?
The thing is: when I'm looking here I see a big red text: no one will evar be able to implement their own DTM Provider unless they developed this feature with extent. 🤣
And that worries me.
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.
That'd be nice actually to move this to the provider classes. I can just iterate over provider subclasses like we already do, and if there's a method defined to extract the data, we use it, otherwise we do it by name.
generate_extents.py
script in the dev folder generates a combined shapes file with all the bounds for all the providers. When a new provider is added, it will need to be added to that script to include the bounds in the generated shapes file.the _extents properties are removed, instead there's an _extent_identifier which points to the name of the dataset in the shapes file for the provider (this was easier than renaming them all in the generate script, although technically we could)
the valid_providers method (the existing one) now also takes the size because we want to make sure the entire bounding box is inside the extents of the selected provider. That method now uses the generated shapes file to determine if a provider should be filtered or not. Providers that have not been added to the script/shapes file will always be returned.