Skip to content

Commit

Permalink
Adapt to match some name changes in threedi-schema (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
margrietpalm authored Jan 23, 2025
1 parent 56ba90c commit 2e72e0b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
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.23.1 (unreleased)
-------------------

- Nothing changed yet.
- Adapt to match some name changes in threedi-schema


1.23.0 (2025-01-16)
Expand Down
44 changes: 22 additions & 22 deletions threedigrid_builder/interface/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get_version(self) -> int:

def upgrade(self, convert_to_geopackage=False):
schema = ModelSchema(self.db)
schema.upgrade(backup=False, convert_to_geopackage=convert_to_geopackage)
schema.upgrade(backup=False)

@contextmanager
def get_session(self) -> ContextManager[Session]:
Expand Down Expand Up @@ -205,7 +205,7 @@ def get_settings(self) -> dict:
infiltration = {}
if model_settings.use_vegetation_drag_2d:
vegetation_drag = _object_as_dict(
session.query(models.VegetationDrag).one()
session.query(models.VegetationDrag2D).one()
)
else:
vegetation_drag = {}
Expand Down Expand Up @@ -325,21 +325,21 @@ def get_surfaces(self) -> Surfaces:
models.Surface.display_name,
models.Surface.area,
models.Surface.geom.label("the_geom"),
models.SurfaceParameter.outflow_delay,
models.SurfaceParameter.surface_layer_thickness,
models.SurfaceParameter.infiltration,
models.SurfaceParameter.max_infiltration_capacity,
models.SurfaceParameter.min_infiltration_capacity,
models.SurfaceParameter.infiltration_decay_constant,
models.SurfaceParameter.infiltration_recovery_constant,
models.SurfaceParameters.outflow_delay,
models.SurfaceParameters.surface_layer_thickness,
models.SurfaceParameters.infiltration,
models.SurfaceParameters.max_infiltration_capacity,
models.SurfaceParameters.min_infiltration_capacity,
models.SurfaceParameters.infiltration_decay_constant,
models.SurfaceParameters.infiltration_recovery_constant,
models.SurfaceMap.connection_node_id,
models.SurfaceMap.percentage,
models.ConnectionNode.geom.label("connection_node_the_geom"),
)
.select_from(models.Surface)
.join(
models.SurfaceParameter,
models.Surface.surface_parameters_id == models.SurfaceParameter.id,
models.SurfaceParameters,
models.Surface.surface_parameters_id == models.SurfaceParameters.id,
)
.join(
models.SurfaceMap, models.SurfaceMap.surface_id == models.Surface.id
Expand Down Expand Up @@ -848,18 +848,18 @@ def get_windshieldings(self) -> Windshieldings:
with self.get_session() as session:
arr = (
session.query(
models.Windshielding.id,
models.Windshielding.channel_id,
models.Windshielding.north,
models.Windshielding.northeast,
models.Windshielding.east,
models.Windshielding.southeast,
models.Windshielding.south,
models.Windshielding.southwest,
models.Windshielding.west,
models.Windshielding.northwest,
models.Windshielding1D.id,
models.Windshielding1D.channel_id,
models.Windshielding1D.north,
models.Windshielding1D.northeast,
models.Windshielding1D.east,
models.Windshielding1D.southeast,
models.Windshielding1D.south,
models.Windshielding1D.southwest,
models.Windshielding1D.west,
models.Windshielding1D.northwest,
)
.order_by(models.Windshielding.id)
.order_by(models.Windshielding1D.id)
.as_structarray()
)

Expand Down

0 comments on commit 2e72e0b

Please sign in to comment.