diff --git a/data/downloads/process-lakes.sh b/data/downloads/process-lakes.sh new file mode 100755 index 000000000..ac3dcc38d --- /dev/null +++ b/data/downloads/process-lakes.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +FOLDER=./download/lakes + +set -e + +for filename in $FOLDER/*.tif; do + TIF_FILENAME=$filename + NC_FILENAME=${filename%.*}.nc + echo $TIF_FILENAME + python ./data/tif2netcdf.py -v lswt -f $TIF_FILENAME -o $NC_FILENAME +done diff --git a/data/gdal-colors/colors-lswt.txt b/data/gdal-colors/colors-lswt.txt index ea41531da..42074a417 100644 --- a/data/gdal-colors/colors-lswt.txt +++ b/data/gdal-colors/colors-lswt.txt @@ -1,6 +1,14 @@ -3500 230 56 30 -2250 230 230 30 -1250 30 230 30 -500 20 210 230 --500 28 88 203 +3500 120 10 10 +3000 240 40 40 +2500 240 120 30 +2000 250 210 35 +1500 148 200 148 +1000 100 200 200 +500 65 168 240 +0 40 40 140 +-500 10 10 60 +-4999 10 10 60 +-5000 255 255 255 +-42767 0 0 0 0 nv 0 0 0 0 + diff --git a/data/layers-config.json b/data/layers-config.json index 0d099d7e7..1e792ec28 100644 --- a/data/layers-config.json +++ b/data/layers-config.json @@ -321,6 +321,7 @@ }, "lakes.lswt": { "colorMap": "custom", + "basemap": "dark", "timeFormat": { "year": "numeric", "month": "long" diff --git a/data/tif2netcdf.py b/data/tif2netcdf.py index 2fcfbe6ce..988aa0935 100644 --- a/data/tif2netcdf.py +++ b/data/tif2netcdf.py @@ -1,6 +1,8 @@ +# pip install rioxarray + from datetime import time import xarray as xr -import rasterio +import rioxarray import pandas as pd import re from argparse import ArgumentParser @@ -11,7 +13,7 @@ parser.add_argument("-v", "--variable", dest="variable") args = parser.parse_args() -da = xr.open_rasterio(args.file) +da = rioxarray.open_rasterio(args.file) ds = da.to_dataset(name=args.variable) timestamp = re.search("(\d+).tif$", args.file).group(0) diff --git a/data/triggers/lakes_lswt.sh b/data/triggers/lakes_lswt.sh index e91a9c4a7..d15bdd9ec 100755 --- a/data/triggers/lakes_lswt.sh +++ b/data/triggers/lakes_lswt.sh @@ -4,16 +4,16 @@ TIMEOUT=16000 LAYER_ID="lakes.lswt" VARIABLE_ID="lswt" LAYER_TYPE="image" -VERSION="1.7.1" +VERSION="1.8.1" LON_RES="4320" LAT_RES="2160" ZOOM_LEVELS="0-3" MIN_LON="-180" -MAX_LON="180" +MAX_LON="360" MIN_LAT="-90" -MAX_LAT="90" -MIN="-500" -MAX="3500" +MAX_LAT="180" +MIN="auto" +MAX="auto" MACHINE_TYPE="N1_HIGHCPU_8" if [ ! -f ./package.json ]; then diff --git a/scripts/generate-legend-images.js b/scripts/generate-legend-images.js index 41d6198a5..7e3dbf734 100644 --- a/scripts/generate-legend-images.js +++ b/scripts/generate-legend-images.js @@ -64,11 +64,18 @@ files.forEach(file => { function readColorFile(file) { const filePath = path.join(INTPUT_FOLDER, file); const content = fs.readFileSync(filePath, 'utf8'); - return content + const stops = content .split('\n') .filter(Boolean) .filter(line => !line.startsWith('nv')) .map(line => line.split(' ')); + + if (file.includes('lswt')) { + // do not include the "ice" color + return stops.filter(([v]) => v > -1000); + } + + return stops; } function writeImage(file, canvas) {