Skip to content

Commit 15e564c

Browse files
authored
Merge pull request #420 from NASA-IMPACT/develop
Deploy v1.6.0
2 parents 8ef47e8 + d21c6d9 commit 15e564c

File tree

7 files changed

+104
-18
lines changed

7 files changed

+104
-18
lines changed

app/assets/scripts/components/common/layers/index.js

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import population from './layer-population';
88
import nightlightsViirs from './layer-nightlights-viirs';
99
import nightlightsHd from './layer-nightlights-hd';
1010
import detectionShip from './layer-detection-ship';
11+
import recovery from './layer-recovery';
1112
import slowdown from './layer-slowdown';
1213
import waterChlorophyll from './layer-water-chlorophyll';
1314
import waterSpm from './layer-water-spm';
1415
import agriculture from './layer-agriculture';
16+
import detectionPlane from './layer-detection-plane';
1517
import agTogo from './layer-togo-ag';
1618

1719
const layers = [
@@ -23,29 +25,36 @@ const layers = [
2325
nightlightsViirs,
2426
nightlightsHd,
2527
detectionShip,
28+
recovery,
2629
slowdown,
2730
waterChlorophyll,
2831
waterSpm,
2932
agriculture,
33+
detectionPlane,
3034
agTogo
3135
];
3236

3337
export default layers;
3438

3539
const layersBySpotlight = {
36-
be: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown'],
37-
du: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown'],
38-
gh: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown'],
39-
la: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'agriculture', 'slowdown', 'detection-ship'],
40-
sf: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'agriculture', 'slowdown', 'detection-ship', 'water-chlorophyll', 'water-spm'],
41-
tk: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs'],
42-
ny: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'detection-ship', 'water-chlorophyll', 'water-spm'],
40+
be: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'recovery', 'detection-plane'],
41+
du: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'recovery'],
42+
gh: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'recovery'],
43+
la: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'agriculture', 'slowdown', 'detection-ship', 'detection-plane', 'recovery'],
44+
sf: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'agriculture', 'slowdown', 'recovery', 'detection-ship', 'detection-plane', 'water-chlorophyll', 'water-spm'],
45+
tk: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'recovery', 'detection-plane'],
46+
ny: ['no2', 'no2-diff', 'co2', 'co2-diff', 'nightlights-hd', 'nightlights-viirs', 'slowdown', 'detection-ship', 'detection-plane', 'water-chlorophyll', 'water-spm', 'recovery'],
4347
togo: ['togo-ag']
4448
};
4549

