Skip to content

Commit

Permalink
Fix grid-builder for schema 229 (#407)
Browse files Browse the repository at this point in the history
* Clean up changes made to process new schema

* Fix get_surfaces depency on foreign key relationship between surface and surface parameters
  • Loading branch information
margrietpalm authored Jan 8, 2025
1 parent 41717dd commit c0c516f
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 204 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
include:
# 2022
# 2022 - 3.9
- python: 3.9
os: ubuntu-22.04
setuptools: setuptools==63.*
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Changelog of threedigrid-builder
1.21.4 (unreleased)
-------------------

- Nothing changed yet.
- Remove internal changes made for previous schema upgrades and limit changes to db interface


1.21.3 (2024-12-17)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_version():

install_requires = [
"numpy>=1.15,<3.0",
"threedi-schema==0.228.*",
"threedi-schema==0.229.*",
"shapely>=2",
"pyproj>=3",
"condenser[geo]>=0.1.1",
Expand Down
4 changes: 2 additions & 2 deletions threedigrid_builder/grid/boundary_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ def apply(self, grid):
class BoundaryCondition2D:
id: int
type: BoundaryType
geom: shapely.Geometry
the_geom: shapely.Geometry


class BoundaryConditions2D(Array[BoundaryCondition2D]):
def get_intersecting_node_idx(
self, idx: int, cell_tree: shapely.STRtree
) -> np.ndarray:
bc_geom = self.geom[idx]
bc_geom = self.the_geom[idx]

x1, y1, x2, y2 = shapely.bounds(bc_geom)
is_horizontal = (x2 - x1) > (y2 - y1)
Expand Down
4 changes: 2 additions & 2 deletions threedigrid_builder/grid/zero_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class BaseSurface:
code: str
display_name: str
area: float
geom: shapely.Geometry
the_geom: shapely.Geometry

connection_node_id: int
connection_node_the_geom: shapely.Geometry
Expand Down Expand Up @@ -267,7 +267,7 @@ def as_grid_surfaces(
if extra_fields is None:
extra_fields = {}

centroids = shapely.centroid(self.geom)
centroids = shapely.centroid(self.the_geom)
no_centroid_mask = shapely.is_missing(centroids)

if np.any(no_centroid_mask):
Expand Down
Loading

0 comments on commit c0c516f

Please sign in to comment.