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

Forman 148 subset by geometry #150

Merged
merged 7 commits into from
Aug 13, 2019
Merged

Conversation

forman
Copy link
Member

@forman forman commented Aug 13, 2019

  • Added new spatial dataset operations to xcube.api:
    • mask_dataset_by_geometry(dataset, geometry_like) clip and mask a dataset by geometry
    • clip_dataset_by_geometry(dataset, geometry_like) just clip a dataset by geometry
    • convert_geometry(geometry_like) convert a geometry-like into a shapely geometry
  • Renamed type Geometry into GeometryLike
  • Fixed clipping of datasets (clip bounds were by 1 too large in x,y directions)
  • Fixed conversion of geometry-like objects if GeoJSON dicts were passed
  • Added a lot of missing tests, adapted tests

Closes #148

@AliceBalfanz to merge this PR asap

Sorry, the PR became quite large.

forman added 4 commits August 13, 2019 12:14
  * `mask_dataset_by_geometry(dataset, geometry_like)` clip and mask a dataset by geometry
  * `clip_dataset_by_geometry(dataset, geometry_like)` just clip a dataset by geometry
  * `convert_geometry(geometry_like)` convert a geometry-like into a shapely geometry
* Renamed type `Geometry` into `GeometryLike`
* Fixed clipping of datasets (clip bounds were by 1 too large in x,y directions)
* Fixed conversion of geometry-like objects if GeoJSON dicts were passed
* Added a lot of missing tests, adapted tests

Closes #148
@codecov-io
Copy link

codecov-io commented Aug 13, 2019

Codecov Report

Merging #150 into master will increase coverage by 0.04%.
The diff coverage is 93.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #150      +/-   ##
==========================================
+ Coverage   85.62%   85.67%   +0.04%     
==========================================
  Files          72       72              
  Lines        6743     6812      +69     
==========================================
+ Hits         5774     5836      +62     
- Misses        969      976       +7
Impacted Files Coverage Δ
xcube/util/config.py 95.09% <ø> (-0.05%) ⬇️
xcube/util/undefined.py 100% <ø> (ø) ⬆️
xcube/api/__init__.py 100% <100%> (ø) ⬆️
xcube/api/ts.py 96.61% <100%> (ø) ⬆️
xcube/util/geom.py 93.14% <93.57%> (-2.59%) ⬇️
xcube/util/geojson.py 93.5% <93.93%> (+1.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a532cd...42ef73b. Read the comment docs.

@AliceBalfanz
Copy link
Contributor

When using the xcube.api from this branch in a jupyter lab, I still get an error when trying to import a geojson:
grafik
Did I misunderstood how it should be used?

@forman
Copy link
Member Author

forman commented Aug 13, 2019

You load a feature or feature collection, not a geometry.
Let me make the error message clearer...

Copy link
Contributor

@AliceBalfanz AliceBalfanz 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 the changes!

@AliceBalfanz AliceBalfanz merged commit 5e41a6b into master Aug 13, 2019
@forman forman deleted the forman-148-subset_by_geometry branch August 13, 2019 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spatial cube subset by geometry
4 participants