Showing 48 of 134 total issues
File model_framework.py
has 574 lines of code (exceeds 300 allowed). Consider refactoring. Open
"""
The module :mod:`~smrf.framework.model_framework` contains functions and
classes that act as a major wrapper to the underlying packages and modules
contained with SMRF. A class instance of
:class:`~smrf.framework.model_framework.SMRF` is initialized with a
File solar.py
has 411 lines of code (exceeds 300 allowed). Consider refactoring. Open
from smrf.distribute import image_data
from smrf.envphys.constants import IR_WAVELENGTHS, VISIBLE_WAVELENGTHS
from smrf.envphys.solar import cloud, toporad, vegetation
from smrf.utils import utils
File precipitation.py
has 404 lines of code (exceeds 300 allowed). Consider refactoring. Open
import netCDF4 as nc
import numpy as np
from smrf.distribute import image_data
from smrf.envphys import precip, Snow, storms
Function stationMaxus
has a Cognitive Complexity of 32 (exceeds 8 allowed). Consider refactoring. Open
def stationMaxus(self, data_speed, data_direction):
"""
Determine the maxus value at the station given the wind direction.
Can specify the enhancemet for each station or use the default, along
with whether or not the station is on a peak which will ensure that
- 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 ephemeris
has 88 lines of code (exceeds 30 allowed). Consider refactoring. Open
def ephemeris(dt):
"""
Calculates radius vector, declination, and apparent longitude
of sun, as function of the given date and time.
Function initialize
has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring. Open
def initialize(self, topo, data, date_time=None):
self._logger.debug('Initializing distribute.precip')
self.date_time = date_time
- 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 utils.py
has 344 lines of code (exceeds 300 allowed). Consider refactoring. Open
import copy
import os
import random
import sys
from datetime import datetime
File model.py
has 339 lines of code (exceeds 300 allowed). Consider refactoring. Open
from __future__ import print_function
import os
# import matplotlib.pyplot as plt
# import progressbar
Function tracking_by_station
has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring. Open
def tracking_by_station(precip, mass_thresh=0.01, steps_thresh=3):
"""
Processes the vector station data prior to the data being distributed
Args:
- 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 sunang.py
has 323 lines of code (exceeds 300 allowed). Consider refactoring. Open
import logging
from math import asin, atan, cos, fmod, sin, sqrt, tan
import numpy as np
import pytz
Function put
has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring. Open
def put(self, item, block=True, timeout=None):
"""Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
- 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 adjust_for_undercatch
has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring. Open
def adjust_for_undercatch(p_vec, wind, temp, sta_type, metadata):
"""
Adjusts the vector precip station data for undercatchment. Relationships
should be added to :func:`~smrf.envphys.precip.catchment_ratio`.
- 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
SMRF
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class SMRF():
"""
SMRF - Spatial Modeling for Resources Framework
Args:
Function __init__
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
def __init__(self, config, external_logger=None):
"""
Initialize the model, read config file, start and end date, and logging
"""
# read the config file and store
- 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 distribute_for_marks2017
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def distribute_for_marks2017(self, data, precip_temp, ta, time):
"""
Specialized distribute function for working with the new accumulated
snow density model Marks2017 requires storm total and a corrected
precipitation as to avoid precip between storms.
- 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 run
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def run(self):
"""
Output the desired variables to a file.
Go through the date times and look for when all the queues
- 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 hord
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def hord(self, x, y, z):
'''
Calculate the horizon pixel for all z
This mimics the simple algorthim from Dozier 1981 but
was adapated for use in finding the maximum upwind slope
- 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 get
has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring. Open
def get(self, index, block=True, timeout=None):
"""
Remove and return an item from the queue.
If optional args 'block' is true and 'timeout' is None (the default),
- 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 rotate
has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring. Open
def rotate(mu, azm, mu_r, lam_r):
"""
Calculates new spherical coordinates if system rotated about
origin. Coordinates are right-hand system. All angles are in
radians.
- 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 simulateWind
has 38 lines of code (exceeds 30 allowed). Consider refactoring. Open
def simulateWind(self, data_speed):
"""
Calculate the simulated wind speed at each cell from flatwind and the
distributed directions. Each cell's maxus value is pulled from the
maxus library based on the distributed wind direction. The cell's maxus