Last active
November 11, 2024 22:28
-
-
Save dewomser/26431442545553e86d423c16317fa7ab to your computer and use it in GitHub Desktop.
Bashskript für DWD API Vorhersage Luftqualität für deutsche Stödte am Beispiel Worms. Bruchstücke / Ideen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Achtung, funktioniert so nicht ! | |
# Kann man aber als Idee benutzen. | |
datum=$(date +%Y%m%d%H) | |
datum1=$((datum -1)) | |
# CSV-Datei herunterladen | |
curl -o lq_forecast.csv https://opendata.dwd.de/climate_environment/health/forecasts/air_quality/lq_forecast_$datum1.csv | |
# Daten für die Station 'DERP023' extrahieren | |
cat "lq_forecast.csv" | grep -E ^\'DERP023\|^Station>derp023_data.csv | |
cut -f7- -d';' derp023_data.csv |tr -d h| tr -d + > data.csv | |
# Gnuplot-Skript | |
gnuplot << EOF | |
set datafile separator ";" | |
set terminal png size 800,600 | |
set output 'plot.png' | |
set title "Luftqualität Quelle DWD" | |
set xlabel "Stunden" | |
set ylabel "Wert" | |
set xrange [1:96] # Angenommen, dass die Zeit in Stunden von 1 bis 96 reicht | |
set style data lines | |
set key autotitle columnhead | |
# Daten aus Zeilen plotten | |
#plot for [i=2:7] 'data.csv' using 0:i with lines | |
plot for [row=1:*] 'data.csv' matrix every :::row::row with lines | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment