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')
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)
- 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 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)
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))
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))
Function runglowaurora
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def runglowaurora(eflux, e0, dt, glat, glon, f107a, f107, f107p, ap, mass):
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))
- 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 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)
- 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 rungtdGLOW
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def rungtdGLOW(dtime, altkm, glat, glon, f107a, f107, ap, mass, tselecopts):
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
Function test_glowmsis
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_glowmsis(dtime, altkm, glat, glon, f107a, f107, ap, mass):
Function rundayglow
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def rundayglow(t0, glat, glon, f107a, f107, f107p, ap, conj=True):
Function plotaurora
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def plotaurora(phitop, ver, zceta, photIon, isr, dtime, glat, glon):
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
Avoid deeply nested control flow statements. Open
for s in r.T:
a.plot(s, s.z_km, label=s.reaction.item())
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
- 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 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.
"""
- 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"