Skip to content
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

Pyogrio io #583

Merged
merged 12 commits into from
Oct 20, 2023
Merged

Pyogrio io #583

merged 12 commits into from
Oct 20, 2023

Conversation

Jaapel
Copy link
Contributor

@Jaapel Jaapel commented Oct 13, 2023

Issue addressed

Fixes #575

Explanation

pyogrio will be replacing geopandas read models in v1.0. This library does not try to do Path.expanduser, so using this version fixes the bug for me. Masking still does not work in that version, so I had to do some work myself (filtering input / output).

Checklist

  • Updated tests or added new tests
  • Branch is up to date with main
  • Tests & pre-commit hooks pass
  • Updated documentation if needed
  • Updated changelog.rst if needed

hydromt/io.py Outdated Show resolved Hide resolved
@Jaapel Jaapel self-assigned this Oct 19, 2023
@Jaapel Jaapel added the Bug Something isn't working label Oct 19, 2023
Copy link
Contributor

@DirkEilander DirkEilander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!
Generally it looks great and thanks again for checking all the different options I suggested :)
I have two final suggestions. Furthermore, I think it would be good if @savente93 could have a final look at the code syntax (I didn't pay much attention to this because of time).

@@ -553,3 +558,46 @@ def to_geographic_bbox(bbox, source_crs):
bbox = Transformer.from_crs(source_crs, target_crs).transform_bounds(*bbox)

return bbox


def prepare_pyogrio_reader_filters(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method could be more widely used than for pyogrio input. Perhaps renaming it to parse_bbox or something more generic would make that more clear.

pyproject.toml Outdated
@@ -25,6 +25,7 @@ dependencies = [
"rioxarray", # wraps rasterio and xarray. Almost superceded by hydromt/raster.py
"pandas", # Dataframes
"pyflwdir>=0.5.4", # Hight models and derivatives
"pyogrio>=0.6", # io for geopandas dataframes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to other optional io packages I would suggest to move pyogrio to the optional io dependencies until it the default engine of geopandas.

@savente93
Copy link
Contributor

I'll be reviewing it in a few minutes, but in the mean time I have one questuion:

pyogrio will be replacing geopandas read models in v1.0.

I missed this, is it because of this issue, or because of something else?

Copy link
Contributor

@savente93 savente93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice PR Jaap, thanks. Two small questions but nothing major. Really nice.

hydromt/gis_utils.py Show resolved Hide resolved
hydromt/gis_utils.py Show resolved Hide resolved
hydromt/gis_utils.py Show resolved Hide resolved
hydromt/io.py Show resolved Hide resolved
hydromt/io.py Show resolved Hide resolved
tests/conftest.py Show resolved Hide resolved
@Jaapel Jaapel merged commit a7c5101 into main Oct 20, 2023
9 checks passed
@Jaapel Jaapel deleted the pyogrio_io branch October 20, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reading GeoPandas with HydroMT using UPath results in a NotImplementedError
3 participants