I thought about observation types that are calculated within an XType, but 
then saved to the database. After that summaries could be retrieved from 
the database instead of calculated again. So I guess neither inserting the 
XType at the beginning nor appending it at the end is the best solution. 
For the weewx-GTS <https://github.com/roe-dl/weewx-GTS> extension I now 
decided to insert it before XTypeTable, but after DailySummaries and 
ArchiveTable like this:

        # Register the class
        archive_seen = False
        summaries_seen = False
        for idx,xtype in enumerate(weewx.xtypes.xtypes):
            if (isinstance(xtype,weewx.xtypes.XTypeTable) or
                                            (archive_seen and 
summaries_seen)):
                weewx.xtypes.xtypes.insert(idx,self.GTSextension)
                break
            if isinstance(xtype,weewx.xtypes.ArchiveTable):
                archive_seen = True
            elif isinstance(xtype,weewx.xtypes.DailySummaries):
                summaries_seen = True
        else:
            weewx.xtypes.xtypes.append(self.GTSextension)

-- 
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/47039c9e-c01a-4e8d-9d4b-5ec81a9df3cdn%40googlegroups.com.

Reply via email to