|
1 year ago | |
---|---|---|
README.md | 1 year ago | |
api_calendar.py | 1 year ago | |
guix.scm | 1 year ago |
README.md
tide-charts
This is a Python application to create a tide and moonphase chart of the given year.
Overview
Code for retrieving and manipulating data is in api_calendar.py
.
This uses the NOAA API (see below) to retrieve tidal predictions for the
Mobile, AL tide station (the location this project was originally for).
The conceptual entrypoint for the file is gen_calendar
which takes a dict
of the format returned by any of the *_tidal_predictions
functions
(except cache
) and returns a dict where each key is a month name and each
value is a dict where each key is a day number and each value is a list of
strings, each string being one high or low tide formatted as
"
generate_pdfs.py
is a Flask app which, when invoked from the command line,
uses Frozen Flask to generate HTML pages, one per month, with the tides and
moon phases on each day; then converts these HTML pages to PDFs with unoconv
.
How It Works
- Retrieve tidal predictions
- Mangle the raw JSON into the preferred internal format
- Use this data to generate HTML using Jinja via Flask
- Freeze HTML with Frozen Flask
- Convert to PDFs with
unoconv
NOAA API
There is an API for this data. Allowing for changed years, this program uses:
https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20220101&end_date=20221231&station=8737048&product=predictions&datum=MLLW&units=english&interval=hilo&time_zone=lst_ldt&application=testing&format=json
There is also API documentation