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
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.
add pytest add particle traj interpolation add remeshing if required, pytests, affected cells that do not affect assets update docu add debug plot

PR Checklist
Please confirm before requesting review:
pytestlocally without failsConfirm before the final merge/rebase into master