It looks like I specialized get_aggregate() for my weewx-purple extension in July of 2020. AQI isn’t in the database, but pm2_5 is, which makes things efficient.
I don’t know if get_aggregate was actually called in v4 (since I update my skin pages on every loop record, the values initially generated in reports aren’t interesting).
I do know that reporting got slower in v5.
And this simple change dramatically speeded things up: |
| - weewx.xtypes.xtypes.append(AQI()) | | + weewx.xtypes.xtypes.insert(0, AQI()) | |
I’m glad I finally paid attention to this subject. Thanks, Tom and others.
First is the ArchiveTable class. It calls the general get_aggregate function and thus also your XType. If you want ArchiveTable handle get_series aggregations for your XType, you have to insert your XType after ArchiveTable. But if you implemented aggregations and do not want XTypeTable handle those aggregations, then you need to insert your XTypes before XTypeTable. That is, between ArchiveTable and XTypeTable.
I guess I'm not seeing that. If ArchiveTable.get_series() calls xtypes.get_aggregate(), it will run down the list of xtypes. It won't use the one in ArchiveTable because it doesn't know about your new type. It keeps going until it gets to your xtype extension. If your users want to speed up something and include your XTypes into the database, they surely want the DailySummaries class handle aggregations. But that does not mean that you want XTypeTable handle the aggegations of your XType in the other case. You may have provided your own implementation of the aggregations. That means you have to insert your XType after DailySummaries but before XTypeTable.
If the XType is in the database, it will be handled like any other type. There is no longer anything special about it. There is no reason for XTypeTable to come into play. I also don't know why you'd want your own implementation of get_aggregate() if the type is in the database.
So I guess if you want your XType to behave in an intuitive way and you have implemented the aggregations, then you will have to insert it after ArchiveTable and DailySummaries, but before XTypeTable.
Respectively disagree. New XTypes can be appended or prepended to the list --- the only time it matters is a straight optimization of get_aggregate(). Then it must appear at the beginning of the list so it appears before XTypeTable.get_aggregate().
-tk
--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/CAPq0zEA8h_DYLP6%2BrTB4VeEo46%2B9ySXsfasExohbptVuk8peSw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/241BEDD6-D96A-4A43-966F-71B9B4BA4F42%40johnkline.com.
|