Categories
Astro Palm Python

Working with vCalendar

I couldn’t sleep last night, so I used my time to work on putting Moon phase information for the new year into my Palm’s calendar. I already have a Python script that will calculate the times of the phases of the Moon based on the algorithms found in Jean Meeus’ Astronomical Algorithms (2nd Ed., 1998). But I still needed a way to import this data into my Palm in an automated way. Last year, I did this by hand. Yuck! So I used the Palm Desktop application and the vCalendar file format for exchange of calendaring and scheduling information. I had never used the vCalendar format before, but I found the specifications online and soon modified my Python code to output into this format. Here’s an example of what I produced:

BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20050103T174530Z
SUMMARY:Last Quarter 01h45
END:VEVENT
BEGIN:VEVENT
DTSTART:20050110T120238Z
SUMMARY:New Moon 20h02
END:VEVENT
...
END:VCALENDAR

Note that the times DTSTART are given in UTC (the “Z” is for “zulu”), but I wanted the event description to be in local time (8 hours ahead for China). Since China doesn’t observe daylight savings time, I could apply this +8 h correction into the Python code quite trivially.

If you want to see the code that I used to do this, just email me.

Leave a Reply

Your email address will not be published. Required fields are marked *