From 6a012cf2c3db554ac12fabc3d0340e5a655c0985 Mon Sep 17 00:00:00 2001 From: Will Gislason <8203830+gislawill@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:12:14 -0700 Subject: [PATCH 1/7] Initial aggregation layer for CDI. Only monthly v1 currently --- .../MapView/Layers/CompositeLayer/index.tsx | 133 +++++++++++++----- frontend/src/config/jordan/layers.json | 108 ++++++++++++++ frontend/src/config/jordan/prism.json | 1 + frontend/src/config/types.ts | 6 + frontend/src/context/layers/composite_data.ts | 21 ++- 5 files changed, 232 insertions(+), 37 deletions(-) diff --git a/frontend/src/components/MapView/Layers/CompositeLayer/index.tsx b/frontend/src/components/MapView/Layers/CompositeLayer/index.tsx index 6ba038e46..6542baaa2 100644 --- a/frontend/src/components/MapView/Layers/CompositeLayer/index.tsx +++ b/frontend/src/components/MapView/Layers/CompositeLayer/index.tsx @@ -1,11 +1,20 @@ -import { CompositeLayerProps, LegendDefinition } from 'config/types'; +import { + CompositeLayerProps, + LegendDefinition, + MapEventWrapFunctionProps, +} from 'config/types'; import { LayerData, loadLayerData } from 'context/layers/layer-data'; import { layerDataSelector } from 'context/mapStateSlice/selectors'; import { memo, useEffect, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { Source, Layer } from 'react-map-gl/maplibre'; -import { getLayerMapId } from 'utils/map-utils'; -import { FillLayerSpecification } from 'maplibre-gl'; +import { + findFeature, + getEvtCoords, + getLayerMapId, + useMapCallback, +} from 'utils/map-utils'; +import { FillLayerSpecification, MapLayerMouseEvent } from 'maplibre-gl'; import { Point } from 'geojson'; import booleanPointInPolygon from '@turf/boolean-point-in-polygon'; import { availableDatesSelector } from 'context/serverStateSlice'; @@ -14,6 +23,7 @@ import { getRequestDateItem } from 'utils/server-utils'; import { safeCountry } from 'config'; import { geoToH3, h3ToGeoBoundary } from 'h3-js'; // ts-ignore import { opacitySelector } from 'context/opacityStateSlice'; +import { addPopupData } from 'context/tooltipStateSlice'; import { legendToStops } from '../layer-utils'; interface Props { @@ -40,6 +50,8 @@ const paintProps: ( const CompositeLayer = memo(({ layer, before }: Props) => { // look to refacto with impactLayer and maybe other layers const [adminBoundaryLimitPolygon, setAdminBoundaryPolygon] = useState(null); + const [aggregationBoundariesPolygon, setAggregationBoundariesPolygon] = + useState(null); const selectedDate = useDefaultDate(layer.dateLayer); const serverAvailableDates = useSelector(availableDatesSelector); const opacityState = useSelector(opacitySelector(layer.id)); @@ -68,47 +80,100 @@ const CompositeLayer = memo(({ layer, before }: Props) => { }, []); useEffect(() => { - if (requestDate) { + if (layer.aggregationBoundaryPath) { + fetch(layer.aggregationBoundaryPath) + .then(response => response.json()) + .then(polygonData => setAggregationBoundariesPolygon(polygonData)) + .catch(error => console.error('Error:', error)); + } + }, [layer.aggregationBoundaryPath]); + + useEffect(() => { + if ( + (requestDate && + layer.aggregationBoundaryPath && + aggregationBoundariesPolygon) || + !layer.aggregationBoundaryPath + ) { dispatch( loadLayerData({ layer, date: requestDate, availableDates: layerAvailableDates, + aggregationBoundariesPolygon, }), ); } - }, [dispatch, layer, layerAvailableDates, requestDate]); + }, [ + dispatch, + layer, + layerAvailableDates, + requestDate, + aggregationBoundariesPolygon, + ]); // Investigate performance impact of hexagons for large countries - const finalFeatures = - data && - data.features - .map(feature => { - const point = feature.geometry as Point; - if ( - !adminBoundaryLimitPolygon || - booleanPointInPolygon( - point.coordinates, - adminBoundaryLimitPolygon as any, - ) - ) { - // Convert the point to a hexagon - const hexagon = geoToH3( - point.coordinates[1], - point.coordinates[0], - 6, // resolution, adjust as needed - ); - return { - ...feature, - geometry: { - type: 'Polygon', - coordinates: [h3ToGeoBoundary(hexagon, true)], // Convert the hexagon to a GeoJSON polygon - }, - }; - } - return null; - }) - .filter(Boolean); + const finalFeatures = layer.aggregationBoundaryPath + ? data?.features + : !layer.aggregationBoundaryPath && + data && + data?.features + .map(feature => { + const point = feature.geometry as Point; + if ( + !adminBoundaryLimitPolygon || + booleanPointInPolygon( + point.coordinates, + adminBoundaryLimitPolygon as any, + ) + ) { + // Convert the point to a hexagon + const hexagon = geoToH3( + point.coordinates[1], + point.coordinates[0], + 6, // resolution, adjust as needed + ); + return { + ...feature, + geometry: { + type: 'Polygon', + coordinates: [h3ToGeoBoundary(hexagon, true)], // Convert the hexagon to a GeoJSON polygon + }, + }; + } + return null; + }) + .filter(Boolean); + + const layerId = getLayerMapId(layer.id); + + const onClick = + ({ + dispatch: providedDispatch, + }: MapEventWrapFunctionProps) => + (evt: MapLayerMouseEvent) => { + const coordinates = getEvtCoords(evt); + + const feature = findFeature(layerId, evt); + if (!feature) { + return; + } + + const popupData = { + [layer.title]: { + data: feature.properties.value.toFixed(3), + coordinates, + }, + }; + providedDispatch(addPopupData(popupData)); + }; + + useMapCallback<'click', CompositeLayerProps>( + 'click', + layerId, + layer, + onClick, + ); if (selectedDate && data && adminBoundaryLimitPolygon) { const filteredData = { diff --git a/frontend/src/config/jordan/layers.json b/frontend/src/config/jordan/layers.json index b78d95a7e..232ed7501 100644 --- a/frontend/src/config/jordan/layers.json +++ b/frontend/src/config/jordan/layers.json @@ -1367,6 +1367,114 @@ ], "legend_text": "Groundwater developed for irrigation (MCM) " }, + "cdi_v1_aggregated": { + "title": "Monthly Combined Drought Index Aggregated (v1)", + "type": "composite", + "period": "monthly", + "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "validity": { + "forward": 1, + "backward": 2, + "mode": "dekad" + }, + "feature_info_props": { + "value": { + "type": "number", + "dataTitle": "Event name" + } + }, + "input_layers": [ + { + "id": "spi_1m", + "importance": 0.5, + "key": [ + "CHIRPS", + "R1S_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "lst_anomaly", + "importance": 0.25, + "key": [ + "MODIS", + "MYD11C2_TDD_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "ndvi_dekad", + "importance": 0.25, + "key": [ + "MODIS", + "NDVI_smoothed_5KM" + ], + "aggregation": "average", + "invert": "True" + } + ], + "legend": [ + { + "value": 0, + "label": "0 - 0.1", + "color": "#672200" + }, + { + "value": 0.1, + "label": "0.1 - 0.2", + "color": "#a93800" + }, + { + "value": 0.2, + "label": "0.2 - 0.3", + "color": "#e59800" + }, + { + "value": 0.3, + "label": "0.3 - 0.4", + "color": "#ffe769" + }, + { + "value": 0.4, + "label": "0.4 - 0.5", + "color": "#f0f0f0" + }, + { + "value": 0.5, + "label": "0.5 - 0.6", + "color": "#f0f0f0" + }, + { + "value": 0.6, + "label": "0.6 - 0.7", + "color": "#a9c6d6" + }, + { + "value": 0.7, + "label": "0.7 - 0.8", + "color": "#019ac4" + }, + { + "value": 0.8, + "label": "0.8 - 0.9", + "color": "#014c73" + }, + { + "value": 0.9, + "label": "0.9 - 1", + "color": "#014c73" + } + ], + "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", + "aggregation": "pixel", + "aggregate_by": "mean", + "admin_code": "admin3Pcod", + "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", + "date_layer": "spi_1m", + "start_date": "2020-12-01", + "end_date": "2021-07-31", + "opacity": 0.7 + }, "cdi_v1_monthly": { "title": "Monthly Combined Drought Index (v1)", "type": "composite", diff --git a/frontend/src/config/jordan/prism.json b/frontend/src/config/jordan/prism.json index bbd678bb8..dd2a9d030 100644 --- a/frontend/src/config/jordan/prism.json +++ b/frontend/src/config/jordan/prism.json @@ -212,6 +212,7 @@ }, "drought": { "combined_drought_index": [ + "cdi_v1_aggregated", { "group_title": "Combined Drought Index v1:", "activate_all": false, diff --git a/frontend/src/config/types.ts b/frontend/src/config/types.ts index b029086c2..8d454ef90 100644 --- a/frontend/src/config/types.ts +++ b/frontend/src/config/types.ts @@ -502,6 +502,12 @@ export class CompositeLayerProps extends CommonLayerProps { @optional endDate?: string; + @optional + aggregateBy?: 'mean' | 'median' | 'max'; + @optional + aggregationBoundaryPath?: string; + @optional + adminCode?: number; } export class StaticRasterLayerProps extends CommonLayerProps { diff --git a/frontend/src/context/layers/composite_data.ts b/frontend/src/context/layers/composite_data.ts index 47dddea75..31c98f950 100644 --- a/frontend/src/context/layers/composite_data.ts +++ b/frontend/src/context/layers/composite_data.ts @@ -16,8 +16,14 @@ export interface CompositeLayerData extends FeatureCollection {} export const fetchCompositeLayerData: LazyLoader = () => - async (params: LayerDataParams, { dispatch }) => { - const { layer, date, availableDates } = params; + async ( + params: LayerDataParams< + CompositeLayerProps & { aggregationBoundariesPolygon?: string } + >, + { dispatch }, + ) => { + const { layer, date, availableDates, aggregationBoundariesPolygon } = + params; const referenceDate = date ? new Date(date) : new Date(); const providedSeasons = layer.validity?.seasons; @@ -55,7 +61,14 @@ export const fetchCompositeLayerData: LazyLoader = } = layer; const { boundingBox } = appConfig.map; - // docs: https://hip-service.ovio.org/docs#/default/run_q_multi_geojson_q_multi_geojson_post + const aggregationMaskParam = aggregationBoundariesPolygon + ? { aggregation_mask: aggregationBoundariesPolygon } + : {}; + + const aggregateByParam = layer.aggregateBy + ? { aggregate_by: layer.aggregateBy } + : {}; + const body = { begin: getFormattedDate(closestDateToStart, 'default'), end: getFormattedDate(closestDateToEnd, 'default'), @@ -73,6 +86,8 @@ export const fetchCompositeLayerData: LazyLoader = importance, invert: Boolean(invert), })), + ...aggregationMaskParam, + ...aggregateByParam, }; try { From 65fbbcec77f2ac0e0bf9764ba2b359ad82a7f6b7 Mon Sep 17 00:00:00 2001 From: Will Gislason <8203830+gislawill@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:18:01 -0500 Subject: [PATCH 2/7] Adding additional layers --- frontend/src/config/jordan/layers.json | 366 ++++++++++++++++++++++++- frontend/src/config/jordan/prism.json | 31 ++- 2 files changed, 383 insertions(+), 14 deletions(-) diff --git a/frontend/src/config/jordan/layers.json b/frontend/src/config/jordan/layers.json index 232ed7501..ca462b8fb 100644 --- a/frontend/src/config/jordan/layers.json +++ b/frontend/src/config/jordan/layers.json @@ -1367,7 +1367,106 @@ ], "legend_text": "Groundwater developed for irrigation (MCM) " }, - "cdi_v1_aggregated": { + "cdi_v1_monthly": { + "title": "Monthly Combined Drought Index (v1)", + "type": "composite", + "period": "monthly", + "base_url": "http://127.0.0.1:8000/q_multi_geojson", + "validity": { + "forward": 1, + "backward": 2, + "mode": "dekad" + }, + "input_layers": [ + { + "id": "spi_1m", + "importance": 0.3, + "key": [ + "CHIRPS", + "R1S_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "lst_anomaly", + "importance": 0.3, + "key": [ + "MODIS", + "MYD11C2_TDD_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "ndvi_dekad", + "importance": 0.4, + "key": [ + "MODIS", + "NDVI_smoothed_5KM" + ], + "aggregation": "average", + "invert": "True" + } + ], + "legend": [ + { + "value": 0, + "label": "0 - 0.1", + "color": "#672200" + }, + { + "value": 0.1, + "label": "0.1 - 0.2", + "color": "#a93800" + }, + { + "value": 0.2, + "label": "0.2 - 0.3", + "color": "#e59800" + }, + { + "value": 0.3, + "label": "0.3 - 0.4", + "color": "#ffe769" + }, + { + "value": 0.4, + "label": "0.4 - 0.5", + "color": "#f0f0f0" + }, + { + "value": 0.5, + "label": "0.5 - 0.6", + "color": "#f0f0f0" + }, + { + "value": 0.6, + "label": "0.6 - 0.7", + "color": "#a9c6d6" + }, + { + "value": 0.7, + "label": "0.7 - 0.8", + "color": "#019ac4" + }, + { + "value": 0.8, + "label": "0.8 - 0.9", + "color": "#014c73" + }, + { + "value": 0.9, + "label": "0.9 - 1", + "color": "#014c73" + } + ], + "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", + "aggregation": "pixel", + "date_layer": "spi_1m", + "start_date": "2020-12-01", + "end_date": "2021-07-31", + "opacity": 0.7 + }, + "cdi_v1_aggregated_monthly": { "title": "Monthly Combined Drought Index Aggregated (v1)", "type": "composite", "period": "monthly", @@ -1475,19 +1574,27 @@ "end_date": "2021-07-31", "opacity": 0.7 }, - "cdi_v1_monthly": { - "title": "Monthly Combined Drought Index (v1)", + "cdi_v1_seasonal": { + "title": "Seasonal Combined Drought Index (v1)", "type": "composite", - "period": "monthly", + "period": "seasonal", "base_url": "https://hip-service.ovio.org/q_multi_geojson", "validity": { - "forward": 1, - "backward": 2, - "mode": "dekad" + "mode": "season", + "seasons": [ + { + "start": "01-May", + "end": "31-October" + }, + { + "start": "01-November", + "end": "30-April" + } + ] }, "input_layers": [ { - "id": "spi_1m", + "id": "spi_3m", "importance": 0.5, "key": [ "CHIRPS", @@ -1569,16 +1676,16 @@ ], "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", - "date_layer": "spi_1m", + "date_layer": "spi_3m", "start_date": "2020-12-01", "end_date": "2021-07-31", "opacity": 0.7 }, - "cdi_v1_seasonal": { - "title": "Seasonal Combined Drought Index (v1)", + "cdi_v1_aggregated_seasonal": { + "title": "Seasonal Combined Drought Index Aggregated (v1)", "type": "composite", "period": "seasonal", - "base_url": "https://hip-service.ovio.org/q_multi_geojson", + "base_url": "http://127.0.0.1:8000/q_multi_aggregated", "validity": { "mode": "season", "seasons": [ @@ -1592,6 +1699,12 @@ } ] }, + "feature_info_props": { + "value": { + "type": "number", + "dataTitle": "Event name" + } + }, "input_layers": [ { "id": "spi_3m", @@ -1676,6 +1789,9 @@ ], "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", + "aggregate_by": "mean", + "admin_code": "admin3Pcod", + "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", "start_date": "2020-12-01", "end_date": "2021-07-31", @@ -1685,7 +1801,7 @@ "title": "Monthly Combined Drought Index (v2)", "type": "composite", "period": "monthly", - "base_url": "https://hip-service.ovio.org/q_multi_geojson", + "base_url": "http://127.0.0.1:8000/q_multi_geojson", "validity": { "forward": 1, "backward": 2, @@ -1780,6 +1896,114 @@ "end_date": "2021-07-31", "opacity": 0.7 }, + "cdi_v2_aggregated_monthly": { + "title": "Monthly Combined Drought Index Aggregated (v2)", + "type": "composite", + "period": "monthly", + "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "validity": { + "forward": 1, + "backward": 2, + "mode": "dekad" + }, + "feature_info_props": { + "value": { + "type": "number", + "dataTitle": "Event name" + } + }, + "input_layers": [ + { + "id": "spi_1m", + "importance": 0.3, + "key": [ + "CHIRPS", + "R1S_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "lst_anomaly", + "importance": 0.3, + "key": [ + "MODIS", + "MYD11C2_TDD_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "ndvi_dekad", + "importance": 0.4, + "key": [ + "MODIS", + "NDVI_smoothed_5KM" + ], + "aggregation": "average", + "invert": "True" + } + ], + "legend": [ + { + "value": 0, + "label": "0 - 0.1", + "color": "#672200" + }, + { + "value": 0.1, + "label": "0.1 - 0.2", + "color": "#a93800" + }, + { + "value": 0.2, + "label": "0.2 - 0.3", + "color": "#e59800" + }, + { + "value": 0.3, + "label": "0.3 - 0.4", + "color": "#ffe769" + }, + { + "value": 0.4, + "label": "0.4 - 0.5", + "color": "#f0f0f0" + }, + { + "value": 0.5, + "label": "0.5 - 0.6", + "color": "#f0f0f0" + }, + { + "value": 0.6, + "label": "0.6 - 0.7", + "color": "#a9c6d6" + }, + { + "value": 0.7, + "label": "0.7 - 0.8", + "color": "#019ac4" + }, + { + "value": 0.8, + "label": "0.8 - 0.9", + "color": "#014c73" + }, + { + "value": 0.9, + "label": "0.9 - 1", + "color": "#014c73" + } + ], + "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", + "aggregation": "pixel", + "aggregate_by": "mean", + "admin_code": "admin3Pcod", + "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", + "date_layer": "spi_1m", + "start_date": "2020-12-01", + "end_date": "2021-07-31", + "opacity": 0.7 + }, "cdi_v2_seasonal": { "title": "Seasonal Combined Drought Index (v2)", "type": "composite", @@ -1886,5 +2110,121 @@ "start_date": "2020-12-01", "end_date": "2021-07-31", "opacity": 0.7 + }, + "cdi_v2_aggregated_seasonal": { + "title": "Seasonal Combined Drought Index Aggregated (v2)", + "type": "composite", + "period": "seasonal", + "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "validity": { + "mode": "season", + "seasons": [ + { + "start": "01-May", + "end": "31-October" + }, + { + "start": "01-November", + "end": "30-April" + } + ] + }, + "feature_info_props": { + "value": { + "type": "number", + "dataTitle": "Event name" + } + }, + "input_layers": [ + { + "id": "spi_3m", + "importance": 0.3, + "key": [ + "CHIRPS", + "R1S_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "lst_anomaly", + "importance": 0.3, + "key": [ + "MODIS", + "MYD11C2_TDD_DEKAD" + ], + "aggregation": "last_dekad" + }, + { + "id": "ndvi_dekad", + "importance": 0.4, + "key": [ + "MODIS", + "NDVI_smoothed_5KM" + ], + "aggregation": "average", + "invert": "True" + } + ], + "legend": [ + { + "value": 0, + "label": "0 - 0.1", + "color": "#672200" + }, + { + "value": 0.1, + "label": "0.1 - 0.2", + "color": "#a93800" + }, + { + "value": 0.2, + "label": "0.2 - 0.3", + "color": "#e59800" + }, + { + "value": 0.3, + "label": "0.3 - 0.4", + "color": "#ffe769" + }, + { + "value": 0.4, + "label": "0.4 - 0.5", + "color": "#f0f0f0" + }, + { + "value": 0.5, + "label": "0.5 - 0.6", + "color": "#f0f0f0" + }, + { + "value": 0.6, + "label": "0.6 - 0.7", + "color": "#a9c6d6" + }, + { + "value": 0.7, + "label": "0.7 - 0.8", + "color": "#019ac4" + }, + { + "value": 0.8, + "label": "0.8 - 0.9", + "color": "#014c73" + }, + { + "value": 0.9, + "label": "0.9 - 1", + "color": "#014c73" + } + ], + "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", + "aggregation": "pixel", + "aggregate_by": "mean", + "admin_code": "admin3Pcod", + "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", + "date_layer": "spi_3m", + "start_date": "2020-12-01", + "end_date": "2021-07-31", + "opacity": 0.7 } } \ No newline at end of file diff --git a/frontend/src/config/jordan/prism.json b/frontend/src/config/jordan/prism.json index dd2a9d030..bf0d81c4e 100644 --- a/frontend/src/config/jordan/prism.json +++ b/frontend/src/config/jordan/prism.json @@ -212,7 +212,6 @@ }, "drought": { "combined_drought_index": [ - "cdi_v1_aggregated", { "group_title": "Combined Drought Index v1:", "activate_all": false, @@ -228,6 +227,21 @@ } ] }, + { + "group_title": "Combined Drought Index v1 Aggregated:", + "activate_all": false, + "layers": [ + { + "id": "cdi_v1_aggregated_monthly", + "label": "Monthly", + "main": true + }, + { + "id": "cdi_v1_aggregated_seasonal", + "label": "Seasonal" + } + ] + }, { "group_title": "Combined Drought Index v2:", "activate_all": false, @@ -242,6 +256,21 @@ "label": "Seasonal" } ] + }, + { + "group_title": "Combined Drought Index v2 Aggregated:", + "activate_all": false, + "layers": [ + { + "id": "cdi_v2_aggregated_monthly", + "label": "Monthly", + "main": true + }, + { + "id": "cdi_v2_aggregated_seasonal", + "label": "Seasonal" + } + ] } ] } From 97b35fa53b88b3b3f5ffb34f724c0522f8f5be2b Mon Sep 17 00:00:00 2001 From: Will Gislason <8203830+gislawill@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:21:25 -0500 Subject: [PATCH 3/7] updating the CDI reference dates --- frontend/src/config/jordan/layers.json | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/config/jordan/layers.json b/frontend/src/config/jordan/layers.json index ca462b8fb..57c64f017 100644 --- a/frontend/src/config/jordan/layers.json +++ b/frontend/src/config/jordan/layers.json @@ -1462,8 +1462,8 @@ "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", "date_layer": "spi_1m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v1_aggregated_monthly": { @@ -1570,8 +1570,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_1m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v1_seasonal": { @@ -1677,8 +1677,8 @@ "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", "date_layer": "spi_3m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v1_aggregated_seasonal": { @@ -1793,8 +1793,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v2_monthly": { @@ -1892,8 +1892,8 @@ "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", "aggregation": "pixel", "date_layer": "spi_1m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v2_aggregated_monthly": { @@ -2000,8 +2000,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_1m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v2_seasonal": { @@ -2107,8 +2107,8 @@ "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", "aggregation": "pixel", "date_layer": "spi_3m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 }, "cdi_v2_aggregated_seasonal": { @@ -2223,8 +2223,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", - "start_date": "2020-12-01", - "end_date": "2021-07-31", + "start_date": "2010-12-01", + "end_date": "2020-07-31", "opacity": 0.7 } } \ No newline at end of file From 6b8cd99cfe112db31ca05b2c8f097d2bbc1cfa11 Mon Sep 17 00:00:00 2001 From: Will Gislason <8203830+gislawill@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:38:59 -0500 Subject: [PATCH 4/7] Pointing to deployed server --- frontend/src/config/jordan/layers.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/config/jordan/layers.json b/frontend/src/config/jordan/layers.json index 57c64f017..701babe9e 100644 --- a/frontend/src/config/jordan/layers.json +++ b/frontend/src/config/jordan/layers.json @@ -1371,7 +1371,7 @@ "title": "Monthly Combined Drought Index (v1)", "type": "composite", "period": "monthly", - "base_url": "http://127.0.0.1:8000/q_multi_geojson", + "base_url": "https://hip-service.ovio.org/q_multi_geojson", "validity": { "forward": 1, "backward": 2, @@ -1470,7 +1470,7 @@ "title": "Monthly Combined Drought Index Aggregated (v1)", "type": "composite", "period": "monthly", - "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "base_url": "https://hip-service.ovio.org/q_multi_aggregated", "validity": { "forward": 1, "backward": 2, @@ -1685,7 +1685,7 @@ "title": "Seasonal Combined Drought Index Aggregated (v1)", "type": "composite", "period": "seasonal", - "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "base_url": "https://hip-service.ovio.org/q_multi_aggregated", "validity": { "mode": "season", "seasons": [ @@ -1801,7 +1801,7 @@ "title": "Monthly Combined Drought Index (v2)", "type": "composite", "period": "monthly", - "base_url": "http://127.0.0.1:8000/q_multi_geojson", + "base_url": "https://hip-service.ovio.org/q_multi_geojson", "validity": { "forward": 1, "backward": 2, @@ -1900,7 +1900,7 @@ "title": "Monthly Combined Drought Index Aggregated (v2)", "type": "composite", "period": "monthly", - "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "base_url": "https://hip-service.ovio.org/q_multi_aggregated", "validity": { "forward": 1, "backward": 2, @@ -2115,7 +2115,7 @@ "title": "Seasonal Combined Drought Index Aggregated (v2)", "type": "composite", "period": "seasonal", - "base_url": "http://127.0.0.1:8000/q_multi_aggregated", + "base_url": "https://hip-service.ovio.org/q_multi_aggregated", "validity": { "mode": "season", "seasons": [ From 2a74f62a7e02abf25af3a2228f41d6054904f31e Mon Sep 17 00:00:00 2001 From: Amit W Date: Sat, 2 Nov 2024 10:04:44 -0700 Subject: [PATCH 5/7] reorganize layers in prism.json --- frontend/src/config/jordan/prism.json | 50 ++++++++++++++------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/frontend/src/config/jordan/prism.json b/frontend/src/config/jordan/prism.json index bf0d81c4e..d73edf8aa 100644 --- a/frontend/src/config/jordan/prism.json +++ b/frontend/src/config/jordan/prism.json @@ -211,64 +211,66 @@ "vulnerability": ["vulnerability_scaled"] }, "drought": { - "combined_drought_index": [ + "combined_drought_index_v1": [ { - "group_title": "Combined Drought Index v1:", + "group_title": "Monthly", "activate_all": false, "layers": [ { - "id": "cdi_v1_monthly", - "label": "Monthly", + "id": "cdi_v1_aggregated_monthly", + "label": "Aggregated", "main": true }, { - "id": "cdi_v1_seasonal", - "label": "Seasonal" + "id": "cdi_v1_monthly", + "label": "Pixel level", + "main": true } ] }, { - "group_title": "Combined Drought Index v1 Aggregated:", + "group_title": "Seasonal", "activate_all": false, "layers": [ { - "id": "cdi_v1_aggregated_monthly", - "label": "Monthly", - "main": true + "id": "cdi_v1_aggregated_seasonal", + "label": "Aggregated" }, { - "id": "cdi_v1_aggregated_seasonal", - "label": "Seasonal" + "id": "cdi_v1_seasonal", + "label": "Pixel level" } ] - }, + } + ], + "combined_drought_index_v2": [ { - "group_title": "Combined Drought Index v2:", + "group_title": "Monthly", "activate_all": false, "layers": [ { - "id": "cdi_v2_monthly", - "label": "Monthly", + "id": "cdi_v2_aggregated_monthly", + "label": "Aggregated", "main": true }, { - "id": "cdi_v2_seasonal", - "label": "Seasonal" + "id": "cdi_v2_monthly", + "label": "Pixel level", + "main": true } ] }, { - "group_title": "Combined Drought Index v2 Aggregated:", + "group_title": "Seasonal", "activate_all": false, "layers": [ { - "id": "cdi_v2_aggregated_monthly", - "label": "Monthly", - "main": true + "id": "cdi_v2_aggregated_seasonal", + "label": "Aggregated" }, { - "id": "cdi_v2_aggregated_seasonal", - "label": "Seasonal" + "id": "cdi_v2_seasonal", + "label": "Pixel level" } ] } From ef4dae386c6be582638a90a9bb06ac8f4dd4065f Mon Sep 17 00:00:00 2001 From: Will Gislason <8203830+gislawill@users.noreply.github.com> Date: Sat, 2 Nov 2024 12:28:50 -0500 Subject: [PATCH 6/7] Updating reference period --- frontend/src/config/jordan/layers.json | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/config/jordan/layers.json b/frontend/src/config/jordan/layers.json index 701babe9e..7a81548e9 100644 --- a/frontend/src/config/jordan/layers.json +++ b/frontend/src/config/jordan/layers.json @@ -1462,8 +1462,8 @@ "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", "date_layer": "spi_1m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v1_aggregated_monthly": { @@ -1570,8 +1570,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_1m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v1_seasonal": { @@ -1677,8 +1677,8 @@ "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", "date_layer": "spi_3m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v1_aggregated_seasonal": { @@ -1793,8 +1793,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v2_monthly": { @@ -1892,8 +1892,8 @@ "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", "aggregation": "pixel", "date_layer": "spi_1m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v2_aggregated_monthly": { @@ -2000,8 +2000,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_1m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v2_seasonal": { @@ -2107,8 +2107,8 @@ "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", "aggregation": "pixel", "date_layer": "spi_3m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 }, "cdi_v2_aggregated_seasonal": { @@ -2223,8 +2223,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", - "start_date": "2010-12-01", - "end_date": "2020-07-31", + "start_date": "2003-01-01", + "end_date": "2013-12-31", "opacity": 0.7 } } \ No newline at end of file From 14339595af829359adc8f4e0352fde9db0aebd40 Mon Sep 17 00:00:00 2001 From: Will Gislason <8203830+gislawill@users.noreply.github.com> Date: Sat, 2 Nov 2024 13:11:06 -0500 Subject: [PATCH 7/7] Updating ref period --- frontend/src/config/jordan/layers.json | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/config/jordan/layers.json b/frontend/src/config/jordan/layers.json index 7a81548e9..2d03b9faa 100644 --- a/frontend/src/config/jordan/layers.json +++ b/frontend/src/config/jordan/layers.json @@ -1462,8 +1462,8 @@ "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", "date_layer": "spi_1m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v1_aggregated_monthly": { @@ -1570,8 +1570,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_1m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v1_seasonal": { @@ -1677,8 +1677,8 @@ "legend_text": "Composite Drought Index v1. SPI weight = 0.5; LST weight = 0.25; NDVI weight = 0.25", "aggregation": "pixel", "date_layer": "spi_3m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v1_aggregated_seasonal": { @@ -1793,8 +1793,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v2_monthly": { @@ -1892,8 +1892,8 @@ "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", "aggregation": "pixel", "date_layer": "spi_1m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v2_aggregated_monthly": { @@ -2000,8 +2000,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_1m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v2_seasonal": { @@ -2107,8 +2107,8 @@ "legend_text": "Composite Drought Index v2. SPI weight = 0.3; LST weight = 0.3; NDVI weight = 0.4", "aggregation": "pixel", "date_layer": "spi_3m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 }, "cdi_v2_aggregated_seasonal": { @@ -2223,8 +2223,8 @@ "admin_code": "admin3Pcod", "aggregation_boundary_path": "data/jordan/jor_admbnda_adm3_jdos_merged.json", "date_layer": "spi_3m", - "start_date": "2003-01-01", - "end_date": "2013-12-31", + "start_date": "2010-01-01", + "end_date": "2020-12-31", "opacity": 0.7 } } \ No newline at end of file