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

Add checks related to vegetation and variable friction #353

Merged
merged 25 commits into from
Jan 31, 2024

Conversation

margrietpalm
Copy link
Contributor

@margrietpalm margrietpalm commented Jan 22, 2024

I added a load of checks. See detailed description below (ticket was not very clear). Note that the contents of these checks needs to be double checked by @GolnesaK or @nvolp.

Note that the tests fail because threedi-schema 0.219 hasn't been released, see nens/threedi-schema#51.

Added checks

The added checks involve variable friction, vegetation and variable vegetation.

Type checks for variable properties

  • table: CrossSectionDefinition
  • columns: friction_values, vegetation_drag_coefficients, vegetation_heights, vegetation_stem_diameters, vegetation_stem_densities
  • conditions:
    • string is space-separated
    • each element can be converted to a float
  • effect: raise error

Check column length of variable properties

  • table: CrossSectionDefinition
  • columns: friction_values, vegetation_drag_coefficients, vegetation_heights, vegetation_stem_diameters, vegetation_stem_densities
  • conditions:
    • the number of values in each column should be exactly one less than those in CrossSectionDefinition.width and CrossSectionDefinition.height
  • effect: raise error

Range checks for variable friction and vegetation properties

Vegetation

  • table: CrossSectionLocation
  • columns: vegetation_drag_coefficient, vegetation_height, vegetation_stem_diameter, vegetation_stem_density
  • conditions: every value is >= 0
  • effect: raise error

Variable vegetation

  • table: CrossSectionDefinition
  • columns: vegetation_drag_coefficients, vegetation_heights, vegetation_stem_diameters, vegetation_stem_densities
  • conditions: every value is >= 0
  • effect: raise error

Variable friction

  • table: CrossSectionDefinition
  • column: friction_values
  • conditions:
    • all values >= 0
    • all values < 1 in case of Manning friction
  • effect: raise error

Limit to open channels

  • table: CrossSectionDefinition
  • columns: friction_values, vegetation_drag_coefficients, vegetation_heights, vegetation_stem_diameters, vegetation_stem_densities
  • condition: column is defined and the profile is open and the y coordinate is monotonically increasing
  • effect: raise error

Missing friction values

  • columns: CrossSectionDefinition.friction_values and CrossSectionLocation.friction_value
  • conditions:
    • CrossSectionLocation.shape is not TABULED_YZ and CrossSectionLocation.friction_value is defined
    • CrossSectionLocation.shape is TABULED_YZ and CrossSectionLocation.friction_value and/or CrossSectionDefinition.friction_values is defined
  • effect: raise error

Limit variable friction and vegetation to cross section shape TABULATED_YZ

  • table: CrossSectionLocation
  • columns: vegetation_drag_coefficient, vegetation_height, vegetation_stem_diameter, vegetation_stem_density
  • condition:
    • shape must be TABULATED_YZ
  • effect: raise error

Dependence friction type and vegetation

  • Fixed parameters:
    • table: CrossSectionLocation
    • columns: vegetation_drag_coefficient, vegetation_height, vegetation_stem_diameter, vegetation_stem_density
  • Variable parameters
    • table: CrossSectionDefinition
    • columns: friction_values, vegetation_drag_coefficients, vegetation_heights, vegetation_stem_diameters, vegetation_stem_densities
  • condition: friction type is CHEZY or CHEZY_CONVEYANCE
  • effect: raise

Handling cases with fixed and variable parameters defined for friciton of vegetation

  • non-conveyance friction: raise warning mentioning that fixed value (from CrossSectionLocation) is used
  • conveyance friction: raise warning mentioning that variable value (from CrossSectionDefinition) is used

@margrietpalm margrietpalm marked this pull request as draft January 22, 2024 13:48
@margrietpalm margrietpalm changed the title WIP: Add checks related to vegetation and variable friction Add checks related to vegetation and variable friction Jan 23, 2024
@margrietpalm margrietpalm marked this pull request as ready for review January 23, 2024 12:33
@margrietpalm margrietpalm requested a review from elisalle January 23, 2024 12:34
@margrietpalm margrietpalm linked an issue Jan 23, 2024 that may be closed by this pull request
4 tasks
@elisalle
Copy link
Collaborator

elisalle commented Jan 23, 2024

Note that the tests fail because threedi-schema 0.219 hasn't been released, see nens/threedi-schema#51.

nens/threedi-schema#51 has been approved with one requested change; could you fix, merge and release it to see if the tests run afterwards? @margrietpalm

Copy link
Collaborator

@elisalle elisalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks fine; I haven't tested the checks in depth. Again just a few small changes, and the changelog needs updating.

margrietpalm and others added 2 commits January 29, 2024 09:26
Co-authored-by: Eli Sallé <eli.salle@nelen-schuurmans.nl>
@elisalle elisalle self-requested a review January 29, 2024 08:53
column=col,
shapes=(constants.CrossSectionShape.TABULATED_YZ,),
)
for col in vegetation_parameter_columns
Copy link
Collaborator

@elisalle elisalle Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for col in vegetation_parameter_columns
for col in [
*vegetation_parameter_columns,
models.CrossSectionDefinition.friction_values
]

if they use the same error code it would be nice if the checks are together

@margrietpalm margrietpalm marked this pull request as draft January 29, 2024 15:38
@margrietpalm
Copy link
Contributor Author

Changed to draft because a check has to be added that all vegetation parameters are present together.

@margrietpalm margrietpalm marked this pull request as ready for review January 31, 2024 11:14
Copy link
Collaborator

@elisalle elisalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really neat! I like the new base check; very useful.

@margrietpalm margrietpalm merged commit 0d3ddd5 into master Jan 31, 2024
5 checks passed
@margrietpalm margrietpalm deleted the margriet_339-var-friction-and-veg branch January 31, 2024 14:56
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.

Schematisation checks for variable roughness in YZ profiles
2 participants