Skip to content

[out3Plot]: add functionality for assets#1277

Open
awirb wants to merge 6 commits into
masterfrom
addInfra
Open

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

Conversation

@awirb
Copy link
Copy Markdown
Contributor

@awirb awirb commented May 20, 2026

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
Copy link
Copy Markdown
Contributor

qltysh Bot commented May 20, 2026

❌ 2 blocking issues (2 total)

Tool Category Rule Count
black Style Incorrect formatting, autoformat by running qlty fmt. 2

@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
Comment thread avaframe/in1Data/getInput.py
Comment thread avaframe/tests/test_particleTools.py
@qltysh
Copy link
Copy Markdown
Contributor

qltysh Bot commented May 20, 2026

Qlty


Coverage Impact

⬇️ Merging this pull request will decrease total coverage on master by 0.10%.

Modified Components (1)

RatingComponent% Diff
Coverage rating: C Coverage rating: C
com1DFA95.2%

Modified Files with Diff Coverage (4)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: B
avaframe/in1Data/getInput.py3.3%1209-1250
Coverage rating: B Coverage rating: B
avaframe/com1DFA/com1DFA.py100.0%
Coverage rating: F Coverage rating: D
avaframe/com1DFA/particleTools.py94.1%1054
Coverage rating: B Coverage rating: B
avaframe/com1DFA/deriveParameterSet.py100.0%
Total41.2%
🤖 Increase coverage with AI coding...
In the `addInfra` branch, add test coverage for this new code:

- `avaframe/com1DFA/particleTools.py` -- Line 1054
- `avaframe/in1Data/getInput.py` -- Line 1209-1250

🚦 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.

Copy link
Copy Markdown
Contributor

@fso42 fso42 left a comment

Choose a reason for hiding this comment

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

Wrong PR, sorry

Copy link
Copy Markdown
Contributor

@fso42 fso42 left a comment

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
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