avaframe/AvaFrame

View on GitHub

Showing 281 of 942 total issues

Function putAvaNameOnPlot has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def putAvaNameOnPlot(ax, avaDir, date=True, color="k", fontsize=None):
    """
    Puts the date and avalanche name (or a list of ava names) in the lower left corner of the given
    matplotlib axes, if date=False only avalanche name is put

Severity: Minor
Found in avaframe/out3Plot/plotUtils.py - About 1 hr to fix

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 animationPlot has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def animationPlot(demData, data, cellSize, resType, cfgRangeTime, mtiInfo, timeStep):
    """3 panel plot: result in x,y, result in s, l, tt diagram

    Parameters
    -----------
Severity: Minor
Found in avaframe/out3Plot/outDistanceTimeAnalysis.py - About 1 hr to fix

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 addParticles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def addParticles(particles, nAdd, ind, mNew, xNew, yNew, zNew):
    """ add particles

    Parameters
    ----------
Severity: Minor
Found in avaframe/com1DFA/particleTools.py - About 1 hr to fix

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 initializeSimulation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def initializeSimulation(cfg, outDir, demOri, inputSimLines, logName):
    """create simulaton report dictionary

    Parameters
    ----------
Severity: Minor
Found in avaframe/com1DFA/com1DFA.py - About 1 hr to fix

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 resultVisu has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def resultVisu(cfgSetup, inputsDF, pathDict, cfgFlags, rasterTransfo, resAnalysisDF):
    """
    plot the normalized area difference between reference and other simulations
    """
    ####################################
Severity: Minor
Found in avaframe/out3Plot/outAIMEC.py - About 1 hr to fix

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 getDFAPathFromPart has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def getDFAPathFromPart(particlesList, addVelocityInfo=False):
    """ compute mass averaged path from particles

    Also returns the averaged velocity and kinetic energy associated
    If addVelocityInfo is True, information about velocity and kinetic energy is computed
Severity: Minor
Found in avaframe/ana5Utils/DFAPathGeneration.py - About 1 hr to fix

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 rewriteLocalCfgs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def rewriteLocalCfgs(cfgFull, avalancheDir, localCfgPath=''):
    """fetch all override sections in cfgFull and write a local_NAMEOVERRIDE.ini configuration file for the
    available sections - naming is collection_module_override
    if no localCfgPath is provided, default saved to avalancheDir/Inputs/configurationOverrides
    where package refers to e.g. ana1Tests, ana3AIMEC, etc-
Severity: Minor
Found in avaframe/in3Utils/cfgHandling.py - About 1 hr to fix

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 readAIMECinputs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def readAIMECinputs(avalancheDir, pathDict, defineRunoutArea, dirName='com1DFA'):
    """ Read inputs for AIMEC postprocessing

    Reads the required geometry files location for AIMEC postpocessing
    given an avalanche directory; avalanche path, DEM
Severity: Minor
Found in avaframe/ana3AIMEC/aimecTools.py - About 1 hr to fix

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 copyAimecPlots has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def copyAimecPlots(plotFiles, testName, outDir, plotPaths, rel=''):
    """ copy the aimec plots to report directory """

    if not isinstance(outDir, pathlib.PurePath):
        outDir = pathlib.Path(outDir)
Severity: Minor
Found in avaframe/log2Report/generateCompareReport.py - About 1 hr to fix

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 mainAIMEC has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def mainAIMEC(pathDict, inputsDF, cfg):
    """ Main logic for AIMEC postprocessing

    Reads the required files location for ana3AIMEC postprocessing
    given an avalanche directory
Severity: Minor
Found in avaframe/ana3AIMEC/ana3AIMEC.py - About 1 hr to fix

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 approachVelocity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def approachVelocity(mtiInfo):
    """ compute maximal approach velocity based on front location (range) and time step

        - cleans nan in range
        - neglects anything behind maximal runout
Severity: Minor
Found in avaframe/ana5Utils/distanceTimeAnalysis.py - About 1 hr to fix

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 plotComparisonDam has 36 lines of code (exceeds 30 allowed). Consider refactoring.
Open

def plotComparisonDam(cfg, simHash, fields0, fieldsT, header, solDam, tSave, limits, outDirTest):
    """Generate plots that compare the simulation results to the analytical solution

    Parameters
    -----------
Severity: Minor
Found in avaframe/out3Plot/outAna1Plots.py - About 1 hr to fix

    Function resultVisu has 35 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

    def resultVisu(cfgSetup, inputsDF, pathDict, cfgFlags, rasterTransfo, resAnalysisDF):
        """
        plot the normalized area difference between reference and other simulations
        """
        ####################################
    Severity: Minor
    Found in avaframe/out3Plot/outAIMEC.py - About 1 hr to fix

      Function generateOnePlot has 35 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

      def generateOnePlot(dataDict, outDir, cfg, plotDict):
          """ Create plot of ascii dataset
      
              Parameters
              ----------
      Severity: Minor
      Found in avaframe/out3Plot/outQuickPlot.py - About 1 hr to fix

        Function getSimiSolParameters has 35 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

        def getSimiSolParameters(solSimi, header, indTime, cfgSimi, Hini, gravAcc):
            """get flow thickness, flow velocity and center location of flow mass of similarity solution
            for required time step
        
            Parameters
        Severity: Minor
        Found in avaframe/ana1Tests/simiSolTest.py - About 1 hr to fix

          Function computeRunOut has 35 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

          def computeRunOut(cfgSetup, rasterTransfo, resAnalysisDF, transformedRasters, simRowHash):
              """ Compute runout based on peak field results
          
              Parameters
              ----------
          Severity: Minor
          Found in avaframe/ana3AIMEC/aimecTools.py - About 1 hr to fix

            Function plotThalwegTimeAltitudes has 11 arguments (exceeds 6 allowed). Consider refactoring.
            Open

            def plotThalwegTimeAltitudes(avalancheDir, simIndex, simDF, rasterTransfo, pfvCrossMax, modName, demSim, mtiInfo,
            Severity: Major
            Found in avaframe/out3Plot/outParticlesAnalysis.py - About 1 hr to fix

              Function addContour2Plot has 33 lines of code (exceeds 30 allowed). Consider refactoring.
              Open

              def addContour2Plot(ax1, fieldFT, simiDict, fieldHeader, limits, nLevels=9):
                  """Make a contour plot of flow thickness for analytical solution and simulation result"""
                  # get info on DEM extent
                  ncols = fieldHeader["ncols"]
                  nrows = fieldHeader["nrows"]
              Severity: Minor
              Found in avaframe/out3Plot/outAna1Plots.py - About 1 hr to fix

                Function getSArea has 33 lines of code (exceeds 30 allowed). Consider refactoring.
                Open

                def getSArea(rasterTransfo, dem):
                    """ Get the s curvilinear coordinate and area on the new raster
                
                    Find the scoord corresponding to the transformation and the Area of
                    the cells of the new raster
                Severity: Minor
                Found in avaframe/ana3AIMEC/aimecTools.py - About 1 hr to fix

                  Function fetchContourCoords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def fetchContourCoords(xGrid, yGrid, data, level):
                      """fetch contour line coordinates
                  
                      Parameters
                      -----------
                  Severity: Minor
                  Found in avaframe/out3Plot/plotUtils.py - About 1 hr to fix

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language