scivision/glowaurora

View on GitHub

Showing 17 of 17 total issues

Function plotaurora has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def plotaurora(phitop, ver, zceta, photIon, isr, dtime, glat, glon):
    # %% incident flux at top of ionosphere
    ax = figure().gca()
    ax.plot(phitop.index, phitop['diffnumflux'])
    ax.set_title('Incident Flux', fontsize='x-large')
Severity: Major
Found in glowaurora/runglow_future.py - About 2 hrs to fix

    Function plotprodloss has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def plotprodloss(prod, loss, params, st):
        """ plot production/loss vs. alttiude """
    
        fg = figure(figsize=(15, 8))
        ax = fg.subplots(1, 2, sharey=True)
    Severity: Minor
    Found in glowaurora/plots.py - About 2 hrs 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 runglowaurora has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def runglowaurora(eflux, e0, dt, glat, glon, f107a, f107, f107p, ap, mass):
        chdir(glowpath)
        yd, utsec = datetime2yeardoy(dt)[:2]
    
        z = arange(80, 110 + 1, 1)
    Severity: Minor
    Found in glowaurora/runglow_future.py - About 2 hrs to fix

      Function _plotver has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def _plotver(sim, params, supertitle):
          if 'phitop' not in sim:
              return
      
          fg = figure(figsize=(15, 8))
      Severity: Minor
      Found in glowaurora/plots.py - About 1 hr to fix

        Function runglowaurora has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def runglowaurora(params: dict, z_km: np.ndarray = None) -> xarray.Dataset:
            """ Runs Fortran GLOW program and collects results in friendly arrays with metadata. """
            # %% (-2) check/process user inputs
            assert isinstance(params['flux'], (float, int, np.ndarray))
            assert isinstance(params['E0'], (float, np.float32, int))
        Severity: Minor
        Found in glowaurora/__init__.py - About 1 hr to fix

          Function runglowaurora has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def runglowaurora(eflux, e0, dt, glat, glon, f107a, f107, f107p, ap, mass):
          Severity: Major
          Found in glowaurora/runglow_future.py - About 1 hr to fix

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

            def runglowaurora(params: dict, z_km: np.ndarray = None) -> xarray.Dataset:
                """ Runs Fortran GLOW program and collects results in friendly arrays with metadata. """
                # %% (-2) check/process user inputs
                assert isinstance(params['flux'], (float, int, np.ndarray))
                assert isinstance(params['E0'], (float, np.float32, int))
            Severity: Minor
            Found in glowaurora/__init__.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 verprodloss has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def verprodloss(params: dict):
                """ for a single time, computes VER, production, and loss vs. unit input flux
                inputs:
                -------
                t: a single datetime() when the eigenprofiles should be computed (solar zenith angle computed in Fortran code)
            Severity: Minor
            Found in glowaurora/__init__.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 rungtdGLOW has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def rungtdGLOW(dtime, altkm, glat, glon, f107a, f107, ap, mass, tselecopts):
            Severity: Major
            Found in glowaurora/runmsisGLOW.py - About 1 hr to fix

              Function rundayglow has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def rundayglow(t0, glat, glon, f107a, f107, f107p, ap, conj=True):
                  '''
                  Run GLOW for no auroral input, to simulate Dayglow.
              
                  conj = whether to account for photoelectrons from conjugate hemisphere
              Severity: Minor
              Found in glowaurora/__init__.py - About 1 hr to fix

                Function test_glowmsis has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def test_glowmsis(dtime, altkm, glat, glon, f107a, f107, ap, mass):
                Severity: Major
                Found in examples/demo_msis.py - About 1 hr to fix

                  Function rundayglow has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def rundayglow(t0, glat, glon, f107a, f107, f107p, ap, conj=True):
                  Severity: Major
                  Found in glowaurora/__init__.py - About 1 hr to fix

                    Function plotaurora has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def plotaurora(phitop, ver, zceta, photIon, isr, dtime, glat, glon):
                    Severity: Major
                    Found in glowaurora/runglow_future.py - About 1 hr to fix

                      Avoid deeply nested control flow statements.
                      Open

                                      for prate, lrate, E0 in zip(sim['prates'], sim['lrates'], EKpcolor):
                                          # production eigenprofiles
                                          plotprodloss(z, prate, lrate, t, glat, glon, zlim,
                                                       f'Volume Production/Loss Rates', ' E0: {E0:.0f}')
                                          # loss eigenprofiles
                      Severity: Major
                      Found in examples/RunLoop.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            for s in r.T:
                                                a.plot(s, s.z_km, label=s.reaction.item())
                        
                        
                        Severity: Major
                        Found in glowaurora/plots.py - About 45 mins to fix

                          Function plotaurora has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def plotaurora(params: dict, sim: xarray.Dataset):
                              """ Plot all sorts of auroral/dayglow parameters from GLOW simulation. """
                              makeplot = params['makeplot']
                              if not makeplot:
                                  return
                          Severity: Minor
                          Found in glowaurora/plots.py - About 35 mins 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 ekpcolor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def ekpcolor(eigen):
                              """ Loads electron energy bins from .csv file.
                              This would be the gridding that a Transcar simulation used, so that Glow and Transcar
                              are run on the same energy bins.
                              """
                          Severity: Minor
                          Found in glowaurora/__init__.py - About 35 mins 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