You have decided to record solar and lunar altitude in your database in custom fields so that you can use the WeeWX plot engine to plot each. To do this there are two distinct tasks you need to complete. First you need to extend your database schema to include the new fields. Second you need to populate the WeeWX archive record with the current solar and lunar altitudes (WeeWX will then automatically store your altitude data in the database). Whilst related these are quite separate tasks.
To add the custom fields you need to choose field names, these can be anything, you could call them ‘elephant’ and ‘giraffe’ if you wanted. However, it is best if they are short descriptive names that indicate the field contents. If solar_altitude happens to appear in almanac.py then that is coincidental and will in no way cause your custom field to be populated with the data that almanac.py stores in the solar_altitude variable. The second task is to have WeeWX add solar altitude and lunar altitude data to the archive record. This is where the field names you chose earlier are used. You need to write some code that will calculate the solar and lunar altitude and store this data in the WeeWX archive record in the fields with names corresponding to those you added to the schema. WeeWX will not automatically do this calculation for you, you will need to write some code. Tags such as $almanac.sun.alt are of no use to you, these are tags that can be used in weewx reports (templates) only and that is not what you are doing here. You chose to go down the path of adding fields to the database so that you can plot them. This has the advantage of plot generation itself being very simple (WeeWX will do it all for you) but there is moderate complexity involved in getting WeeWX to archive the data for you. The approach I outlined earlier requires a fairly simple report be generated but moderate complexity in implementing highcharts (or similar) to plot the generated data. Unfortunately there are no free lunches :) Gary -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/f86f10e5-4484-445f-9284-b98013103666%40googlegroups.com.
