import csv, sys from pathlib import Path up = Path(sys.argv[1]); out = Path(sys.argv[2]) rows = list(csv.reader(open(up / "time-series.csv"))) with open(out / "time-series-3h.csv", "w", newline="") as f: w = csv.writer(f, lineterminator="\n"); w.writerow(rows[0]); w.writerows(rows[1:][::3]) CARRIERS = [("wind", "dodgerblue"), ("solar", "gold"), ("hydrogen storage", "black"), ("battery storage", "yellowgreen"), ("load shedding", "darkorange"), ("electrolysis", "magenta"), ("turbine", "red"), ("electricity", "grey"), ("hydrogen", "grey")] with open(out / "carriers.csv", "w", newline="") as f: w = csv.writer(f, lineterminator="\n"); w.writerow(["name", "color"]); w.writerows(CARRIERS)