Generate tidal charts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
J. Sims c3bf0da10b
init
1 year ago
README.md init 1 year ago
api_calendar.py init 1 year ago
guix.scm init 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

  1. Retrieve tidal predictions
  2. Mangle the raw JSON into the preferred internal format
  3. Use this data to generate HTML using Jinja via Flask
  4. Freeze HTML with Frozen Flask
  5. 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