Skip to content

[out3Plot]: add functionality for assets#1277

Open
awirb wants to merge 12 commits into
masterfrom
addInfra
Open

[out3Plot]: add functionality for assets#1277
awirb wants to merge 12 commits into
masterfrom
addInfra

Conversation

@awirb

@awirb awirb commented May 20, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@awirb awirb requested review from ahuber-bfw and fso42 May 20, 2026 12:47
@awirb awirb self-assigned this May 20, 2026
@qltysh

qltysh Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Analysis for project AvaFrame

❌ 1 blocking issue (1 total)

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)

Comment thread avaframe/com1DFA/particleTools.py
Comment thread avaframe/com1DFA/particleTools.py Outdated
Comment thread avaframe/com1DFA/particleTools.py Outdated
Comment thread avaframe/in1Data/getInput.py Outdated
Comment thread avaframe/in1Data/getInput.py
Comment thread avaframe/tests/test_particleTools.py
@qltysh

qltysh Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

⬆️ Merging this pull request will increase total coverage on master by 0.65%.

Modified Components (1)

RatingComponent% Diff
Coverage rating: C Coverage rating: C
com1DFA50.6%

Modified Files with Diff Coverage (5)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
avaframe/in1Data/getInput.py76.0%1300-1302, 1304-1306
Coverage rating: B Coverage rating: B
avaframe/com1DFA/com1DFA.py100.0%
Coverage rating: F Coverage rating: F
avaframe/com1DFA/particleTools.py33.9%1058, 1097-1149
Coverage rating: C Coverage rating: B
avaframe/com1DFA/deriveParameterSet.py86.4%1084-1089
Coverage rating: A Coverage rating: A
avaframe/in3Utils/geoTrans.py89.3%260, 264, 380
Total63.0%
🤖 Increase coverage with AI coding...
In the `addInfra` branch, add test coverage for this new code:

- `avaframe/com1DFA/deriveParameterSet.py` -- Line 1084-1089
- `avaframe/com1DFA/particleTools.py` -- Lines 1058 and 1097-1149
- `avaframe/in1Data/getInput.py` -- Lines 1300-1302 and 1304-1306
- `avaframe/in3Utils/geoTrans.py` -- Lines 260, 264, and 380

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@fso42 fso42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wrong PR, sorry

@fso42 fso42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  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                                        

Comment thread avaframe/com1DFA/com1DFA.py Outdated
Comment thread avaframe/runScripts/runParticlesAssetsInfo.py Outdated
Comment thread avaframe/in1Data/getInput.py Outdated
@fso42 fso42 added the enhancement New feature or request label May 27, 2026
Comment thread avaframe/com1DFA/com1DFA.py
Comment thread avaframe/in3Utils/geoTrans.py
Comment thread avaframe/tests/test_deriveParameterSet.py Outdated
@fso42 fso42 self-requested a review June 10, 2026 14:03
Comment thread avaframe/tests/test_deriveParameterSet.py Outdated
Comment thread avaframe/tests/test_deriveParameterSet.py Outdated
Comment thread avaframe/com1DFA/particleTools.py Outdated
Comment thread avaframe/tests/test_particleTools.py Outdated
Comment thread docs/moduleOut3Plot.rst Outdated
@awirb awirb requested a review from fso42 June 11, 2026 14:11
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.

2 participants