Skip to content

Instantly share code, notes, and snippets.

@ryanjdillon
Created July 7, 2023 11:07
Show Gist options
  • Save ryanjdillon/693429f3fa052b1cd2985600aa0b1eb2 to your computer and use it in GitHub Desktop.
Save ryanjdillon/693429f3fa052b1cd2985600aa0b1eb2 to your computer and use it in GitHub Desktop.
Get grib files for areas around Norway
#!/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
@ryanjdillon
Copy link
Author

Just noticed radar gif is hard-coded to western_norway. Not sure if that is available for the n-northsea region. Could try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment