Actually

*outTemp = 44 if outTemp in locals() else None*


yields *None* when *outTemp * is there. 

Since we are looking for the key '*outTemp' *and not it's value, our 
expression needs to be:

*outTemp = 44 if 'outTemp' in locals() else None*



Tom Keffer schrieb am Samstag, 9. März 2024 um 03:22:24 UTC+1:

> The facility uses the Python function eval 
> <https://docs.python.org/3/library/functions.html#eval>. A dictionary 
> with key 'math' and value the math module is passed in for *globals*. The 
> record is passed in for *locals*. So, you could use the expression
>
> *outTemp = 44 if outTemp in locals() else None*
>
>
>
>
> On Fri, Mar 8, 2024 at 3:33 PM Graham Eddy <g...@geddy.au> wrote:
>
>> oops, python syntax would be: expr if ops_tye in globals() else None
>> *⊣GE⊢*
>>
>> On 9 Mar 2024, at 10:31 am, Graham Eddy <g...@geddy.au> wrote:
>>
>> i think ' if obs_type in globals() then expr else None ' would work
>> *⊣GE⊢*
>>
>> On 9 Mar 2024, at 9:13 am, 'michael.k...@gmx.at' via weewx-user <
>> weewx...@googlegroups.com> wrote:
>>
>> I think I remember that this has been asked before, how to check with an 
>> expression in Corrections, if an obs_type is present? 
>>
>> -- 
>> 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 weewx-user+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/ae1bbcf8-23b1-475e-8749-62286df24fb0n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/ae1bbcf8-23b1-475e-8749-62286df24fb0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
>> -- 
>> 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 weewx-user+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/0507D046-7EED-4A96-8F28-038B70BECEC7%40geddy.au
>>  
>> <https://groups.google.com/d/msgid/weewx-user/0507D046-7EED-4A96-8F28-038B70BECEC7%40geddy.au?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/5c1198a9-1540-4630-969a-4d998ec91eebn%40googlegroups.com.

Reply via email to