-
Notifications
You must be signed in to change notification settings - Fork 30
Return correct dims of rotated grid constructed from geom #1153
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
Conversation
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.
Small bugfix, LGTM.
Two small remarks.
tests/gis/test_raster.py
Outdated
from shapely import Polygon | ||
from shapely.geometry import LineString, Point, box |
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.
Why are there two separate import statements here?
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 was an auto import, I merged it with the next one
tests/gis/test_raster.py
Outdated
def test_create_rotated_grid_from_geom(): | ||
coords = [(0, 0), (10, 0), (10, 100), (0, 100), (0, 0)] | ||
polygon = Polygon(coords) | ||
|
||
# Create a GeoDataFrame | ||
region = gpd.GeoDataFrame(pd.DataFrame({"id": [1]}), geometry=[polygon]) | ||
da = create_rotated_grid_from_geom(region, res=1, dec_origin=0, dec_rotation=0) | ||
expected_shape = (100, 10) | ||
assert da.raster.shape == expected_shape |
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.
This results in a regular grid, I guess the point is to test for rotated grids, so maybe add a rotated square as input geometry?
|
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.
Very rotated, very good.
Issue addressed
Fixes #1121
Explanation
As mentioned the rotated grid creation returned the dimensions flipped as was reported in the docstring. I added a simple test to solidfy which shapes we should return here
General Checklist
main
Data/Catalog checklist
data/catalogs/predefined_catalogs.yml
has not been modified.data_catalog.yml
files have been changeddata/changelog.rst
has been updatedLF
line endings (done automatically if you usedupdate_versions.py
)Additional Notes (optional)
Add any additional notes or information that may be helpful.