Interactive interface for browsing global, full-resolution satellite imagery
Add two tempo layers to EIC (#5278)
Patrick Moulden1c83aa80fdd8
diff --git a/web/js/mapUI/components/eic/eic.js b/web/js/mapUI/components/eic/eic.jsindex f76e35d95..44966c600 100644--- a/web/js/mapUI/components/eic/eic.js+++ b/web/js/mapUI/components/eic/eic.js@@ -25,7 +25,7 @@ function EIC() {const resolutionDate = data.resolution_date;if (resolutionDate === 'No valid date found') {- console.error('No valid date found, using EIC Legacy mode');+ console.warn('No valid date found, using EIC Legacy mode');setEICLegacy(true);return;}@@ -33,7 +33,7 @@ function EIC() {const dateObj = new Date(resolutionDate);selectDate(dateObj);} catch (error) {- console.error('Error fetching the best date, using EIC Legacy mode:', error);+ console.warn('Error fetching the best date, using EIC Legacy mode:', error);setEICLegacy(true);}};diff --git a/web/js/mapUI/components/kiosk/tile-measurement/utils/calculate-pixels.js b/web/js/mapUI/components/kiosk/tile-measurement/utils/calculate-pixels.jsindex 2e6f2dfa0..f92dd897f 100644--- a/web/js/mapUI/components/kiosk/tile-measurement/utils/calculate-pixels.js+++ b/web/js/mapUI/components/kiosk/tile-measurement/utils/calculate-pixels.js@@ -2,23 +2,23 @@ export default function calculateBlackPixelRatio(blobUrl) {return new Promise((resolve, reject) => {const img = new Image();img.src = blobUrl;- img.onload = () => {+ img.onload = ({ target }) => {const canvas = document.createElement('canvas');const ctx = canvas.getContext('2d');- canvas.width = img.width;- canvas.height = img.height;- ctx.drawImage(img, 0, 0, img.width, img.height);- const imgData = ctx.getImageData(0, 0, img.width, img.height).data;+ canvas.width = target.width;+ canvas.height = target.height;+ ctx.drawImage(target, 0, 0, target.width, target.height);+ const imgData = ctx.getImageData(0, 0, target.width, target.height).data;let blackPixelsCount = 0;for (let i = 0; i < imgData.length; i += 4) {// Check if pixel is black- if (imgData[i] === 0 && imgData[i + 1] === 0 && imgData[i + 2] === 0 && imgData[i + 3] === 255) {+ if (imgData[i] === 0 && imgData[i + 1] === 0 && imgData[i + 2] === 0 && (imgData[i + 3] === 255 || imgData[i + 3] === 0)) {blackPixelsCount += 1;}}- const totalPixels = img.width * img.height;+ const totalPixels = target.width * target.height;const blackPixelRatio = blackPixelsCount / totalPixels;resolve(blackPixelRatio);};diff --git a/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.js b/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.jsindex d854d3ae6..a852949fd 100644--- a/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.js+++ b/web/js/mapUI/components/kiosk/tile-measurement/utils/layer-data-eic.js@@ -18,6 +18,8 @@ export const layersToMeasure = ['AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day','VIIRS_NOAA20_CorrectedReflectance_TrueColor','CERES_EBAF_TOA_Shortwave_Flux_All_Sky_Monthly',+ 'TEMPO_L3_NO2_Vertical_Column_Troposphere',+ 'TEMPO_L3_Ozone_Column_Amount',];// Object that contains the black pixel % threshold for each layer@@ -41,6 +43,8 @@ export const layerPixelData = {AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day: { threshold: 0.20 },VIIRS_NOAA20_CorrectedReflectance_TrueColor: { threshold: 0.65 },CERES_EBAF_TOA_Shortwave_Flux_All_Sky_Monthly: { threshold: 0.01 },+ TEMPO_L3_NO2_Vertical_Column_Troposphere: { threshold: 0.99 },+ TEMPO_L3_Ozone_Column_Amount: { threshold: 0.99 },};// Back-up dates for each layer in case no date is found that satisfies the full imagery threshold@@ -63,6 +67,8 @@ export const bestDates = {AIRS_L3_Carbon_Monoxide_500hPa_Volume_Mixing_Ratio_Daily_Day: { date: '2023-10-17' },VIIRS_NOAA20_CorrectedReflectance_TrueColor: { date: '2023-10-30' },CERES_EBAF_TOA_Shortwave_Flux_All_Sky_Monthly: { date: '2023-10-30' },+ TEMPO_L3_NO2_Vertical_Column_Troposphere: { date: '2024-06-03T17:00:00.000Z' },+ TEMPO_L3_Ozone_Column_Amount: { date: '2024-06-03T17:00:00.000Z' },};export const travelModeData = {@@ -105,4 +111,10 @@ export const travelModeData = {13: {title: 'Aerosol Optical Depth (AOD) by Suomi NPP satellite',},+ 14: {+ title: 'TEMPO L3 NO2 Vertical Column Troposphere',+ },+ 15: {+ title: 'TEMPO L3 Ozone Column Amount',+ },};