4650
const layerOverridesBySpotlight = {
4751
be: {
48-
'nightlights-viirs': handleNightlightsViirs
52+
'nightlights-viirs': handleNightlightsViirs,
53+
'detection-plane': (l, spotlightId) =>
54+
handleInferenceTimeseries(l, spotlightId, {
55+
domain: ['2020-01-09', '2020-01-12', '2020-01-14', '2020-02-10', '2020-02-18', '2020-03-12', '2020-03-13', '2020-03-19', '2020-04-11', '2020-05-05', '2020-05-14']
56+
})
57+
4958
},
5059
du: {
5160
'nightlights-viirs': handleNightlightsViirs
@@ -62,6 +71,10 @@ const layerOverridesBySpotlight = {
6271
'detection-ship': (l, spotlightId) =>
6372
handleInferenceTimeseries(l, spotlightId, {
6473
domain: ['2020-01-22', '2020-02-02', '2020-02-03', '2020-02-27', '2020-02-29', '2020-03-03', '2020-03-08', '2020-03-15', '2020-03-21', '2020-03-22', '2020-03-27', '2020-04-23', '2020-04-24']
74+
}),
75+
'detection-plane': (l, spotlightId) =>
76+
handleInferenceTimeseries(l, spotlightId, {
77+
domain: ['2020-01-10', '2020-01-14', '2020-02-01', '2020-02-03', '2020-03-22', '2020-04-15', '2020-04-21', '2020-05-04', '2020-05-05']
6578
})
6679
},
6780
sf: {
@@ -81,7 +94,11 @@ const layerOverridesBySpotlight = {
8194
...l,
8295
domain: ['2020-03-02', '2020-04-03', '2020-04-19', '2020-05-04', '2020-05-05', '2020-05-21', '2020-05-24', '2020-05-28', '2020-06-01', '2020-06-03', '2020-06-06', '2020-06-13', '2020-06-21', '2020-06-22', '2020-06-23', '2020-06-25', '2020-06-28', '2020-07-01', '2020-07-03']
8396
};
84-
}
97+
},
98+
'detection-plane': (l, spotlightId) =>
99+
handleInferenceTimeseries(l, spotlightId, {
100+
domain: ['2020-01-11', '2020-01-12', '2020-01-13', '2020-02-06', '2020-02-07', '2020-02-10', '2020-02-15', '2020-02-18', '2020-02-20', '2020-03-09', '2020-03-10', '2020-03-12', '2020-03-19', '2020-04-02', '2020-04-03', '2020-04-07', '2020-04-15', '2020-04-22', '2020-05-04', '2020-05-05', '2020-05-07', '2020-05-19']
101+
})
85102
},
86103
tk: {
87104
'nightlights-viirs': handleNightlightsViirs,
@@ -94,7 +111,11 @@ const layerOverridesBySpotlight = {
94111
tiles: l.source.tiles.map(t => t.replace('&rescale=-100%2C100', ''))
95112
}
96113
};
97-
}
114+
},
115+
'detection-plane': (l, spotlightId) =>
116+
handleInferenceTimeseries(l, spotlightId, {
117+
domain: ['2020-01-19', '2020-02-01', '2020-02-05', '2020-03-18', '2020-03-19', '2020-04-09', '2020-04-10', '2020-05-02']
118+
})
98119
},
99120
ny: {
100121
'nightlights-viirs': handleNightlightsViirs,
@@ -120,7 +141,11 @@ const layerOverridesBySpotlight = {
120141
// For NY, nightlights goes till June
121142
domain: [l.domain[0], '2020-06-01']
122143
};
123-
}
144+
},
145+
'detection-plane': (l, spotlightId) =>
146+
handleInferenceTimeseries(l, spotlightId, {
147+
domain: ['2020-01-16', '2020-01-20', '2020-02-17', '2020-02-19', '2020-03-09', '2020-03-15', '2020-04-06', '2020-04-15', '2020-05-05', '2020-05-14']
148+
})
124149
}
125150
};
126151

