upgrade from v1.12.1: stats only generated for past ~week

60 views
Skip to first unread message

Jason Rennie

unread,
Jul 18, 2020, 8:48:21 PM7/18/20
to weewx...@googlegroups.com
I'm amazed that the upgrade mostly worked flawlessly. I installed 4.1.1 via the Deb/Ubuntu package after realizing that Ubuntu 20.04 no longer supports v2 python libraries. Tom, I'm impressed! Just had to copy weewx.sdb to /var/lib/weewx and make some minor config tweaks. Plots look great for day and week, but month/year appear to be missing data. I see that the stats tables are now part of weewx.sdb. During startup, it spent a few minutes "generating stats" and I see the new tables in weewx.sdb. Is there a way to tell it to go back further and generate, say, a year of stats?

Thanks,

Jason

Tom Keffer

unread,
Jul 18, 2020, 9:00:58 PM7/18/20
to weewx-user
Hello, Jason! Have not heard from you in years!

The "backfill" process should do the entire database, not just a year. What symptoms are you seeing?

--
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/CA%2BPf4UBs5k4bkugsewv3_LTc%3Dd74YRhX0ANpmab-4CEBnPp5Ug%40mail.gmail.com.

Jason Rennie

unread,
Jul 18, 2020, 9:36:53 PM7/18/20
to weewx-user
I know! I guess weewx worked so well that I almost never needed to spend any time on it!

I was seeing month and year plots that only had a ~week of data, but now that I look at the archive_day_outTemp table, I see data going back at least a year. And, now the month plots are fully populated and I realize the plots are probably based on the raw data rather than the daily stats. The year plots still only have a ~week of data, but I know those are regenerated much less often, so I'm guessing I'll see new plots tomorrow. So, I suspect this was a false alarm and nothing is wrong. I should have investigated a bit more :)

But, while I've got your attention, you might remember that I like to keep track of indoor dewpoint. I've got it working for including values in html (using "inDewpoint" in the templates). But, plot generation when I try to use "inDewpoint" in skin.conf for the daytempin plot. It looks like inDewpoint is a generated value. Can plots use inDewpoint?

Thanks,

Jason

Tom Keffer

unread,
Jul 18, 2020, 9:49:59 PM7/18/20
to weewx-user
Just delete all the plots. WeeWX will regenerate them all at the next  reporting cycle.

Yes, the archive data is used for plots, unless the aggregation interval is one day, in which case the daily summaries are used.

Yes, inDewpoint is a derived value. Write an xtypes extension for it and StdWXCalculate can calculate it. 

-tk



Jason Rennie

unread,
Jul 19, 2020, 4:37:06 PM7/19/20
to weewx...@googlegroups.com
Perfect, done! Nice documentation! And, the brultech example was very useful since it wasn't completely clear from the regular docs how to implement get_series.

In case you're up for some feedback:
  • Xtype needs a capital 'T' in the "Pressure" example: "class Pressure(weewx.xtypes.XType):"
  • It'd be nice if there were a bit more clarity in how to "register"
    • the documentation doesn't clearly stay to edit user/extensions.py
    • it'd be nice to give an example of how to import the user module ("import user.indewpoint" in my case")
  • It'd be nice to give a simple example of querying the database. I used the brultech example.
  • Type documentation could be a bit more precise, e.g. "obs_type is the type to be computed." Technically obs_type is a string name, not an actual type. I know this sounds picky, but it confused me at first. If there's a link to a list of normal values for obs_type, that would be helpful.
My code is below in case any of it would be useful for documentation.

Thanks!

Jason

P.S. The yearly plots started working overnight, but thanks for the reminder re: deleting---I forgot that weewx will automatically recreate.

----- user/extensions.py
import user.indewpoint
import weewx.xtypes

weewx.xtypes.xtypes.append(user.indewpoint.InsideDewpoint())


----- user/indewpoint.py
import weewx.units
import weewx.xtypes
import weewx.wxformulas
from weewx.units import ValueTuple

class InsideDewpoint(weewx.xtypes.XType):

  def get_scalar(self, obs_type, record, dbmanager):
    """Calculate indoor dewpoint from temperature and humidity."""
    if obs_type != 'inDewpoint':
      raise weewx.UnknownType
    try:
      record_us = weewx.units.to_US(record)
      inDewpoint = weewx.wxformulas.dewpointF(record_us['inTemp'],
                                              record_us['inHumidity'])
      return ValueTuple(inDewpoint, "degree_F", "group_temperature")
    except KeyError:
      # Don't have everything we need. Raise an exception.
      raise weewx.CannotCalculate(obs_type)

  def get_series(self, obs_type, timespan, db_manager, aggregate_type, aggregate_interval):
    if obs_type != 'inDewpoint':
      raise weewx.UnknownType
    start_vec = list()
    stop_vec = list()
    data_vec = list()
    if aggregate_type:
      raise weewx.UnknownAggregation(aggregate_type)
    for record in db_manager.genSql("select dateTime, interval, usUnits, inTemp, inHumidity from archive where dateTime > %(start)s and dateTime <= %(stop)s" % {'start': timespan[0], 'stop': timespan[1]}):
      if (record[2] != 1):
        raise weewx.CannotCalculate("units are not US")
      start_vec.append(record[0] - record[1] * 60)
      stop_vec.append(record[0])
      # Calculation takes inTemp and inHumidity
      data_vec.append(weewx.wxformulas.dewpointF(record[3], record[4]))
    return (ValueTuple(start_vec, 'unix_epoch', 'group_time'),
            ValueTuple(stop_vec, 'unix_epoch', 'group_time'),
            ValueTuple(data_vec, "degree_F", "group_temperature"))


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/hp6ZvSOPM5s/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/CAPq0zEDncM5RpR8A99e7WQExjJGr7Md5voks2HJKqx6RCg5vtQ%40mail.gmail.com.


--
Jason Rennie
Software Engineer
Google

Reply all
Reply to author
Forward
0 new messages