maxSolarRad defaults to hardware preferred. Assuming it is not supplied by the driver, it is calculated in wxxtypes.py The function is below. Note that the default for maxSolarRad_algo is ‘rs’. def calc_maxSolarRad(self, key, data, db_manager): altitude_m = weewx.units.convert(self.altitude_vt, 'meter')[0] if self.maxSolarRad_algo == 'bras': val = weewx.wxformulas.solar_rad_Bras(self.latitude_f, self.longitude_f, altitude_m, data['dateTime'], self.nfac) elif self.maxSolarRad_algo == 'rs': val = weewx.wxformulas.solar_rad_RS(self.latitude_f, self.longitude_f, altitude_m, data['dateTime'], self.atc) else: raise weewx.ViolatedPrecondition("Unknown solar algorithm '%s'" % self.maxSolarRad_algo) return ValueTuple(val, 'watt_per_meter_squared', 'group_radiation') wxformulas.py: solar_rad_RS: from weewx.almanac import Almanac if atc < 0.7 or atc > 0.91: atc = 0.8 if ts is None: ts = time.time() sr = 0.0 try: alm = Almanac(ts, lat, lon, altitude_m) el = alm.sun.alt # solar elevation degrees from horizon R = alm.sun.earth_distance z = altitude_m nrel = 1367.0 # NREL solar constant, W/m^2 sinal = math.sin(math.radians(el)) if sinal >= 0: # sun must be above horizon rm = math.pow((288.0 - 0.0065 * z) / 288.0, 5.256) \ / (sinal + 0.15 * math.pow(el + 3.885, -1.253)) toa = nrel * sinal / (R * R) sr = toa * math.pow(atc, rm) except (AttributeError, ValueError, OverflowError): sr = None return sr On Dec 1, 2025, at 8:19 PM, John Smith <[email protected]> wrote: -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/weewx-development/73AA04EB-0937-407C-A00E-F577D49A79EA%40johnkline.com. |
Re: [weewx-development] Where does the crt extension get the value for SolarMax?
'John Kline' via weewx-development Mon, 01 Dec 2025 20:38:12 -0800
- [weewx-development] Where does the ... 'Peter Fletcher' via weewx-development
- Re: [weewx-development] Where ... John Smith
- Re: [weewx-development] Wh... 'Peter Fletcher' via weewx-development
- Re: [weewx-development... John Smith
- Re: [weewx-develop... 'John Kline' via weewx-development
- Re: [weewx-de... John Smith
- Re: [weew... 'John Kline' via weewx-development
- Re: [... John Smith
