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

Added parameters for variable friction and 1D vegetation #50

Merged
merged 5 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog of threedi-schema
0.217.14 (unreleased)
---------------------

- Nothing changed yet.
- Add parameters vegetation_stem_density, vegetation_stem_diameter, vegetation_height and vegetation_drag_coefficient to CrossSectionLocation
- Add parameters friction_values, vegetation_stem_densities, vegetation_stem_diameters, vegetation_heights and vegetation_drag_coefficients to CrossSectionDefinition


0.217.13 (2023-10-02)
Expand Down
9 changes: 9 additions & 0 deletions threedi_schema/domain/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ class CrossSectionDefinition(Base):
height = Column(String(255))
shape = Column(IntegerEnum(constants.CrossSectionShape))
code = Column(String(100))
friction_values = Column(String)
vegetation_stem_densities = Column(String)
vegetation_stem_diameters = Column(String)
vegetation_heights = Column(String)
vegetation_drag_coefficients = Column(String)


class ConnectionNode(Base):
Expand Down Expand Up @@ -573,6 +578,10 @@ class CrossSectionLocation(Base):
friction_type = Column(IntegerEnum(constants.FrictionType), nullable=False)
friction_value = Column(Float, nullable=False)
bank_level = Column(Float)
vegetation_stem_density = Column(Float)
vegetation_stem_diameter = Column(Float)
vegetation_height = Column(Float)
vegetation_drag_coefficient = Column(Float)
the_geom = Column(Geometry("POINT"), nullable=False)
channel_id = Column(
Integer, ForeignKey(Channel.__tablename__ + ".id"), nullable=False
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""rename vegetation columns

Revision ID: 0218
Revises: 0217
Create Date: 2023-12-22 08:33

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = '0218'
down_revision = '0217'
branch_labels = None
depends_on = None

LOC_COLUMNS = (
"vegetation_stem_density",
"vegetation_stem_diameter",
"vegetation_height",
"vegetation_drag_coefficient",
"vegetation_drag_coeficients"
)

DEF_COLUMNS = (
"friction_values",
"vegetation_stem_densities",
"vegetation_stem_diameters",
"vegetation_heights",
"vegetation_drag_coefficients"
)


def upgrade():
with op.batch_alter_table("v2_cross_section_location") as batch_op:
for column in LOC_COLUMNS:
batch_op.add_column(sa.Column(column, sa.Float()))
with op.batch_alter_table("v2_cross_section_definition") as batch_op:
for column in DEF_COLUMNS:
batch_op.add_column(sa.Column(column, sa.String()))


def downgrade():
with op.batch_alter_table("v2_cross_section_location") as batch_op:
for column in LOC_COLUMNS:
batch_op.drop_column(column)
with op.batch_alter_table("v2_cross_section_definition") as batch_op:
for column in DEF_COLUMNS:
batch_op.drop_column(column)