Created
July 7, 2023 11:07
-
-
Save ryanjdillon/693429f3fa052b1cd2985600aa0b1eb2 to your computer and use it in GitHub Desktop.
Get grib files for areas around Norway
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 | |
usage () { | |
cat <<HELP_USAGE | |
$0 <area> <outputs-path> | |
outputs-path: directory weather grib and radar gif should be saved | |
area: weather area to collect for, try "n-northsea" or "west_norway". For | |
more options see https://api.met.no/weatherapi/gribfiles/1.1/available | |
HELP_USAGE | |
} | |
if [ $# -eq 0 ]; then | |
usage | |
exit 1 | |
fi | |
AREA=$1 | |
DATA_DIR=$2 | |
WEATHER_URL='https://api.met.no/weatherapi/gribfiles/1.1/?area=$AREA&content=' | |
WEATHER_PREFIX='norkyst800m_weatherapi_$AREA' | |
echo "Saving outputs to $DATA_DIR" | |
# GRIB files | |
curl -X GET $WEATHER_URL'current' --output $DATA_DIR/current/$WEATHER_PREFIX'_current_'$(date --iso-8601).grb | |
curl -X GET $WEATHER_URL'weather' --output $DATA_DIR/weather/$WEATHER_PREFIX'_weather_'$(date --iso-8601).grb | |
curl -X GET $WEATHER_URL'waves' --output $DATA_DIR/waves/$WEATHER_PREFIX'_waves_'$(date --iso-8601).grb | |
# Precipiation animated GIF | |
curl -X GET 'https://api.met.no/weatherapi/radar/2.0/?type=preciptype&area=western_norway&content=animation' --output $DATA_DIR/radar/anim-vestnorge_radar_$(date --iso-8601).gif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just noticed radar gif is hard-coded to
western_norway
. Not sure if that is available for then-northsea
region. Could try that.