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

fix geom_component._region_data() #1091

Merged
merged 7 commits into from
Oct 23, 2024
Merged

fix geom_component._region_data() #1091

merged 7 commits into from
Oct 23, 2024

Conversation

veenstrajelmer
Copy link
Collaborator

@veenstrajelmer veenstrajelmer commented Oct 21, 2024

Issue addressed

Fixes #1079

Explanation

My steps:

  • added the assertion of geom_component._region_data(), since calling that property shows the current bug (fails with IndexError: index 1 is out of bounds for axis 0 with size 1)
  • solved the IndexError by properly generating total_bounds (was calling over the wrong dimension)
  • this caused the error box() missing 3 required positional arguments: 'miny', 'maxx', and 'maxy' one line below
  • solved by adding * to expand the total_bounds argument form a tuple into four separate arguments
  • this resulted in shapely.errors.GeometryTypeError: Unknown geometry type: 'featurecollection' >> solved by generating the geodataframe like in test_model_set_geoms, but I have no clue if this results in the expected type/format. At least it works, but please check this
  • made sure the assertion in the test also checked a valid result

General Checklist

  • Updated tests or added new tests
  • Branch is up to date with main
  • Tests & pre-commit hooks pass
  • Updated documentation >> not relevant
  • Updated changelog.rst >> add later to avoid conflicts before this PR is merged, it can be something like "fixed geom_component._region_data() (fix geom_component._region_data() #1091)"

Data/Catalog checklist

  • data/catalogs/predefined_catalogs.yml has not been modified.
  • None of the old data_catalog.yml files have been chagned
  • data/chagnelog.rst has been updated
  • new file uses LF line endings (done automatically if you used update_versions.py)
  • New file has been tested locally
  • Tests have been added using the new file in the test suite

@veenstrajelmer veenstrajelmer linked an issue Oct 21, 2024 that may be closed by this pull request
2 tasks
@veenstrajelmer veenstrajelmer changed the title make test fail deliberately fix geom_component._region_data() Oct 21, 2024
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.

LGTM

@savente93 savente93 merged commit 416c889 into main Oct 23, 2024
9 checks passed
@savente93 savente93 deleted the region-data-tuple branch October 23, 2024 14:30
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.

GeomsComponent._region_data crashes on too little arguments
2 participants