Skip to content

[com7,in4] add regional modeling workflow for com1DFA#1053

Merged
fso42 merged 11 commits intomasterfrom
regional
Sep 9, 2025
Merged

[com7,in4] add regional modeling workflow for com1DFA#1053
fso42 merged 11 commits intomasterfrom
regional

Conversation

@leon-wagner
Copy link
Contributor

@leon-wagner leon-wagner commented Dec 10, 2024

https://docs.avaframe.org/en/regional/

  • Make sure everything is corretly reset
  • make sure documentation is consistent (e.g. merge in4 doc into com7)
  • mv shape reading or use existing functin in shpConversion

@leon-wagner leon-wagner added the enhancement New feature or request label Dec 10, 2024
@leon-wagner leon-wagner requested a review from fso42 December 10, 2024 13:52
@leon-wagner leon-wagner self-assigned this Dec 10, 2024
@leon-wagner leon-wagner changed the title Com7Regional Com7Regional and input splitting Dec 18, 2024
@leon-wagner leon-wagner marked this pull request as draft January 14, 2025 15:31
@leon-wagner leon-wagner marked this pull request as ready for review February 12, 2025 09:56
@leon-wagner leon-wagner changed the title Com7Regional and input splitting Com7Regional and In4 input splitting Feb 12, 2025
@leon-wagner leon-wagner changed the title Com7Regional and In4 input splitting [com7,in4] add regional modeling workflow for com1DFA Feb 12, 2025
Copy link
Contributor

@awirb awirb left a comment

Choose a reason for hiding this comment

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

I didn't check the pytests and the docu, still TODO

- it now can correctly split DEM in squares and move them as well as release features. Complete workflow possible to test. Some updates to runRegional

- next step: introduce configurations and com1 overrides

splitting script and regional prototype progress

- regional is now its own computational module (com7)
- introduced configurations and overrides for in4 and com7
- in regionalRun, peak files may now be moved to a single outDir
- smaller changes

rework to preliminary moveOrCopyPeakFiles feature

splitInputs "grouping" feature first step

- Features in the input shapefile with identical names before the first underscore are added to the same folder and release shapefile

introducing catchment and scenario grouping

- grouping by name attribute
- grouping by scenario attribute
- improvements and streamlining of the whole script
- improvements and fixes to Com7
- next steps: fix to how the DEM is clipped, split ENT and RES

bug fixes and improvements

- change to shapefile data structure reading
- improved scenario grouping
- smaller fixes to com7

add log info about the number of successes in the processed directories

PR feedback
- docstrings
- add prj writing
- ini override description
- add subfunction writeShapefile

- use glob
- PR feedback: rework splitByScenarios, simplify moveOrCopyPeakFiles, etc..
- moved splitInputs dir to be created in "Outputs / in4Region", adjust com7 accordingly
- clearer logging
- other fixes/improvements

rework DEM clipping and add write report
- incorporate PR feedback
- small improvements to docstrings, comments
- fix log output peakFiles

add written report; create 2 visual reports
- changes to docstrings, visual report, and other fixes

move everything from in4 to com7Regional

- add labels and cbar to visual report

bug fixes; QoL improvements

- bug fixes: handle case sensitivity in attributes; empty input geometries
- regionalDir may now be set in com7 config
- docstrings

group by new "Group" attribute instead of by "Name"

- suggestion by WLV

refactor scenario splitting function; reduce size of stored DEM extents

- fixes issue related to RES and ENT being outside DEM bounds when running com1
- control plot & report generation through cfgMain
- DEM color bar via pU, new group color scheme

add feature for output raster merging in regional run

available methods:
- max
- min
- mean
- sum
- count

rework runScript; create com7Main function

- get total number of sims to perform at the start (not the most solid approach but can be reworked)
- create silent logger option
- set pfv max merge as the default output
@OpenNHM OpenNHM deleted a comment from qltysh bot Aug 28, 2025
@OpenNHM OpenNHM deleted a comment from qlty-cloud-legacy bot Aug 28, 2025
@OpenNHM OpenNHM deleted a comment from qlty-cloud-legacy bot Aug 28, 2025
@OpenNHM OpenNHM deleted a comment from qlty-cloud-legacy bot Aug 28, 2025
…ules