app/assets/scripts/components/common/layers/layer-co2-diff.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ export default {
99
timeUnit: 'day',
1010
domain: [
1111
'2020-01-01',
12-
'2020-05-17'
12+
'2020-07-16'
1313
],
1414
source: {
1515
type: 'raster',
1616
tiles: [
17-
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2/xco2_15day_diff.{date}.tif&resampling_method=bilinear&bidx=1&rescale=-0.000001%2C0.000001&color_map=rdbu_r`
17+
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2-diff/xco2_16day_diff.{date}.tif&resampling_method=bilinear&bidx=1&rescale=-0.000001%2C0.000001&color_map=rdbu_r`
1818
]
1919
},
2020
exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'],

app/assets/scripts/components/common/layers/layer-co2.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ export default {
1111
timeUnit: 'day',
1212
domain: [
1313
'2020-01-01',
14-
'2020-05-17'
14+
'2020-07-16'
1515
],
1616
source: {
1717
type: 'raster',
1818
tiles: [
19-
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2/xco2_15day_mean.{date}.tif&resampling_method=bilinear&bidx=1&rescale=0.000408%2C0.000419&color_map=rdylbu_r&color_formula=gamma r {gamma}`
19+
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2-mean/xco2_16day_mean.{date}.tif&resampling_method=bilinear&bidx=1&rescale=0.000408%2C0.000419&color_map=rdylbu_r&color_formula=gamma r {gamma}`
2020

2121
]
2222
},
@@ -30,7 +30,7 @@ export default {
3030
source: {
3131
type: 'raster',
3232
tiles: [
33-
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2/xco2_15day_base.{date}.tif&resampling_method=bilinear&bidx=1&rescale=0.000408%2C0.000419&color_map=rdylbu_r&color_formula=gamma r {gamma}`
33+
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/xco2-base/xco2_16day_base.{date}.tif&resampling_method=bilinear&bidx=1&rescale=0.000408%2C0.000419&color_map=rdylbu_r&color_formula=gamma r {gamma}`
3434
]
3535
}
3636
},
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import config from '../../../config';
2+
import { indicatorGroupColors } from '../../../styles/theme/theme';
3+
4+
export default {
5+
id: 'detection-plane',
6+
name: 'Planes',
7+
type: 'inference-timeseries',
8+
domain: [
9+
'2020-01-01',
10+
'2020-04-30'
11+
],
12+
source: {
13+
vector: {
14+
type: 'geojson',
15+
data: `${config.api}/detections/plane/{spotlightId}/{date}.geojson`
16+
},
17+
raster: {
18+
type: 'raster',
19+
tiles: [
20+
`${config.api}/planet/{z}/{x}/{y}?date={date}&site={spotlightId}`
21+
]
22+
}
23+
},
24+
exclusiveWith: ['agriculture', 'no2', 'no2-diff', 'co2-diff', 'co2', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-multi', 'water-chlorophyll', 'water-spm'],
25+
enabled: false,
26+
swatch: indicatorGroupColors.economic,
27+
timeUnit: 'day',
28+
info: 'Planes detected each day in PlanetScope imagery are shown in red.'
29+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import config from '../../../config';
2+
3+
import { indicatorGroupColors } from '../../../styles/theme/theme.js';
4+
5+
export default {
6+
id: 'recovery',
7+
name: 'Recovery Proxy Map',
8+
type: 'raster',
9+
source: {
10+
type: 'raster',
11+
tiles: [
12+
`${config.api}/{z}/{x}/{y}@1x?url=s3://covid-eo-data/rpm/rpm-{spotlightId}.cog.tif&resampling_method=bilinear&bidx=1%2C2%2C3%24`
13+
]
14+
},
15+
paint: {
16+
'raster-opacity': 0.9
17+
},
18+
exclusiveWith: ['agriculture', 'co2', 'co2-diff', 'gibs-population', 'car-count', 'nightlights-viirs', 'nightlights-hd', 'detection-ship', 'detection-multi', 'water-chlorophyll', 'water-spm'],
19+
enabled: true,
20+
swatch: indicatorGroupColors.economic,
21+
info: 'Recovery Proxy Maps show areas with the greatest increase in car activity shaded in orange. Darker orange indicates areas of greater change.'
22+
};

app/assets/scripts/components/common/layers/types.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ export const layerTypes = {
214214
const vectorData = vector.data.replace('{date}', formatDate);
215215
const rasterTiles = raster.tiles.map(tile => tile.replace('{date}', formatDate));
216216

217+
// inference data moves around, recenter on each update
218+
fetch(vectorData)
219+
.then(res => res.json())
220+
.then(geo => {
221+
mbMap.fitBounds(bbox(geo));
222+
})
223+
.catch(err => {
224+
console.log(err); // eslint-disable-line no-console
225+
});
226+
217227
replaceVectorData(mbMap, vecId, vectorData);
218228
replaceRasterTiles(mbMap, rastId, rasterTiles);
219229
},
@@ -262,7 +272,7 @@ export const layerTypes = {
262272
mbMap.fitBounds(bbox(geo));
263273
})
264274
.catch(err => {
265-
throw err;
275+
console.log(err); // eslint-disable-line no-console
266276
});
267277
}
268278
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "covid-dashboard",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "Frontend application for the Covid Dashboard",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)