Conversation
Analysis for project
|
| Tool | Category | Rule | Count | |
|---|---|---|---|---|
| black | Style | Incorrect formatting, autoformat by running qlty fmt. |
1 | ❌ |
@qltysh one-click actions:
- Auto-fix formatting (
qlty fmt && git push)
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Components (1)
Modified Files with Diff Coverage (5)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
fso42
left a comment
There was a problem hiding this comment.
def createAssetsRasterFromParticleLocations(particlesTimeArrays, dem, uniqueAssets,
assetsValues):
"""create a raster indicating particle trajectories colorcoded with assets
classes,
highest overrides lower classes"""
nTime, nPart = particlesTimeArrays["ID"].shape
particlesTimeArrays["assetsValue"] = np.full((nTime, nPart), np.nan)
particleAssets = np.full((dem["header"]["nrows"], dem["header"]["ncols"]),
np.nan)
# Process classes from low to high so higher classes naturally override lower
ones
for l in uniqueAssets:
assetCells = np.asarray(assetsValues["value_%d" % l])
inAsset = np.isin(particlesTimeArrays["inCellDEM"], assetCells)
for pId in range(nPart):
hitTimes = np.where(inAsset[:, pId])[0]
if len(hitTimes) == 0:
continue
# Mark particle trajectory up to the last time it hit this asset class
mMax = hitTimes[-1]
particlesTimeArrays["assetsValue"][:mMax, pId] = l
indX = particlesTimeArrays["indXDEM"][: mMax + 1, pId].astype(int)
indY = particlesTimeArrays["indYDEM"][: mMax + 1, pId].astype(int)
# Only overwrite cells not already set to a higher class
particleAssets[indY, indX] = np.where(
particleAssets[indY, indX] >= l, particleAssets[indY, indX], l
)
return particleAssets, particlesTimeArrays add pytest
ahuber-bfw
left a comment
There was a problem hiding this comment.
Schaut gut aus und läuft für ein paar Testbeispiele bei mir.
Hier noch ein paar Kommentare zu Details, die aber auch noch in einem separaten, kleineren PR noch angepasst/angeschaut werden könnten.
| # remesh if extent matches computational DEM within resizeThreshold x meshCellSize | ||
| resizeThreshold = 3 | ||
| # remeshing option for raster input data | ||
| remeshInterpMethod = default |
There was a problem hiding this comment.
Ist der Parameter hier im com1DFACfg.ini sinnvoll solange es nur die 2 optionen default (bilinear) und nearest gibt - oder schon als Platzhalter für mögliche Erweiterung der Interpolationsmethoden gedacht?
Weil aktuell macht 'nearest' eigentlich eh keinen Sinn für kontinuierliche Daten (z.B. DEMs) + über die API könnte man wo nötig trotzdem den Parameter für geoTrans.resizeData() auf "nearest" setzen?
|
|
||
|
|
||
|
|
||
| particle assets information |
There was a problem hiding this comment.
also provide a link/reference on howto perform the analysis with runScripts/runParticlesAssetsInfo at the end of this documentation?
sth. like
after simulation with `com1dfa` and required settings is finished the asset-analysis can be run with
* run:
::
pixi run python runScripts/runParticlesAssetsInfo.py
|
|
||
| # check extent and cell size of assets raster - if not aligned with computational mesh - remesh | ||
| pathToAssets, pathToAssetsFull, remeshedAssets = dP.checkExtentAndCellSize( | ||
| cfg, assetsFile, dem, "DEM", nanInsideDEMCheck=False |
There was a problem hiding this comment.
should "DEM" read "ASSETS" or "INFRA" here?
| elif interp == "nearest": | ||
| interpMethod = "nearest" | ||
| else: | ||
| message = 'Interpolation method "%s" not recognized' % (interp) |
There was a problem hiding this comment.
maybe here we can hint to valid options:
message = 'Interpolation method "%s" not recognized - (valid options: "default" (bilinear), "nearest" (NN))' % (interp)
| rasterRef : dict | ||
| reference raster dictionary | ||
| interp: str | ||
| default - refers to bilinear, other option is nearest |
There was a problem hiding this comment.
in projectOnRaster projectOnGrid() und resizeData wird als "default" "bilinear" interpoliert.
in remeshData remeshDataRio und remeshRaster wird als "default" "cubic" verwendet.
| "timePos": 0.0, | ||
| "timeNeigh": 0.0, | ||
| "timeField": 0.0, | ||
| "simTimestamp": 0.0, |
There was a problem hiding this comment.
runCom1DFA.py will crash with a KeyError if existing model runs without "simTimeStamp" are already present in the avaDir/Outputs --> starting with a clean avaDir works

No description provided.