- Updated index to include new entries in the module list and toctree.

test(com7Regional, in4Region): add unit tests for modules and improve `splitInputs` configuration

- Added unit tests for `com7Regional` and `in4Region` modules, including `com7RegionalMain` and `splitInputsMain` functions.
- Introduced test configurations and data for validation of regional avalanche scenarios.
- Updated `splitInputsCfg.ini` to enhance documentation on the `bufferSize`, detailing its influence on group extent relative to release areas.
Copy link
Contributor

@awirb awirb left a comment

Choose a reason for hiding this comment

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

pytests and docu not yet reviewd

@fso42 fso42 requested a review from awirb September 5, 2025 12:44
- Adjusted `moveOrCopyPeakFiles` calls to streamline argument usage by removing `regionalDir`.
- Renamed and organized test data files in `testIn4Region` for better structure and consistency.
- Integrated new visual reports in documentation.

refactor(com7Regional): remove allTimestepOutput, fix tests to run with data in pytests

- Removed all references and operations related to `allTimeStepsDir` for simplification.
- Updated `moveOrCopyPeakFiles` and `com7RegionalMain` logic to return only `allPeakFilesDir` and `mergedRastersDir`.
- Replaced `ascUtils` with `rasterUtils` for improved raster operations across functions.
- Adjusted test cases to validate changes, ensuring consistency with the modified directory structure.
- Updated default `regionalDir` in configuration for better organization.

feat(com7Regional): add new regional input test files

refactor(com7Regional): streamline input handling and update `splitInputs` logic; fix flipped DEM

- Replaced manual DEM and release area file handling with `getInput` utilities
- Renamed `inputDir` to `avalancheDir` for clearer context in directory usage.
- Adjusted `clipAndMoveOptionalInput` to match the new directory structure and improve reliability.
- Simplified `runSplitInputs.py` script by removing obsolete `inputDir` definition.

refactor(docs): remove `in4Region` and merge content under `com7Regional` module

docs(com7Regional): update `splitInputs` documentation

- Added warnings about the module being under development.
- Improved explanations of input and output requirements/structures.
- Added details on running regional input management scripts and clarified examples.
- Updated references for `com1DFA` and corrected outdated file paths/descriptions.

refactor(tests): remove redundant `inputDir` assignment from `test_com7Regional`

refactor(shpConversion): consolidate shapefile operations and simplify `splitInputs`

- Moved reusable shapefile I/O functions (`readShapefile`, `writeShapefile`) to `shpConversion.py`
- Cleaned up unused imports and standardized string formatting for consistency.
… input handling

- Replaced directory-based file lookups in `clipAndMoveOptionalInput` with a dictionary-based approach using `allSimInputFiles`.
- Streamlined logging for missing files (ENT/RES)

docs(tinyHelper): update instructions for DEM extraction and fix data source link

fix(com7Regional): correct merged raster flip direction and update doc

- Fixed incorrect `flip` argument in `writeResultToRaster` for outputs.
- Standardized logging messages in `splitInputs` for missing files (`ENT`/`RES`).
- Updated `docs` to refine input/output documentation and clarify examples of directory structures.

refactor(com7Regional): simplify `mergeRasters` using `rasterio.merge`

- Replaced custom raster merging logic with `rasterio.merge`
- Removed parameters (`cellSize`, `noDataValue`) and related code.
- Fixed `flip` argument usage in `writeResultToRaster`.

refactor(com7Regional): simplify raster merging

- Replaced custom raster merging implementation with `rasterio.merge` supporting custom functions via `method=mergeMethod`.

refactor(com7Regional): update file handling; review AW

- Replaced multiple directory creation calls with `makeADir` for consistency.
- Enhanced comments and docstrings for better readability, including `splitInputsMain` and `moveOrCopyPeakFiles`.

refactor(out3Plot): revert `createExtentMinMax` with manual extent calculation

-
@fso42
Copy link
Contributor

fso42 commented Sep 8, 2025

Standardtests ok

@fso42 fso42 merged commit 41ab6c4 into master Sep 9, 2025
5 checks passed
@fso42 fso42 deleted the regional branch September 9, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants