Your main problem is that $current.windSpeed.beaufort returns a number, not a string. So, you want
#if $varExists('day.windSpeed') and $current.windSpeed.raw is not None #if $current.windSpeed.beaufort == 0 #set $word_current_beaufort = 'Calm' #elif $current.windSpeed.beaufort == 1 #set $word_current_beaufort = 'Light Air' ... #else #set $word_current_beaufort = 'N/A' #end if You should be able to do $current.windGust.beaufort as well. However, oceanographically, Beaufort's observations are related to the steady wind speed, not gusts, so the results cannot be related to sea state through his table. -tk On Thu, Dec 3, 2020 at 8:49 AM Vetti52 <drve...@gmail.com> wrote: > After upgrading to Weewx version 4.2.0 I want to replace the deprecated > type Beaufort by the new unit $current.windSpeed.beaufort. > First, I replaced the previous evaluation in my accomodated current.inc, > where I want to express the beaufort value by a literal description: > #if $varExists('day.windSpeed') and $current.windSpeed.raw is not None > #if $current.windSpeed.beaufort == '0' > #set $word_current_beaufort = 'Calm' > #elif $current.windSpeed.beaufort == '1' > #set $word_current_beaufort = 'Light Air' > ... > #else > #set $word_current_beaufort = 'N/A' > #end if > > This construct does not result in errors, but always ends up displaying > "N/A". > > As gust seems not to be covered by the new unit > $current.windSpeed.beaufort, I evaluate gust into beaufort still the old > way, which is an adoption from another contribution in this forum. This > works well: > > #if $unit.unit_type.windSpeed == 'mile_per_hour' > #set $current_gust_kts = $current.windGust.raw * 0.8689762 > #elif $unit.unit_type.windSpeed == 'km_per_hour' > #set $current_gust_kts = $current.windGust.raw * 0.539956 > #elif $unit.unit_type.windSpeed == 'meter_per_second' > #set $current_gust_kts = $current.windGust.raw * 1.943844 > #elif $unit.unit_type.windSpeed == 'knot' > #set $current_gust_kts = $current.windGust.raw > #else > #set $current_gust_kts = 0 > #end if > #if $current_gust_kts < 1 > #set $current_gust_beaufort = 0 > #elif $current_gust_kts < 4 > #set $current_gust_beaufort = 1 > ... > #else > #set $current_gust_beaufort = 12 > #end if > #else > #set $current_gust_beaufort = 'N/A' > #end if > > As I am pretty naive with python, I do not understand, what is wrong with > my solution. Python experts may lough about it. But, please, explain, how > to solve my problem. > > Thanks! > > -- > 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/d84a6194-945c-4754-8ee9-a04421821429n%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-user/d84a6194-945c-4754-8ee9-a04421821429n%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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEAwYhkEnmZoYZN2Op6hbLVu5AV-V18rO8b72Cx9Htfeaw%40mail.gmail.com.