--
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/8ba76e85-40d0-4e20-84ea-a33b38120e3bn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/81f1fd56-ea21-4d69-9e9e-f76368201026n%40googlegroups.com.
if the interval of Weewx and the data logger is set to 10 minutes, I would have liked to read the value of the solar sensor every minute and then write it into a separate .sdb database as possible sunshine.
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/19ylVTRqbh4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0e631671-0a74-4963-9f1c-e5f81bc7c366n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/f0ecc86f-a615-4a24-a43f-ee0d3963b8adn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/39cf6daa-80ca-4ffb-89d3-0f00b971481an%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/c07ed2bb-1e3d-43e2-b08c-08a7a3aa92dbn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/f287c1b3-1005-409c-82a9-a072e375d5e9n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/77cd4de6-3b1c-4bc2-9dbc-8d8316bd8a9bn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/d7887ea5-f97d-4327-8a72-782d701ebd15n%40googlegroups.com.
The code I am using is pasted below. The main threshold calculation is a copy of the original Meto-France code used by Jacques, but the calculation is only done when the radiation value changes or (approximately) every minute, if it has not changed. Also included is code to store Davis’s ‘Storm Rain’ value in the archive database. The stored value for sunshine time has more apparent precision than is given by Jacques's code, but it is probably neither more nor less accurate, since its accuracy is limited by the relatively slow 'response' of the Davis sensor.import syslog
from math import sin,cos,pi,asin
from datetime import datetime
import time
import weewx
from weewx.wxengine import StdService
import weewx.units
weewx.units.obs_group_dict['sunshine_time'] = 'group_sunshine'
weewx.units.USUnits['group_sunshine'] = 'minute'
weewx.units.MetricUnits['group_sunshine'] = 'minute'
weewx.units.MetricWXUnits['group_sunshine'] = 'minute'
weewx.units.default_unit_format_dict['minute'] = '%.0f'
weewx.units.default_unit_label_dict['minute'] = 'min'
weewx.units.obs_group_dict['stormRain'] = 'group_rain'
packet_count = 0
avg_radiation = 0
last_radiation = 0
last_calc_time = 0
cum_sunshine = 0
cum_time = 0
last_stormRain = 0
class LoopSunshineDuration(StdService):
def __init__(self, engine, config_dict):
super(LoopSunshineDuration, self).__init__(engine, config_dict)
self.bind(weewx.NEW_LOOP_PACKET,self.newLoopRecord)
def newLoopRecord(self, event):
global packet_count, last_radiation, cum_sunshine, cum_time, last_calc_time, last_stormRain
# The VP 2 radiation value normally only changes ~ every 50 seconds (or multiple thereof)
pkt_radiation = event.packet.get('radiation')
last_stormRain = event.packet.get('stormRain')
if (pkt_radiation is None) or (pkt_radiation<=0):
pass
elif (packet_count < 29) and (pkt_radiation == last_radiation):
packet_count += 1
else:
radiation = last_radiation
last_radiation = pkt_radiation
packet_count = 0
timestamp = event.packet.get('dateTime')
# Process the last value
duration = timestamp - last_calc_time
last_calc_time = timestamp
seuil = 0
coeff = 0.9
if radiation > 0:
utcdate = datetime.utcfromtimestamp(event.packet.get('dateTime'))
dayofyear = int(time.strftime("%j",time.gmtime(event.packet.get('dateTime'))))
theta = 360 * dayofyear / 365
equatemps = 0.0172 + 0.4281 * cos((pi / 180) * theta) - 7.3515 * sin(
(pi / 180) * theta) - 3.3495 * cos(2 * (pi / 180) * theta) - 9.3619 * sin(
2 * (pi / 180) * theta)
latitude= float(self.config_dict["Station"]["latitude"])
longitude = float(self.config_dict["Station"]["longitude"])
corrtemps = longitude * 4
declinaison = asin(0.006918 - 0.399912 * cos((pi / 180) * theta) + 0.070257 * sin(
(pi / 180) * theta) - 0.006758 * cos(2 * (pi / 180) * theta) + 0.000908 * sin(
2 * (pi / 180) * theta)) * (180 / pi)
minutesjour = utcdate.hour*60 + utcdate.minute
tempsolaire = (minutesjour + corrtemps + equatemps) / 60
angle_horaire = (tempsolaire - 12) * 15
hauteur_soleil = asin(sin((pi / 180) * latitude) * sin((pi / 180) * declinaison) + cos(
(pi / 180) * latitude) * cos((pi / 180) * declinaison) * cos((pi / 180) * angle_horaire)) * (180 / pi)
if hauteur_soleil > 3:
seuil = (0.73 + 0.06 * cos((pi / 180) * 360 * dayofyear / 365)) *1080 * pow((sin(pi / 180) * hauteur_soleil), 1.25) * coeff
if radiation > seuil:
cum_sunshine += duration
cum_time += duration
class ArchSunshineDuration(StdService):
def __init__(self, engine, config_dict):
super(ArchSunshineDuration, self).__init__(engine, config_dict)
# Start intercepting events:
self.bind(weewx.NEW_ARCHIVE_RECORD, self.newArchiveRecord)
def newArchiveRecord(self, event):
global cum_sunshine, cum_time, last_stormRain
event.record['stormRain'] = last_stormRain
# for various reasons cum_sunshine does not necessarily contain exactly <archive interval> seconds of data
if cum_time > 0: # do not divide by zero!
event.record['sunshine_time'] = cum_sunshine / cum_time * event.record['interval'] # converted to minutes of sunshine
else:
event.record['sunshine_time'] = 0
cum_sunshine = 0
cum_time = 0
syslog.syslog(syslog.LOG_DEBUG, "Calculated sunshine_time = %f" % event.record['sunshine_time'])
Le 16 juil. 2022 à 17:01, 'Peter Fletcher' via weewx-user <weewx...@googlegroups.com> a écrit :
The code I am using is pasted below. The main threshold calculation is a copy of the original Meto-France code used by Jacques, but the calculation is only done when the radiation value changes or (approximately) every minute, if it has not changed. Also included is code to store Davis’s ‘Storm Rain’ value in the archive database. The stored value for sunshine time has more apparent precision than is given by Jacques's code, but it is probably neither more nor less accurate, since its accuracy is limited by the relatively slow 'response' of the Davis sensor.
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/19ylVTRqbh4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e11727db-7c89-4334-b24c-a5b2f7ca66dbn%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/19ylVTRqbh4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/badb290a-dd5f-41d8-b0a6-1365e2734bd9n%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/19ylVTRqbh4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e50560aa-d030-4096-97b4-7b9b614dc4cdn%40googlegroups.com.
Le 18 juil. 2022 à 15:43, Jon B <jonbe...@gmail.com> a écrit :
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/e50560aa-d030-4096-97b4-7b9b614dc4cdn%40googlegroups.com.
Le 18 juil. 2022 à 16:29, 'Peter Fletcher' via weewx-user <weewx...@googlegroups.com> a écrit :
@Jacques: I initially had the same error (or a very similar one) as Jon B and had to comment out that last line. I had already manually added the sunshine_time field (as well as some others, previously) to my weewx database, so it didn't seem to be necessary or useful. My installation also did not seem to understand the schema assignment. Do you have a non-default extension loaded that enables this?
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/19ylVTRqbh4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/a85805b1-dfe9-41de-9079-56f4a951546bn%40googlegroups.com.
This action is useful for changing the schema or unit system in your database.
It creates a new database with the same name as the old, except with the suffix _new attached at the end (nominally, weewx.sdb_new if you are using SQLite, weewx_new if you are using MySQL). It then initializes it with the schema specified in weewx.conf. Finally, it copies over the data from your old database into the new database.
--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/19ylVTRqbh4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/1a4d0ef0-60d3-403c-b15c-bef5f78deda3n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/571f223d-9f92-4056-b9ac-8c8aff15c501n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/adc2ed4c-ad2c-4d8f-8112-9e67da7f5ac4n%40googlegroups.com.
Le 31 juil. 2022 à 06:45, Meteo Oberwallis <sschn...@bluewin.ch> a écrit :
Hello.
Jul 31 06:31:09 Wetter weewxd: restx: MQTT: data will be uploaded to mqtt://mosquitto:xxx@185.160.244.35:1883/
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0a42c350-b5af-47f4-9e18-34ae7dc2b70an%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/c74cfc29-5d47-4a19-a3d6-599c59cc85e6n%40googlegroups.com.