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

GeomsComponent._region_data crashes on too little arguments #1079

Closed
2 tasks done
veenstrajelmer opened this issue Sep 30, 2024 · 0 comments · Fixed by #1091
Closed
2 tasks done

GeomsComponent._region_data crashes on too little arguments #1079

veenstrajelmer opened this issue Sep 30, 2024 · 0 comments · Fixed by #1091
Labels
Bug Something isn't working Needs refinement issue still needs refinement

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Sep 30, 2024

HydroMT version checks

  • I have checked that this issue has not already been reported.
  • I have checked that this bug exists on the latest version of HydroMT.

Reproducible Example

Cannot provide this, happened somewhere in trial/error of updating hydromt_delft3dfm to hydromt v1, but cannot reproduce this easily anymore.

Current behaviour

Error about missing ymin/xmax/ymax arguments for shapely.box in GeomsComponent._region_data:

def _region_data(self) -> Optional[GeoDataFrame]:
# Use the total bounds of all geometries as region
if len(self.data) == 0:
return None
bounds = np.column_stack([geom.bounds for geom in self.data.values()])
total_bounds = (
bounds[0].min(),
bounds[1].min(),
bounds[2].max(),
bounds[3].max(),
)
region = gpd.GeoDataFrame(
geometry=[gpd.GeoSeries(box(total_bounds))], crs=self.model.crs
)
return region

Probably because all four arguments are passed as a tuple to xmin.

Desired behaviour

I think because the code should read box(*total_bounds) instead of box(total_bounds) so all four arguments are separately passed instead.

Additional context

I meant to check the code coverage since this cannot possibly be covered by tests if my hypothesis is correct. However, the code coverage has not been updated for a year so I cannot check this. For that issue I created #1077

@veenstrajelmer veenstrajelmer added Bug Something isn't working Needs refinement issue still needs refinement labels Sep 30, 2024
@veenstrajelmer veenstrajelmer linked a pull request Oct 21, 2024 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Needs refinement issue still needs refinement
Projects
None yet
1 participant