fitnr/buoyant

get all data, insert into database

seankreid opened this issue · 1 comments

I was hoping someone could provide insight to the following idea. I wanted to write a python program that will take all data for each buoy which can then be inserted to a database.

fitnr commented

Here's a bash snippet that drops tide data into a long CSV file. It assumes you have a file called station_list.txt, which contains one station id per line. It also requires GNU Parallel.

#!/bin/bash
tide_prefix () {
  python -m tidetable "$1" --year=2019 | tail -n+2 | sed 's/$/'",$1/";
}
export -f tide_prefix
parallel -j 2 tide_prefix :::: station_list.txt >> tides.csv

Customizing to send the data to a database should be straightforward. If you have issues see this page.