From 24762beaf00a1d83e089c181403a6b1ba6c31ab3 Mon Sep 17 00:00:00 2001 From: Luis Zenteno Date: Wed, 30 Aug 2023 16:05:15 -0600 Subject: [PATCH] fix(fire-alerts-widgets): temporary remove VIIIRS from the dataset options and set MODIS as default one --- .../widgets/fires/burned-area-cumulative/index.js | 11 ++++------- components/widgets/fires/burned-area-ranked/index.js | 11 ++++------- components/widgets/fires/burned-area/index.js | 2 +- components/widgets/fires/fire-alerts-simple/index.js | 2 +- .../widgets/fires/fires-alerts-cumulative/index.js | 2 +- .../fires/fires-alerts-historical-daily/index.js | 2 +- .../fires/fires-alerts-historical-weekly/index.js | 2 +- .../widgets/fires/fires-alerts-historical/index.js | 2 +- components/widgets/fires/fires-alerts/index.js | 4 ++-- components/widgets/fires/fires-ranked/index.js | 2 +- components/widgets/fires/fires-within/index.js | 2 +- data/fires-datasets.json | 7 ------- 12 files changed, 18 insertions(+), 31 deletions(-) diff --git a/components/widgets/fires/burned-area-cumulative/index.js b/components/widgets/fires/burned-area-cumulative/index.js index 3af5fb99be..e6b8584b6e 100644 --- a/components/widgets/fires/burned-area-cumulative/index.js +++ b/components/widgets/fires/burned-area-cumulative/index.js @@ -25,8 +25,7 @@ const defaultConfig = { alerts: [ { id: 'cumulative-burned-areas-1', - text: - 'We are preparing to remove MODIS Burned Areas from the Global Forest Watch site and will not be updating the data going forward. Please e-mail gfw@wri.org with any requests to keep this dataset or with suggestions for new fire-related data sets.', + text: 'We are preparing to remove MODIS Burned Areas from the Global Forest Watch site and will not be updating the data going forward. Please e-mail gfw@wri.org with any requests to keep this dataset or with suggestions for new fire-related data sets.', visible: ['country', 'dashboard'], }, ], @@ -99,7 +98,7 @@ const defaultConfig = { fires: 3, }, settings: { - dataset: 'modis_burned_area', + dataset: 'modis', firesThreshold: 0, }, sentences: { @@ -152,12 +151,10 @@ export default { refetchKeys: ['dataset'], getWidget: (widgetSettings) => { // called when settings changes - if (!widgetSettings || !widgetSettings.dataset) { - return defaultConfig; - } - if (widgetSettings.dataset !== 'modis_burned_area') { + if (widgetSettings?.dataset !== 'modis_burned_area') { return firesAlertsCumulative; } + return defaultConfig; }, }; diff --git a/components/widgets/fires/burned-area-ranked/index.js b/components/widgets/fires/burned-area-ranked/index.js index 7f0d2ea94a..9fd37a78c6 100644 --- a/components/widgets/fires/burned-area-ranked/index.js +++ b/components/widgets/fires/burned-area-ranked/index.js @@ -22,8 +22,7 @@ const defaultConfig = { alerts: [ { id: 'regions-most-burned-areas-1', - text: - 'We are preparing to remove MODIS Burned Areas from the Global Forest Watch site and will not be updating the data going forward. Please e-mail gfw@wri.org with any requests to keep this dataset or with suggestions for new fire-related data sets.', + text: 'We are preparing to remove MODIS Burned Areas from the Global Forest Watch site and will not be updating the data going forward. Please e-mail gfw@wri.org with any requests to keep this dataset or with suggestions for new fire-related data sets.', visible: ['global', 'country', 'adm0', 'adm1', 'dashboard'], }, ], @@ -119,7 +118,7 @@ const defaultConfig = { page: 0, period: 'week', weeks: 4, - dataset: 'modis_burned_area', + dataset: 'modis', layerStartDate: null, layerEndDate: null, firesThreshold: 0, @@ -164,12 +163,10 @@ export default { refetchKeys: ['dataset'], getWidget: (widgetSettings) => { // called when settings changes - if (!widgetSettings || !widgetSettings.dataset) { - return defaultConfig; - } - if (widgetSettings.dataset !== 'modis_burned_area') { + if (widgetSettings?.dataset !== 'modis_burned_area') { return firesRanked; } + return defaultConfig; }, }; diff --git a/components/widgets/fires/burned-area/index.js b/components/widgets/fires/burned-area/index.js index 284f740a31..e1365abd76 100644 --- a/components/widgets/fires/burned-area/index.js +++ b/components/widgets/fires/burned-area/index.js @@ -86,7 +86,7 @@ export default { fires: 1, }, settings: { - dataset: 'modis_burned_area', + dataset: 'modis', firesThreshold: 0, }, sentences: { diff --git a/components/widgets/fires/fire-alerts-simple/index.js b/components/widgets/fires/fire-alerts-simple/index.js index a10438a00d..54a185667a 100644 --- a/components/widgets/fires/fire-alerts-simple/index.js +++ b/components/widgets/fires/fire-alerts-simple/index.js @@ -108,7 +108,7 @@ export default { }, // initial settings settings: { - dataset: 'viirs', + dataset: 'modis', }, getData: async (params) => { const { VIIRS } = await handleGfwParamsMeta(params); diff --git a/components/widgets/fires/fires-alerts-cumulative/index.js b/components/widgets/fires/fires-alerts-cumulative/index.js index 743e54de57..a951f1a65f 100644 --- a/components/widgets/fires/fires-alerts-cumulative/index.js +++ b/components/widgets/fires/fires-alerts-cumulative/index.js @@ -61,7 +61,7 @@ export default { fires: 2, }, settings: { - dataset: 'viirs', + dataset: 'modis', confidence: 'h', }, sentences: { diff --git a/components/widgets/fires/fires-alerts-historical-daily/index.js b/components/widgets/fires/fires-alerts-historical-daily/index.js index fbcfb25ccf..9e9596b7b7 100644 --- a/components/widgets/fires/fires-alerts-historical-daily/index.js +++ b/components/widgets/fires/fires-alerts-historical-daily/index.js @@ -32,7 +32,7 @@ export default { colors: 'fires', metaKey: 'widget_fire_alert_location', settings: { - dataset: 'viirs', + dataset: 'modis', }, datasets: [ { diff --git a/components/widgets/fires/fires-alerts-historical-weekly/index.js b/components/widgets/fires/fires-alerts-historical-weekly/index.js index e411fbf870..baedaa44c2 100644 --- a/components/widgets/fires/fires-alerts-historical-weekly/index.js +++ b/components/widgets/fires/fires-alerts-historical-weekly/index.js @@ -62,7 +62,7 @@ export default { colors: 'fires', metaKey: 'widget_fire_alert_location', settings: { - dataset: 'viirs', + dataset: 'modis', minDate: '2000-01-01', confidence: '', }, diff --git a/components/widgets/fires/fires-alerts-historical/index.js b/components/widgets/fires/fires-alerts-historical/index.js index d2d392445c..804141c6f1 100644 --- a/components/widgets/fires/fires-alerts-historical/index.js +++ b/components/widgets/fires/fires-alerts-historical/index.js @@ -61,7 +61,7 @@ export default { colors: 'fires', metaKey: 'widget_fire_alert_location', settings: { - dataset: 'viirs', + dataset: 'modis', minDate: '2000-01-01', confidence: '', }, diff --git a/components/widgets/fires/fires-alerts/index.js b/components/widgets/fires/fires-alerts/index.js index 3920448cb3..c18e970eea 100644 --- a/components/widgets/fires/fires-alerts/index.js +++ b/components/widgets/fires/fires-alerts/index.js @@ -94,7 +94,7 @@ const defaultConfig = { fires: 1, }, settings: { - dataset: 'viirs', + dataset: 'modis', confidence: 'h', }, sentences: { @@ -359,13 +359,13 @@ export default { proxy: true, refetchKeys: ['dataset'], getWidget: (widgetSettings) => { - // called when settings changes if (!widgetSettings || !widgetSettings.dataset) { return defaultConfig; } if (widgetSettings.dataset === 'modis_burned_area') { return burnedAreaStats; } + return defaultConfig; }, }; diff --git a/components/widgets/fires/fires-ranked/index.js b/components/widgets/fires/fires-ranked/index.js index 4c6aea31e8..cd7e7c5063 100644 --- a/components/widgets/fires/fires-ranked/index.js +++ b/components/widgets/fires/fires-ranked/index.js @@ -101,7 +101,7 @@ export default { page: 0, period: 'week', weeks: 4, - dataset: 'viirs', + dataset: 'modis', layerStartDate: null, layerEndDate: null, }, diff --git a/components/widgets/fires/fires-within/index.js b/components/widgets/fires/fires-within/index.js index 22b26bf9dc..df2f141565 100644 --- a/components/widgets/fires/fires-within/index.js +++ b/components/widgets/fires/fires-within/index.js @@ -75,7 +75,7 @@ export default { settings: { period: 'week', weeks: 13, - dataset: 'viirs', + dataset: 'modis', confidence: 'h', }, settingsBtnConfig: { diff --git a/data/fires-datasets.json b/data/fires-datasets.json index 9ee4010801..e9ca9ab207 100644 --- a/data/fires-datasets.json +++ b/data/fires-datasets.json @@ -1,11 +1,4 @@ [ - { - "label": "VIIRS Alerts", - "value": "viirs", - "unit": "alerts", - "metaKey": null, - "infoText": "VIIRS alerts have a higher resolution, but are less performant in cloudy areas than MODIS alerts" - }, { "label": "MODIS Alerts", "value": "modis",