Skip to content

Commit

Permalink
fix: new temperature layer from google earth engine (#140)
Browse files Browse the repository at this point in the history
* New temperature layer

* Backward compability for temperature layer
  • Loading branch information
turban authored May 22, 2019
1 parent 8e542ca commit 6ca1cd9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/edit/EarthEngineDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const datasets = {
minLabel: 'Min mm',
maxLabel: 'Max mm',
},
'MODIS/MOD11A2': {
'MODIS/006/MOD11A2': {
// Temperature
description:
'Land surface temperatures collected from satellite in 8 days periods. Blank spots will appear in areas with a persistent cloud cover.',
Expand Down
4 changes: 2 additions & 2 deletions src/epics/earthEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ const collections = {
)
);
},
'MODIS/MOD11A2': resolve => {
'MODIS/006/MOD11A2': resolve => {
// Temperature
const imageCollection = ee
.ImageCollection('MODIS/MOD11A2')
.ImageCollection('MODIS/006/MOD11A2')
.sort('system:time_start', false);

const featureCollection = ee
Expand Down
10 changes: 9 additions & 1 deletion src/loaders/earthEngineLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const datasets = {
'https://explorer.earthengine.google.com/#detail/UCSB-CHG%2FCHIRPS%2FPENTAD',
},
},
'MODIS/MOD11A2': {
'MODIS/006/MOD11A2': {
name: 'Temperature',
band: 'LST_Day_1km',
mask: true,
Expand Down Expand Up @@ -187,6 +187,14 @@ const earthEngineLoader = async config => {
// From database as favorite
layerConfig = JSON.parse(config.config);

// Backward compability for temperature layer (could also be fixed in a db update script)
if (layerConfig.id === 'MODIS/MOD11A2' && layerConfig.filter) {
const period = layerConfig.image.slice(-10);
layerConfig.id = 'MODIS/006/MOD11A2';
layerConfig.image = period;
layerConfig.filter[0].arguments[1] = period;
}

dataset = datasets[layerConfig.id];

if (dataset) {
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const defaultLayers = [
},
{
layer: 'earthEngine',
datasetId: 'MODIS/MOD11A2',
datasetId: 'MODIS/006/MOD11A2',
type: 'Temperature',
img: 'images/temperature.png',
params: {
Expand Down

0 comments on commit 6ca1cd9

Please sign in to comment.