Created
October 7, 2024 14:54
-
-
Save frafra/e68b318b47347dd4cc16c14f5a0ff944 to your computer and use it in GitHub Desktop.
check senorge data
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 | |
set -eu | |
lon=10.407 | |
lat=63.431 | |
echo "# seNorge GDAL test" | |
echo | |
echo "## Test info" | |
echo "Date: $(date)" | |
echo "Using $(gdalinfo --version)" | |
echo | |
echo "## Results" | |
for resource in \ | |
NETCDF:"/vsicurl/https://thredds.met.no/thredds/fileServer/senorge/seNorge_snow/swe/swe_2024.nc":snow_water_equivalent \ | |
NETCDF:"/vsicurl/https://thredds.met.no/thredds/fileServer/senorge/seNorge_2018/Archive/seNorge2018_2024.nc":rr \ | |
NETCDF:"/vsicurl/https://thredds.met.no/thredds/fileServer/senorge/seNorge_2018/aggregated_products/tg/seNorge2018_tg_normal_1991_2020_yearly.nc":tg | |
do | |
echo "### $resource" | |
result="$(gdallocationinfo -wgs84 -b 1 "$resource" $lon $lat 2>&1 >/dev/null || true)" | |
if [ -z "$result" ] | |
then | |
echo "✅ Check passed" | |
else | |
echo "❌ Check failed" | |
echo '```' | |
echo "$result" | |
echo '```' | |
fi | |
echo | |
done |
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 | |
set -euo pipefail | |
for year in {1957..2023} | |
do | |
expected=$(date -d "1 Jan $year +1year-1day" +%j) | |
days=$(gdalinfo -json NETCDF:"/vsicurl/https://thredds.met.no/thredds/fileServer/senorge/seNorge_2018/Archive/seNorge2018_$year.nc":rr 2>/dev/null | jq '.bands | length') | |
if [ "$days" -ne "$expected" ] | |
then | |
echo "Data for $year should have $expected days but it has $days" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment