Showing 281 of 942 total issues
Function plotParticleMotionTracking
has 67 lines of code (exceeds 30 allowed). Consider refactoring. Open
def plotParticleMotionTracking(avalancheDir, simName, dictVelAltThalweg, trackedPartProp, dictVelEnvelope, demSim,
modName, rasterTransfo, measuredData=''):
""" Create plot showing particle properties over time and along avalanche thalweg
in light blue envelope for all particles (filled between min and max values)
in dark blue the values for tracked particles
Function visuRunoutStat
has 66 lines of code (exceeds 30 allowed). Consider refactoring. Open
def visuRunoutStat(rasterTransfo, inputsDF, resAnalysisDF, newRasters, cfgSetup, pathDict):
"""
Panel1 reference peak field with runout points of all sims and distribution of runout SXY
Panel 2 crossMax values of peak field along thalweg for all sims
Panel 3 mean, median and envelope of cross max values for all sims
Function plotPresentation
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def plotPresentation(
simDF,
outDirTest,
cfgSimi,
xField,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function readFields
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def readFields(inDir, resType, simName="", flagAvaDir=True, comModule="com1DFA", timeStep="", atol=1.0e-6):
"""Read ascii files within a directory and return List of dictionaries
Parameters
-----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getCellsAlongLine
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def getCellsAlongLine(header, lineDict, addBuffer=True):
"""Find all raster cells crossed by the line
line has to be entierly contained on the raster extend. If addBuffer is True, add neighbour cells to the result
based on https://stackoverflow.com/a/35808540/15887086
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function probAnalysis
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def probAnalysis(avaDir, cfg, modName, parametersDict='', inputDir='', probConf='', simDFActual=''):
""" Compute probability map of a given set of simulation result exceeding a particular threshold and save to outDir
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function fetchReferenceSimNo
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def fetchReferenceSimNo(avaDir, inputsDF, comModule, cfg, inputDir=''):
""" Define reference simulation used for aimec analysis.
if the configuration files are available and a varParList is provided, the simulations
are ordered and the referenceSimValue is used to define the reference.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function filterSims
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def filterSims(avalancheDir, parametersDict, specDir="", simDF=""):
"""Filter simulations using a list of parameters and a pandas dataFrame of simulation configurations
if ~ is used as a prefix for a parameter - it is filtered according to values that do NOT match the value
provided with the ~Parameter
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getSimulation
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def getSimulation(cfg, rel, entResInfo):
""" Get a list of all simulations that shall be performed according to simTypeList in configuration file;
and a dictionary with information on release area
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File outDebugPlots.py
has 314 lines of code (exceeds 300 allowed). Consider refactoring. Open
import numpy as np
import pathlib
import copy
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
Function initializeParticles
has 62 lines of code (exceeds 30 allowed). Consider refactoring. Open
def initializeParticles(cfg, releaseLine, dem, inputSimLines="", logName="", relThField=""):
"""Initialize DFA simulation
Create particles and fields dictionary according to config parameters
release raster and dem
Function getFilterDict
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def getFilterDict(cfg, section):
""" Create parametersDict from ini file, for filtering simulations
Parameters
-----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File energyLineTest.py
has 307 lines of code (exceeds 300 allowed). Consider refactoring. Open
"""
Energy line test
This module runs a DFA simulation extracts the center of mass path
and compares it to the analytic geometric/alpha line solution
"""
Function plotVelThAlongThalweg
has 59 lines of code (exceeds 30 allowed). Consider refactoring. Open
def plotVelThAlongThalweg(pathDict, rasterTransfo, pftCrossMax, pfvCrossMax, cfgPlots, simName):
""" plot the velocity and thickness cross max values along the thalweg, with pft x10
only plot every barInt value
Parameters
Function readThickness
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def readThickness(infile, defname=None):
""" Read shapefile and fetch info on features' ids and thickness values
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function visuTransfo
has 54 lines of code (exceeds 30 allowed). Consider refactoring. Open
def visuTransfo(rasterTransfo, inputData, cfgSetup, pathDict):
"""
Plot and save the domain transformation figure
The left subplot shows the reference result raster with the outline of the
new domain. The second one shows this same data in the (s,l) coordinate
Function DFAIterate
has 54 lines of code (exceeds 30 allowed). Consider refactoring. Open
def DFAIterate(cfg, particles, fields, dem, inputSimLines, simHash=""):
"""Perform time loop for DFA simulation
Save results at desired intervals
Parameters
Function mergeParticleDict
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def mergeParticleDict(particles1, particles2):
"""Merge two particles dictionary
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function extendProfileBottom
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def extendProfileBottom(cfg, dem, profile):
""" extend the DFA path at the bottom (runout area)
Find the direction in which to extend considering the last point of the profile
and a few previous ones but discarding the ones that are too close
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function analyzeArea
has 52 lines of code (exceeds 30 allowed). Consider refactoring. Open
def analyzeArea(rasterTransfo, resAnalysisDF, simRowHash, newRasters, cfg, pathDict, contourDict):
"""Compare area results to reference.
Compute True positive, False negative... areas.