Any idea what the difference between the 2 formulas in weeWX would be?

wxformulas.py links to a page with an excel spreadsheet which seems to use
macros instead of just formulas, but LibreOffice blocked them on security
grounds. The spreadsheet seems to have 4 models

Searching for solar radiation maximum "bras" didn't exactly turn up
anything relevant...

On Tue, 2 Dec 2025 at 15:38, 'John Kline' via weewx-development <
[email protected]> wrote:

> 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:
>
> 
> On Tue, 2 Dec 2025 at 14:14, 'Peter Fletcher' via weewx-development <
> [email protected]> wrote:
>
>> No. The logic of the crt code implies that it is a* theoretical* max
>> value, and the actual values reported in realtime.txt are consistent with
>> this.
>>
>
> What's it based on, latitude?
>
> --
> 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/CAGTinV4dWNWAJixkt1CUoumcoDXwFEQow-s-nR7Hq5bdBUxPgA%40mail.gmail.com
> <https://groups.google.com/d/msgid/weewx-development/CAGTinV4dWNWAJixkt1CUoumcoDXwFEQow-s-nR7Hq5bdBUxPgA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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
> <https://groups.google.com/d/msgid/weewx-development/73AA04EB-0937-407C-A00E-F577D49A79EA%40johnkline.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAGTinV6D27i3T_FNwN3pR16yXbrL4TA6V8p7HF%2BTiWTPcR4tTg%40mail.gmail.com.

Reply via email to