Conversation
❌ 1 blocking issue (3 total)
|
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (1)
🛟 Help
|
fso42
left a comment
There was a problem hiding this comment.
Please add an init.py in c2
|
|
||
| artificial_height = cfgDebris["GENERAL"]["energyHeight"] | ||
| if artificial_height == "elevation": | ||
| artificial_raster_height = rasterio.open(output_dir / "elevation.asc") |
There was a problem hiding this comment.
This is never closed. Either use with or explicitly close it
| # Open the DEM file | ||
| # Preprocess the DEM file if necessary | ||
| processed_dem_file = preprocess_raster(dem_file) | ||
| dataset = rasterio.open(processed_dem_file) |
| # Clean up the temporary file if preprocessing was done | ||
| if processed_dem_file != dem_file: | ||
| processed_dem_file.unlink() # Deletes the temporary file | ||
| fin = "finished" |
There was a problem hiding this comment.
This and the if seen to be dead code? fin is alway finished?
| max_val = np.amax(band3) | ||
| band3 = band3 / max_val | ||
| meanh = volume / perimeter | ||
| band4 = band3 * meanh |
There was a problem hiding this comment.
This is overwritten 5 lines down without ever being used. Is this intentional?
| position = [row, col] | ||
| band2.fill(0) | ||
|
|
||
| band3[0, 0] = 0 |
| mcsmax = 500 | ||
|
|
||
| # Flowpath simulation | ||
| for x in range(0, 100000): |
| band3 = np.copy(band) | ||
| band3.fill(0) | ||
| area = 0 | ||
| mcsmax = 500 |
| # significant over longer distances. A smaller denominator causes faster decay, meaning | ||
| # the decay factor approaches zero more quickly. | ||
| distance = np.sqrt((position[0] - row) ** 2 + (position[1] - col) ** 2) | ||
| decay_factor = np.exp(-distance / 100) # Example decay factor with denominantor=100 |
There was a problem hiding this comment.
Same here, controlable via ini?
| # and distribute them more evenly. It simulates the physical process of diffusion, | ||
| # in which material or energy moves from areas of high concentration to areas of low | ||
| # concentration. | ||
| kernel = np.array([[0.05, 0.1, 0.05], |
| and edit ``local_debrisframeCfg.ini`` with your favorite text editor and adjust the variable | ||
| ``avalancheDir`` for example to ``data/debrisTopRun``, then run:: | ||
|
|
||
| python runC2ToprunDF.py |
There was a problem hiding this comment.
Typo: TopRun instead of Toprun

runC2TopRunDF.pyexecutes pyTopRunDF for one scenario.The file
TopRunDF.pyis modified,batch_select_process.pyis not used here (since a run of multiple scenarios is not enabled yet), the other files are directly used from the pyTopRunDF repository. The pyTopRunDF repository is integrated via a submodule intoc2TopRunDF/pyTopRunDF, from where the original scripts are executed.The modification of
TopRunDF.pyenables more consistency with the AvaFrame/DebrisFrame configuration and input handling:c2TopRunDFCfg.inifile instead of a.jsonfile (including a different location!)avalanchedir/Inputs, theavalanchediris defined indebrisframe.ini(orlocal_debrisframe.ini) instead ofScenarios/Scenario_{num}avalanchedir/Outputsinstead ofOutputs/Scenario_{num}Adding a global seed to the random functions yields the same result as that computed with the original code (with the same seed) for
Scenario_1(in pyTopRunDF repository.Documentation ends up here:
https://docs.debrisframe.org/en/ps_toprundf/installation.html