Skip to content

Commit

Permalink
feat: add new lakes data
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach committed Aug 18, 2022
1 parent c92b91e commit 1e3ed5c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
12 changes: 12 additions & 0 deletions data/downloads/process-lakes.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions data/gdal-colors/colors-lswt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
1250 30 230 30
500 20 210 230
-500 28 88 203
-4999 28 88 203
-5000 255 255 255
-42767 0 0 0 0
nv 0 0 0 0
6 changes: 4 additions & 2 deletions data/tif2netcdf.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions data/triggers/lakes_lswt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ TIMEOUT=16000
LAYER_ID="lakes.lswt"
VARIABLE_ID="lswt"
LAYER_TYPE="image"
VERSION="1.6.5"
VERSION="1.7.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
Expand Down

0 comments on commit 1e3ed5c

Please sign in to comment.