scivision/glowaurora

View on GitHub
glowaurora/__init__.py

Summary

Maintainability
B
6 hrs
Test Coverage

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

        There are no issues that match your filters.

        Category
        Status