def get_hour_angle_sunrise(declination: FlexNum, lat_r: FlexNum): """ calculates the hour angle of sunrise """ d = radians(declination) lat = lat_r # radians hour_angle_sunrise = degrees( arccos( (cos(radians(90.833)) / (cos(lat) * cos(d)) - tan(lat) * tan(d)))) return hour_angle_sunrise
def tan(self): if self.unit.is_angle(): return umath.tan( self.value * self.unit.conversion_factor_to(_unit_table['rad'])) else: raise TypeError('Argument of tan must be an angle')
def get_equation_of_time(oblique_corr: FlexNum, geomean_long: FlexNum, geomean_anom: FlexNum, earth_eccent: FlexNum): """ calculates the equation of time in minutes """ oc = radians(oblique_corr) gml = radians(geomean_long) gma = radians(geomean_anom) ec = earth_eccent vary = tan(oc / 2)**2 equation_of_time = 4 * degrees( vary * sin(2 * gml) - 2 * ec * sin(gma) + \ 4 * ec * vary * sin(gma) * cos(2 * gml) - \ 0.5 * vary * vary * sin(4 * gml) - \ 1.25 * ec * ec * sin(2 * gma)) return equation_of_time
def get_elevation(zenith: FlexNum): """ calculates solar elevation angle at ref_datetime""" # perform an approximate atmospheric refraction correction # matrix hour_angle calculations # these equations are hideous, but im not sure how to improve them without adding computational complexity if isinstance(zenith, np.ndarray) and zenith.shape: e = 90.0 - zenith ar = e * 0 ar[e > 85] = 0 ar[(e > 5) & (e <= 85)] = 58.1 / tan(radians(e[(e > 5) & (e <= 85)])) - \ 0.07 / tan(radians(e[(e > 5) & (e <= 85)])) ** 3 + \ 0.000086 / tan(radians(e[(e > 5) & (e <= 85)])) ** 5 ar[(e > -0.575) & (e <= 5)] = 1735 + e[(e > -0.575) & (e <= 5)] * \ (103.4 + e[(e > -0.575) & (e <= 5)] * ( -12.79 + e[(e > -0.575) & (e <= 5)] * 0.711)) ar[e <= -0.575] = -20.772 / tan(radians(e[e <= -0.575])) # scalar hour_angle calculations else: e = 90.0 - zenith er = radians(e) if e > 85: ar = 0 elif e > 5: ar = 58.1 / tan(er) - 0.07 / tan(er)**3 + 0.000086 / tan(er)**5 elif e > -0.575: ar = 1735 + e * (103.4 + e * (-12.79 + e * 0.711)) else: ar = -20.772 / tan(er) elevation_noatmo = e atmo_refraction = ar / 3600 elevation = elevation_noatmo + atmo_refraction return elevation
def tand(x): return tan(deg2rad(x))
def tan(self): if self.unit.isAngle(): return umath.tan(self.value * self.unit.conversionFactorTo(_unit_table["rad"])) else: raise TypeError("Argument of tan must be an angle")