Skip to content

Commit

Permalink
feat(dataset): use correct colors for lakes.lswt legend image
Browse files Browse the repository at this point in the history
  • Loading branch information
pwambach committed Aug 30, 2022
1 parent 8869f03 commit b5e4c3c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
17 changes: 11 additions & 6 deletions data/gdal-colors/colors-lswt.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
3500 230 56 30
2250 230 230 30
1250 30 230 30
500 20 210 230
-500 28 88 203
-4999 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

1 change: 1 addition & 0 deletions data/layers-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
},
"lakes.lswt": {
"colorMap": "custom",
"basemap": "dark",
"timeFormat": {
"year": "numeric",
"month": "long"
Expand Down
2 changes: 1 addition & 1 deletion data/triggers/lakes_lswt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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"
Expand Down
9 changes: 8 additions & 1 deletion scripts/generate-legend-images.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b5e4c3c

Please sign in to comment.