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?
There was a problem hiding this comment.
default is chosen as option for remeshInterpMethod, to represent the currently used 'default' method, which is a combination of bilinear and cubic, depending which function, remeshData or resizeData in geoTrans.py, is called also in remeshData there are more options..
| 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.
There was a problem hiding this comment.
this is on purpose to reproduce the current behavior of com1DFA - hence the option default is introduced and not bilinear is set
| "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.