Goswami, D. Yogi (2015) Principles of Solar Engineering, Third Edition ISBN 97-8-146656-3780 """ import calendar import logging import math import numba import numpy as np from climate_indices import utils # ------------------------------------------------------------------------------ # Retrieve logger and set desired logging level _logger = utils.get_logger(__name__, logging.DEBUG) # ------------------------------------------------------------------------------ # days of each calendar month, for non-leap and leap years _MONTH_DAYS_NONLEAP = np.array( [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) _MONTH_DAYS_LEAP = np.array([31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) # solar constant [ MJ m-2 min-1] _SOLAR_CONSTANT = 0.0820 # ------------------------------------------------------------------------------ # angle values used within the _sunset_hour_angle() function defined below # valid range for latitude, in radians
import logging from math import exp, lgamma, pi, sqrt import numba import numpy as np from climate_indices import utils # ------------------------------------------------------------------------------ # Retrieve logger and set desired logging level _logger = utils.get_logger(__name__, logging.WARN) # ------------------------------------------------------------------------------ def fit(timeseries: np.ndarray) -> dict: """ Returns the L-Moments fit (loc, scale, skew) corresponding to the input array of values. :param timeseries: :return: """ # estimate the L-moments of the values array lmoments = _estimate_lmoments(timeseries) # validate the L-Moments if (lmoments[1] <= 0.0) or (abs(lmoments[2]) >= 1.0): message = "Unable to calculate Pearson Type III parameters " + \ "due to invalid L-moments" _logger.error(message) raise ValueError(message)