number of raindays in a period. **solved**

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
User avatar
Gyvate
Platinum Boarder
Platinum Boarder
Posts: 453
Joined: Thu May 14, 2020 4:36 pm
Location: Saarbrücken, Germany

number of raindays in a period. **solved**

Post by Gyvate »

I am looking for retrieving the number of raindays (respectively the reverse: the number of days without rain) in a period with Meteobridge:
all time, year, month, weewx, from - to - but I could find anything in the Template section of the WiKi which touches this point.
Also, searching in the forum didn't produce anything useable ...

I know that technically I would have to count the days when the daily rain sum was bigger than a defined threshold (>0.00, >0.1 --> dew, ...),
but how to formulate it ...?

two questions:
1. for determining the number of raindays in a given period (from - to):
Does anyone have ideas what the expression [sensor-selector ...] has to look like ? Maybe in combination with a conditional expression #if ...#fi

2. Is there a possibility to create a loop with a break condition (e.g. loop while condition is fulfilled or loop until condition fulfilled with the template language) ?
WH4000SE 1.6.6/1 x DP1500/4 x GW1000 1.7.7/GW1100 2.3.0/HP1000SE Pro 1.9.3//2 x WH2650 1.7.7/GW2000 3.1.0
2xMeteobridge Pro [B+R] 15161, 2xRPi4B-2GB/16/32 3139,VM128 1704
Weather Landing page: https://meshka.eu
Ecowitt WiKi: https://meshka.eu/Ecowitt/dokuwiki
User avatar
Gyvate
Platinum Boarder
Platinum Boarder
Posts: 453
Joined: Thu May 14, 2020 4:36 pm
Location: Saarbrücken, Germany

Re: number of raindays in a period

Post by Gyvate »

is the solution to this question so trivial that noone of the experts minds to answer ?
I would at least expect from @admin a statement like
a) can be done e.g. this way or that way
or
b) not possible with MB means ...
or
c) a respective variable will be created to be used in the template language.

I hear that under Meteohub this is possible ...
WH4000SE 1.6.6/1 x DP1500/4 x GW1000 1.7.7/GW1100 2.3.0/HP1000SE Pro 1.9.3//2 x WH2650 1.7.7/GW2000 3.1.0
2xMeteobridge Pro [B+R] 15161, 2xRPi4B-2GB/16/32 3139,VM128 1704
Weather Landing page: https://meshka.eu
Ecowitt WiKi: https://meshka.eu/Ecowitt/dokuwiki
Empire24
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: Mon Feb 12, 2024 2:11 am

Re: number of raindays in a period

Post by Empire24 »

Hello,
yes, you are right. Meteohub had this function.
I don't understand why Meteobridge, as the successor, can do less than its predecessor.
I would also like to have these raindays.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: number of raindays in a period

Post by admin »

Meteobridge has a completely different handling and storing of data compared to Meteohub. This is to get rid of delays in finding min/max values and ineffective data handling. To believe that a completely new designed follow-on product does clone every single feature of the former one is not realisitic. Nevertheless, I will think if/how to support wishes like "count all years/months/days/hours that meet a certain sensor condition".
Empire24
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: Mon Feb 12, 2024 2:11 am

Re: number of raindays in a period

Post by Empire24 »

Thank you very much for the feedback, which is absolutely understandable. I appreciate your willingness to consider implementing this through an update. Ultimately, the end customer is only interested in the result and does not understand the process behind it.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: number of raindays in a period

Post by admin »

I implemented a light version of this, which hopefully lowers your pain a bit. Please read here: https://meteobridge.com/wiki/index.php/Forum
Empire24
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: Mon Feb 12, 2024 2:11 am

Re: number of raindays in a period

Post by Empire24 »

Thank you! Works wonderfully :-)
The only thing missing is that "@" works.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: number of raindays in a period

Post by admin »

Just did a rework of the solution. New syntax and function can be found here: https://meteobridge.com/wiki/index.php/Forum
I will check tomorrow how to make this available in exports as well.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: number of raindays in a period

Post by admin »

I also added support of day counts in exports via "rain0total-count" template variable. Please have a look at the modified "NOAA" template below, which adds number of rain days as a last column:

Code: Select all

# Standard monthly NOAA template with data in metric units
# 
$                  MONTHLY CLIMATOLOGICAL SUMMARY FOR [YYYY]-[MM]
$
$Elevation: [mbsystem-altitude.0:]m
$Latitude:  [mbsystem-latitude.3:]
$Longitude: [mbsystem-longitude.3:]
$
$Temperature in C, Rain in MM, Wind Speed in KM/H and Pressure in HPA
$
$      AVG                                      AVG                 DOM            RAIN
$DAY   TEMP   HIGH   TIME   LOW   TIME   RAIN   WIND   HIGH   TIME  DIR  BAROM HUM DAYS
$-------------------------------------------------------------------------------------
 [DD]  [th0temp-avg.000001:     ]  [th0temp-max.000001:     ]  [th0temp-maxts.ij:  ]:[th0temp-maxts.kl:  ] [th0temp-min.000001:     ]  [th0temp-mints.ij:  ]:[th0temp-mints.kl:  ]  [rain0total-sum.000001:     ]   [wind0wind-avg=kmh.00001:    ]  [wind0wind-max=kmh.000001:     ]  [wind0wind-maxts.ij:  ]:[wind0wind-maxts.kl:  ]  [wind0dir-avg.000:   ] [thb0seapress-avg.0000001:      ]  [th0hum-avg.00:  ] [rain0total-count.00:  ]
