In [1]:
Copied!
from fm2prof import Project
from fm2prof.utils import VisualiseOutput
# Initialize the project
project = Project(r"../../tests/test_data/cases/case_02_compound/fm2prof_config.ini")
# The VisualiseOutput class imports all FM2PROF output files
vis = VisualiseOutput(
project.get_output_directory(), logger=project.get_logger()
)
# To loop over all cross-sections, use the following generator
cross_sections = list(vis.cross_sections)
# To print the z-values of the first cross-section:
print(cross_sections[0].get('levels'))
from fm2prof import Project
from fm2prof.utils import VisualiseOutput
# Initialize the project
project = Project(r"../../tests/test_data/cases/case_02_compound/fm2prof_config.ini")
# The VisualiseOutput class imports all FM2PROF output files
vis = VisualiseOutput(
project.get_output_directory(), logger=project.get_logger()
)
# To loop over all cross-sections, use the following generator
cross_sections = list(vis.cross_sections)
# To print the z-values of the first cross-section:
print(cross_sections[0].get('levels'))
╔═════╣ 2024-05-07 21:03 Starting new task: Loading configuration file ║ DEBUG T+ 0.01s Received ini file: ..\..\tests\test_data\cases\case_02_compound\fm2prof_config.ini ║ WARNING T+ 0.05s Could not find optional input file for RegionPolygonFile, skipping ║ WARNING T+ 0.07s Could not find optional input file for SectionPolygonFile, skipping ║ WARNING T+ 0.12s exportmapfiles is not a known key ║ ERROR T+ 0.13s Unexpected error reading (debug) parameters. Check config file ╚═════╣ Task finished in 0.15sec ================================================================================ FM2PROF version 2.3.2 Documentation: https://deltares.github.io/Fm2Prof/ Authors: Koen Berends, Asako Fujisaki, Carles Soriano Perez, Ilia Awakimjan Contact: koen.berends@deltares.nl License: LPGL license. For more info see LICENSE.txt Copyright 2016-2020, University of Twente & Deltares ================================================================================ [input] 2DMapOutput = ..\..\tests\test_data\cases\case_02_compound\Data\2DModelOutput\FlowFM_map.nc# Output file from FM2D model (.net file) CrossSectionLocationFile = ..\..\tests\test_data\cases\case_02_compound\Data\cross_section_locations.xyz# .csv or .txt file (, as delimiter) that contains four columns: X_coordinate,Y_coordinate,BranchName,Length,Chainage. RegionPolygonFile = # User defined polygons in json format SectionPolygonFile = # User defined polygons in json format [parameters] CaseName = # Subdirectory name under OutputDir (no space); if not specified, 'CaseXX' (01, 02..) are used MaximumPointsInProfile = 20 # Number of points which are used to generate cross-sections ConveyanceDetectionMethod = 1 # [0] method based on mean flow velocity, [1] method based on maximum flow velocity (default) AbsoluteVelocityThreshold = 0.01 # Absolute velocity threshold in m/s. Used to determine storage RelativeVelocityThreshold = 0.03 # Relative velocity threshold (percentage). Used to determine storage MinimumDepthThreshold = 0.02 # Minimum depth (m) for storage identification BedlevelCriterium = 0.05 # Ignore the lowest percentage of bed level points LakeTimesteps = 10 # Number of timesteps that are used for identifying lakes ExtrapolateStorage = True # Add storage to water level independent cross-section section SDCorrection = True # Use summerdike volume correction SDFloodplainBase = 0.5 # minimum distance between floodplain base level and crest level in meters SDTransitionHeight = 0.5 # Transition height at the summer dike (m) SDOptimisationMethod = 0 # [0] Optimise on Total volume, [1] optimise on flow volume, [2] optimise on both FrictionWeighingMethod = 0 # Options. [0] arithmetric mean, [1] Weighted average SkipMaps = 0 # number of timesteps to skip at begin of 2D output. Use to skip problems related to initial conditions. ClassificationMethod = 0 # How to classify 2D output using Section and Region polygons. Options: [0] Do not classify regions or sections. [1] Use DeltaShell MinimumTotalWidth = 0.5 # Minimum width in meters. Zero width may lead to numerical instability in 1D solvers [debug] ExportCSSData = False # If True, exports pickled (1) input data for cross-section object, (2) flow mask for conveyance/storage. ExportMapFiles = False # Export detailed map output. Only use for small models or limited number of cross-sections b/c output can be huge. CssSelection = # provide comma separated list of ints; e.g. 38, 39, 40. Leave empty to generate all cross-sections [output] OutputDirectory = output # Output files are saved in OutputDir/CaseName; if not specified, subdirectory is created in the current directory ║ INFO T+ 0.28s Using ..\..\tests\test_data\cases\case_02_compound\output\figures as output directory for figures
[-2.025, -2.015, -1.9486, -1.9055, -1.8261, -1.7498, -1.6281, -1.5567, -1.4315, -1.3622, -0.571, -0.0747, -0.0391, -0.0216, -0.0049, 0.0695, 0.4215, 0.835, 1.243, 1.7807]
To visualise the first cross-section:
In [3]:
Copied!
# Plot the first cross-section
vis.figure_cross_section(cross_sections[0], save_to_file=False, overwrite=True)
# You can loop over the generator to create figures in a bunch:
#for css in vis.cross_sections:
# vis.figure_cross_section(css)
# Plot the first cross-section
vis.figure_cross_section(cross_sections[0], save_to_file=False, overwrite=True)
# You can loop over the generator to create figures in a bunch:
#for css in vis.cross_sections:
# vis.figure_cross_section(css)
Plot roughness¶
To plot roughness along a branch: