Hi Graham,
If I use '=' instead of '==' then weewx throws an error and exits:
2025-01-16T10:28:04.198797+00:00 weewx5 python3[2361]: File
"StdCalibrate", line 1
2025-01-16T10:28:04.198850+00:00 weewx5 python3[2361]: windSpeed * 1.15
if winDir is not None else windSpeed = 20
2025-01-16T10:28:04.198911+00:00 weewx5 python3[2361]:
^
2025-01-16T10:28:04.198978+00:00 weewx5 python3[2361]: SyntaxError: invalid
syntax
2025-01-16T10:28:04.199068+00:00 weewx5 weewxd[2361]: CRITICAL __main__:
****
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-16T10:28:04.199130+00:00 weewx5 weewxd[2361]: CRITICAL __main__:
**** File "StdCalibrate", line 1
2025-01-16T10:28:04.199179+00:00 weewx5 weewxd[2361]: CRITICAL __main__:
**** windSpeed * 1.15 if winDir is not None else windSpeed = 20
2025-01-16T10:28:04.199230+00:00 weewx5 weewxd[2361]: CRITICAL __main__:
**** ^
2025-01-16T10:28:04.199314+00:00 weewx5 weewxd[2361]: CRITICAL __main__:
**** SyntaxError: invalid syntax
2025-01-16T10:28:04.199402+00:00 weewx5 weewxd[2361]: CRITICAL __main__:
**** Exiting.
On Thursday, January 16, 2025 at 10:10:20 AM UTC Graham Eddy wrote:
> python syntax: should be = not == in the ‘else’s
>
> semantics: presumably testing as they make no sense
> *⊣GE⊢*
>
> On 16 Jan 2025, at 8:00 pm, 'Rory Gillies' via weewx-user <
> [email protected]> wrote:
>
> Thanks Michael,
>
> Based on the values being calculated in order (as it says in the docs) I
> tried the following which didn't work (although no errors when starting
> WeeWX):
>
> [StdCalibrate]
> [[Corrections]]
>
> windSpeed = 20 if windSpeed == 0 else windSpeed == windSpeed * 1.15
> windGust = windSpeed + 10 if windGust == 0 else windGust == windGust *
> 1.15
> windDir = windDir if windDir is not None else windDir == 220
>
> So I reversed it based on windDir being null which didn't work either:
>
> windSpeed = windSpeed * 1.15 if winDir is not None else windSpeed == 20
> windGust = windGust * 1.15 if windDir is not None else windGust ==
> windSpeed + 10
> windDir = windDir if windDir is not None else windDir == 220
>
> This is the overnight plot, you can see it went off completely for a
> couple of hours after 04:00. I was working on it around between 22:00 and
> 00:00 when it started to drop.
>
> <Screenshot 2025-01-16 at 08.51.41.png>
> Also, I noticed a strange effect with the force_null setting, if I set it
> to True windDir appears to stay at the last known direction, if I set it as
> False windDir moves to north, I thought this was supposed to work the other
> way round?
>
> Thanks,
>
> Rory
>
> On Wednesday, January 15, 2025 at 6:09:54 PM UTC [email protected]
> wrote:
>
>>
>> For your specific case I'd just kick zero wind loop packets out:
>>
>> windSpeed = None if windSpeed == 0 else windSpeed, loop
>>
>> The windDir should be "None" if windSpeed is zero anyway, but to be sure:
>>
>> windDir = None if windSpeed == 0 else windDir, loop
>>
>>
>> [email protected] schrieb am Mittwoch, 15. Januar 2025 um 18:48:53
>> UTC+1:
>>
>>> See:
>>> https://weewx.com/docs/5.1/reference/weewx-options/stdcalibrate/?h=stdcalibrate#corrections
>>>
>>> [email protected] schrieb am Mittwoch, 15. Januar 2025 um 18:47:38
>>> UTC+1:
>>>
>>>> Yes it is. I have a station with two Anemometers and I mix them in the
>>>> way, that always the higher windSpeed/windGust will be used, if both are
>>>> there, or the one that's there. Anemometers freeze or sometime I have
>>>> Signal strength issues. I always take the direction of a specific one (an
>>>> ultrasonic with heating, that won't freeze), except it isn't there. It's
>>>> quite a brainf*ck, but it works. Some other Corrections are also done:
>>>>
>>>> [StdCalibrate]
>>>>
>>>> [[Corrections]]
>>>>
>>>> radiation = luminosity/126.7 if luminosity is not None else
>>>> None #gw1000 fix
>>>> lightning_distance = lightning_distance if
>>>> lightning_strike_count > 0 else None
>>>> windSpeed = ws90_windSpeed if 'windSpeed' not in locals() else
>>>> windSpeed if 'ws90_windSpeed' not in locals() else ws90_windSpeed if
>>>> ws90_windSpeed > windSpeed else windSpeed
>>>> windGust = ws90_windGust if 'windGust' not in locals() else
>>>> windGust if 'ws90_windGust' not in locals() else ws90_windGust if
>>>> ws90_windGust > windGust else windGust
>>>> windDir = ws90_windDir if 'ws90_windDir' in locals() and
>>>> ws90_windDir is not None else windDir
>>>>
>>>>
>>>>
>>>> Rory Gillies schrieb am Mittwoch, 15. Januar 2025 um 17:53:42 UTC+1:
>>>>
>>>>> I know I could just try this but interested to hear if it would work,
>>>>> or if I have any other options. WeeWX 5.1.
>>>>>
>>>>> Is it possible to use logic in StdCalibrate in weewx.con? Something
>>>>> like this:
>>>>>
>>>>> [StdCalibrate]
>>>>> if windSpeed == 0 windspeed = windspeed + 15
>>>>> if windDir == NULL windDir = windDir + 235
>>>>>
>>>>> The reason is I have a dying anemometer and it's going to take a
>>>>> couple of weeks to get a replacement installed (it's on my chimney 8m
>>>>> above
>>>>> the ground). When the wind blows from SSW to WSW above 20mph it sometimes
>>>>> drops to zero every few loop packets (other times it is perfect).
>>>>>
>>>>> [image: Screenshot 2025-01-15 at 16.49.12.png]
>>>>>
>>>>> I know the observations will be technically incorrect but better than
>>>>> no wind at all!
>>>>>
>>>>>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" 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-user/cd6cbe95-9bb7-42f5-8e40-b17937659d3an%40googlegroups.com
>
> <https://groups.google.com/d/msgid/weewx-user/cd6cbe95-9bb7-42f5-8e40-b17937659d3an%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> <Screenshot 2025-01-16 at 08.51.41.png>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" 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-user/82c09de1-d80d-4ed2-8412-531adcf00c0cn%40googlegroups.com.