$-------------------------------------------------------------------------------------
$MONTH[th0temp-mavg.000001:     ]  [th0temp-mmax.000001:     ]  [th0temp-mmaxtime.gh:  ]    [th0temp-mmin.000001:     ]  [th0temp-mmintime.gh:  ]     [rain0total-monthsum.000001:     ]   [wind0wind-mavg=kmh.00001:    ]  [wind0wind-mmax=kmh.000001:     ]  [wind0wind-mmaxtime.gh:  ]     [wind0dir-mavg=endir.3:   ] [thb0seapress-mavg.0000001:      ]  [th0hum-mavg.00:  ] [rain0total-mcount.00:  ]
$
Export for December 2023 is:

Code: Select all

                  MONTHLY CLIMATOLOGICAL SUMMARY FOR 2023-12

Elevation: m
Latitude:  53.686
Longitude: 9.980

Temperature in C, Rain in MM, Wind Speed in KM/H and Pressure in HPA

      AVG                                      AVG                 DOM            RAIN
DAY   TEMP   HIGH   TIME   LOW   TIME   RAIN   WIND   HIGH   TIME  DIR  BAROM HUM DAYS
-------------------------------------------------------------------------------------
 01   -1.9   -0.2  15:37  -5.4  10:35    0.0    0.0    1.8  12:58  166 1004.5  96 00
 02   -0.3    5.1  17:12  -2.1  17:12    0.0    0.0    0.0  17:13  166 1009.0  96 00
 03   -1.7   -0.9  16:04  -2.8  11:32    0.0    0.0    0.0  16:04  184 1016.7  98 00
 04   -0.4    0.1  13:15  -1.1  16:04    0.0    0.0    0.0  16:04  214 1010.3  95 00
 05   -1.1   -0.9  14:37  -1.8  15:57    0.0    0.0    0.0  15:57  223 1004.4  97 00
 06    0.1    0.1  14:54  -0.4  14:56    0.0    0.0    0.0  14:56  223 1008.7  99 00
 07    1.3    2.1  17:06   0.7  17:06    0.0    0.0    1.8  16:29  220 1015.3  99 00
 08    1.4    1.7  13:03   0.7  17:01    0.8    1.7   15.5  11:32  223 1008.3  96 01
 09    4.8    5.3  12:47   4.3  16:31    7.0    1.5   11.9  17:58  223 1001.6  98 01
 10    7.5    9.2  16:17   4.5  00:27    2.8    3.0   18.7  16:13  188  994.1  99 01
 11    8.2    9.2  13:34   7.4  16:57    3.2    0.8    8.6  13:45  176  993.6  99 01
 12    5.6    6.0  13:11   4.9  16:26    0.2    1.9    8.6  16:01  152 1002.1  99 01
 13    4.7    4.8  12:04   4.1  16:10    0.0    8.5   23.8  10:28  223  999.0  97 00
 14    2.6    3.9  11:53   1.0  23:58    0.6    0.8   13.7  12:25  223 1014.4  97 01
 15    6.2   10.3  01:46   1.1  00:05    0.0    3.1   13.7  16:05  174 1026.3  99 00
 16    7.4    7.9  15:30   6.9  11:08    0.4    9.2   29.2  10:34  172 1029.9  98 01
 17    9.3   10.0  14:03   8.6  23:59    0.0    7.9   36.0  13:29  172 1026.7  92 00
 18    8.2    8.6  00:18   7.6  15:35    0.6    8.1   27.4  14:03  175 1021.5  96 01
 19    7.9   56.2  11:19   7.3  11:36    1.8    7.3   20.5  15:14  175 1010.8  98 01
 20    5.6    6.8  14:21   4.8  10:42   13.4    6.5   39.2  11:49  170 1001.6  94 01
 21    7.3    9.7  12:26   5.4  02:07    4.0    7.4   47.9  17:37  171  983.8  95 01
 22    4.1    5.7  13:29   2.3  23:59    1.0    1.6   29.2  20:11  153  988.5  87 01
 23    3.1    4.1  17:22   1.6  10:31   27.2    0.5   13.7  13:48  158  997.3  96 01
 24   10.6   15.8  15:44   9.6  10:15    3.6   10.3   30.6  15:06  171  992.5  99 01
 25    7.9    9.1  13:13   6.7  19:05    4.0    3.0   32.4  10:54  172  996.9  90 01
 26    7.7    9.2  01:59   5.2  17:44   10.8    5.9   36.0  11:49  165 1002.8  96 01
 27    3.5   18.1  18:51   1.5  09:45    0.2    0.0    6.8  18:41  221 1013.0  96 01
 28   10.7   11.6  12:17   9.7  19:51    0.2   10.3   41.0  14:35  180 1002.0  86 01
 29    8.6    9.9  14:51   7.4  23:59    0.0    7.3   42.8  14:41  173  998.3  83 00
 30    6.0    7.4  00:10   4.4  18:44    1.6    2.8   27.4  00:17  183 1004.2  94 01
 31    7.3    7.8  19:23   6.1  09:59    0.2    0.0    6.8  13:03  220  998.6  93 01
-------------------------------------------------------------------------------------
MONTH  4.9   56.2  19     -5.4  01      83.6    3.5   47.9  21       S 1005.7  95 20
paul_1055
Senior Boarder
Senior Boarder
Posts: 40
Joined: Tue Nov 04, 2008 7:08 pm
Contact:

Re: number of raindays in a period

Post by paul_1055 »

great function, thank you very much :D

Torsten
Post Reply