-
Notifications
You must be signed in to change notification settings - Fork 30
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
GeoDataFrameAdapter
slices data even if the source is empty for the geometry
#584
Comments
For P drive location: |
Do you have a suggestion of what the desired behavior should be. Should it return |
Somehow, this behaviour is not observed in the 0.8 conda version of hydroMT. Do you know where the difference could come from? |
Otherwise, the |
This has likely changed as part of #481 I think catching the error in the plugins makes sense. But happy to discuss alternatives. I think it's important that the behaviour is consistent across all Adapters (this was not the case before). |
This would need to be coordinated with the plugins to be implemented correctly, but personally I quite like the pandas approach here as demonstrated in their
(source: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.to_datetime.html) this would give the users a bit more flexibility in how these things are handled. Just a suggestion |
So in this case we would do some sort of a nodata check in the class NoDataStrategy(Enum):
_raise = "raise"
ignore = "ignore"
def get_data(
self,
bbox=None,
geom=None,
buffer=0,
predicate="intersects",
logger=logger,
variables=None,
handle_empty=NoDataStrategy._raise
):
... |
No, I don't think a coerce option makes sense here, I can't really imagine when you'd like to get back just an empty dataset, so I think this is fine. Though perhaps if one of the plugins has a need for another we could consider it |
You suggestion looks good to me @Jaapel! Some questions / considerations:
|
Empty DataFrame? Possibly, some metadata in the data objects may be useful? Otherwise None is fine
I like Enums here, as that is what they are made for. You can easily see which options are available and you get early errors, but we can deal with strings too if that is the style of the repository.
For pandas the errors method is about parsing. If we want to ignore errors is general, I would be more specific with errors (like
Yes I am thinking about adding a |
I'm actually really in favor of enums, Honestly I think they could be use much more throughout the repository. |
HydroMT version checks
Reproducible Example
Current behaviour
Raises Exception because of no data in the current DataFrame
Desired behaviour
Should not raise exception
Additional context
No response
The text was updated successfully, but these errors were encountered: