Interactive interface for browsing global, full-resolution satellite imagery
set specific available historical ranges for certain layers
Jason Kent561c5457058f
diff --git a/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Air_Mass.json b/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Air_Mass.jsonindex 9558282fb..51f93f7a2 100644--- a/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Air_Mass.json+++ b/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Air_Mass.json@@ -16,7 +16,9 @@"day","night"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band13_Clean_Infrared.json b/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band13_Clean_Infrared.jsonindex d057dc90a..35b133bbc 100644--- a/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band13_Clean_Infrared.json+++ b/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band13_Clean_Infrared.json@@ -19,7 +19,16 @@"day","night"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30,+ "historicalRanges": [+ {+ "startDate": "2019-09-01T10:00:00Z",+ "endDate": "2019-09-05T18:00:00Z",+ "dateInterval": "10"+ }+ ]+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band2_Red_Visible_1km.json b/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band2_Red_Visible_1km.jsonindex b1bf49628..3fe15c3c1 100644--- a/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band2_Red_Visible_1km.json+++ b/config/default/common/config/wv.json/layers/goes/GOES-East_ABI_Band2_Red_Visible_1km.json@@ -15,7 +15,16 @@"daynight": ["day"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30,+ "historicalRanges": [+ {+ "startDate": "2019-09-01T10:00:00Z",+ "endDate": "2019-09-05T18:00:00Z",+ "dateInterval": "10"+ }+ ]+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Air_Mass.json b/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Air_Mass.jsonindex e64e4a6e5..0d0d0933b 100644--- a/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Air_Mass.json+++ b/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Air_Mass.json@@ -16,7 +16,9 @@"day","night"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band13_Clean_Infrared.json b/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band13_Clean_Infrared.jsonindex 3ffc36842..36148551e 100644--- a/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band13_Clean_Infrared.json+++ b/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band13_Clean_Infrared.json@@ -19,7 +19,9 @@"day","night"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band2_Red_Visible_1km.json b/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band2_Red_Visible_1km.jsonindex 0220e6136..ed4ed4532 100644--- a/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band2_Red_Visible_1km.json+++ b/config/default/common/config/wv.json/layers/goes/GOES-West_ABI_Band2_Red_Visible_1km.json@@ -15,7 +15,9 @@"daynight": ["day"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Air_Mass.json b/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Air_Mass.jsonindex 18cbbf29a..11ffe9a6e 100644--- a/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Air_Mass.json+++ b/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Air_Mass.json@@ -16,7 +16,16 @@"day","night"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30,+ "historicalRanges": [+ {+ "startDate": "2020-01-03",+ "endDate": "2020-01-04",+ "dateInterval": "10"+ }+ ]+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band13_Clean_Infrared.json b/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band13_Clean_Infrared.jsonindex 786d6d994..192e96ae5 100644--- a/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band13_Clean_Infrared.json+++ b/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band13_Clean_Infrared.json@@ -19,7 +19,16 @@"day","night"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30,+ "historicalRanges": [+ {+ "startDate": "2020-01-03",+ "endDate": "2020-01-04",+ "dateInterval": "10"+ }+ ]+ }}}}\ No newline at end of filediff --git a/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band3_Red_Visible_1km.json b/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band3_Red_Visible_1km.jsonindex 3e8ebd72c..a6efb9584 100644--- a/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band3_Red_Visible_1km.json+++ b/config/default/common/config/wv.json/layers/himawari/Himawari_AHI_Band3_Red_Visible_1km.json@@ -15,7 +15,16 @@"daynight": ["day"],- "availableWindow": 30+ "availability": {+ "rollingWindow": 30,+ "historicalRanges": [+ {+ "startDate": "2020-01-03",+ "endDate": "2020-01-04",+ "dateInterval": "10"+ }+ ]+ }}}}\ No newline at end of filediff --git a/doc/configuration.md b/doc/configuration.mdindex 77ac442df..adc3764c2 100644--- a/doc/configuration.md+++ b/doc/configuration.md@@ -62,19 +62,19 @@ The minimum set of required properties are as follows:- **id**: The layer identifier used in the WMTS or WMS call- **title**: Title of the layer displayed to the end user. This is the first line displayed in the active layers list.- **subtitle**: Subtitle of the layer displayed to the end user. This is the second line displayed in the active layers list and usually includes platform, sensor, and/or attribution information.-- **group**: The group this layer is found in, either *baselayers* or *overlays*+- **group**: The group this layer is found in, either `baselayers` or `overlays`- **layergroup**: A reference to the layer group the layer belongs to (usually the folder name it's contained in; i.e. airs, modis, reference_orbits).The following properties are required if this information is not available via the GIBS WMTS GetCapabilities document:-- **type**: Tile service type, either *wmts*, *wms*, or *vector*.-- **format**: Image format type, either *image/png* or *image/jpeg*.-- **tileSize**: For WMS layers only, an array of pixel dimensions used to tile the requests. For example, *[512, 512]*-- **period**: Use *subdaily*, *daily*, *monthly*, or *yearly* for layers that have new content and no startDate defined in GetCapabilities. Changing the period will affect how often the layer is requested in the timeline. Omit this parameter to always have the layer shown on the timeline.+- **type**: Tile service type, either `wmts`, `wms`, or `vector`.+- **format**: Image format type, either `image/png` or `image/jpeg`.+- **tileSize**: For WMS layers only, an array of pixel dimensions used to tile the requests. For example, `[512, 512]`+- **period**: Use `subdaily`, `daily`, `monthly`, or `yearly` for layers that have new content and no startDate defined in GetCapabilities. Changing the period will affect how often the layer is requested in the timeline. Omit this parameter to always have the layer shown on the timeline.- **startDate**: The first day that data is available, represented in YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format.- **endDate**: The last day that data is available, represented in YYYY-MM-DD or YYYY-MM-DDThh:mm:ssZ format.-- **inactive**: Use *true* if the layer is no longer being produced.-- **futureLayer**: Use *true* if the layer has an end date after the current date.+- **inactive**: Use `true` if the layer is no longer being produced.+- **futureLayer**: Use `true` if the layer has an end date after the current date.- **futureTime**: Use `[number][type="D,M,Y"]` (i.e. "3D") with the `futurelayer` parameter to denote a layer that has a dynamic, future end date. The `[number]` parameter represents the dateInterval, `[type]` can be equal to `"D"`, `"M"`, or `"Y"` to represent day, month or year interval.A *projections* object must exist which contains an object for each projection supported by this layer. Projection information is keyed by the projection identifier (found in `config/wv.json/projections`). Example:@@ -104,8 +104,8 @@ The `config/wv.json/layerOrder.json` file must be updated to include the new lay### Optional Properties- **tags**: Additional text used for matching this layer when searching in the add layers tab. This allows Aerosol Optical Depth layers to match when "aod" is typed in-- **noTransition**: For WMTS layers only, if set to *true*, the map will not display lower-resolution tiles while loading.-- **transition**: For WMS layers only, if set to *true*, the map will display lower-resolution tiles while loading.+- **noTransition**: For WMTS layers only, if set to `true`, the map will not display lower-resolution tiles while loading.+- **transition**: For WMS layers only, if set to `true`, the map will display lower-resolution tiles while loading.- **product**: Identifier of the product to use when searching the Common Metadata Repository (CMR) to download data. Can also be a list of identifiers to map the layer to multiple CMR products. See the [Data Download documentation](data_download.md) for more information.- **style**: For WMTS layers only, this sets the WMTS `style` parameter accordingly; defaults to `default` if not set.- **matrixIds**: For WMTS layers only, this is an array of labels used for the `TileMatrix` parameter at each zoom level; defaults to `[0, 1, 2, ...]` if not set.@@ -114,9 +114,14 @@ The `config/wv.json/layerOrder.json` file must be updated to include the new lay- **description**: Point to a markdown file within the metadata folder to provide a layer description.- **wrapX**: Wrap the layer across the anti-meridian.- **wrapadjacentdays**: Wrap the layer across the anti-meridian but select the previous day when greater than 180 and the next day when less than -180.-- **availableWindow**: Number of days, counting backwards from app load time, that a layer has avilable coverage. Setting this will cause a layer's `startDate` property to be dynamically set at app load time. Primarily for our geostationary layers which only have historical coverage going back ~30 days.+- **availability**: Used to denote datetime availability info that cannot be gleaned from the capabilities document. Primarily for our geostationary layers which only have historical coverage going back ~30 days. Represented as an object with the following properties:+ - **rollingWindow**: Number of days, counting backwards from app load time, that a layer has avilable coverage. Setting this will cause a layer's `startDate` property to be dynamically set at app load time.+ - **historicalRanges**: An array of date range objects denoting specific time periods in the past when imagery is available. Each range object should have the following properties:+ - startDate - `YYYY-MM-DDTHH:MM:SSZ`+ - endDate - `YYYY-MM-DDTHH:MM:SSZ`+ - dateInterval - Number of days (or minutes for subdaily layers)-To display a color palette legend, a *palette* object should exist with the following properties:+To display a color palette legend, a `palette` object should exist with the following properties:- **id**: Identifier of the palette. This should match the name of the colormap file without the extension.- **recommended**: Array of custom palette identifiers that are recommended for use with this layer (see `config/palettes-custom.json`). Example, *["orange_1", "red_1"]*@@ -147,7 +152,7 @@ To display a color palette legend, a *palette* object should exist with the foll"layergroup": ["airs"],- "daynight": "day",+ "daynight": [ "day" ],"track": "descending","palette": {"id": "AIRS_RH400_A"diff --git a/web/js/main.js b/web/js/main.jsindex 7e2f1beb0..8eae53bab 100644--- a/web/js/main.js+++ b/web/js/main.js@@ -20,7 +20,6 @@ import {} from 'redux-location-state';import { createBrowserHistory } from 'history';import { uniqBy, get as lodashGet } from 'lodash';-import moment from 'moment';import getMiddleware from './combine-middleware';import { mapLocationToState, getParamObject } from './location';import { stateToParams } from './redux-location-state-customs';@@ -36,6 +35,7 @@ import { preloadPalettes, hasCustomTypePalette } from './modules/palettes/util';import {validate as layerValidate,layersParse12,+ adjustStartDates,} from './modules/layers/util';import polyfill from './polyfill';import { debugConfig } from './debug';@@ -59,32 +59,6 @@ let parameters = util.fromQueryString(window.location.search);let { elapsed } = util;const errors = [];-/**- * For layers that have an 'availableWindow' property defined, adjust the- * start date backwards from now by that many days.- *- * Applies to layer.startDate and layer.dateRanges[0].startDate- * @param {*} layers- */-function adjustStartDates(layers) {- const adjustDate = (days) => moment.utc()- .subtract(days, 'days')- .startOf('day')- .format('YYYY-MM-DD');-- const applyDateAdjustment = (layer) => {- const { availableWindow, dateRanges } = layer;- if (!availableWindow) return;- layer.startDate = adjustDate(availableWindow);- if (dateRanges.length) {- const [firstDateRange] = dateRanges;- firstDateRange.startDate = adjustDate(availableWindow);- }- };-- return Object.values(layers).forEach(applyDateAdjustment);-}-/**** @param {*} configdiff --git a/web/js/modules/layers/util.js b/web/js/modules/layers/util.jsindex 513ff5f15..3bf2bdad7 100644--- a/web/js/modules/layers/util.js+++ b/web/js/modules/layers/util.js@@ -10,7 +10,7 @@ import {startCase as lodashStartCase,isArray,} from 'lodash';-+import moment from 'moment';import googleTagManager from 'googleTagManager';import update from 'immutability-helper';import { addLayer, resetLayers } from './selectors';@@ -18,7 +18,6 @@ import { getPaletteAttributeArray } from '../palettes/util';import { getVectorStyleAttributeArray } from '../vector-styles/util';import util from '../../util/util';-export function getOrbitTrackTitle(def) {const { track } = def;const daynightValue = lodashGet(def, 'daynight[0]');@@ -1251,3 +1250,41 @@ export const hasNonClickableVectorLayer = (activeLayers, mapRes, projId) => {}return isNonClickableVectorLayer;};++/**+ * For geostationary layers that have 'availability' properties defined+ * adjust the start date and date ranges as necessary+ *+ * Applies to layer.startDate and layer.dateRanges[0].startDate+ * @param {*} layers+ */+export function adjustStartDates(layers) {+ const adjustDate = (days) => moment.utc()+ .subtract(days, 'days')+ .startOf('day')+ .format('YYYY-MM-DD');++ const applyDateAdjustment = (layer) => {+ const { availability, dateRanges } = layer;+ if (!availability) {+ return;+ }+ const { rollingWindow, historicalRanges } = availability;++ if (dateRanges.length) {+ const [firstDateRange] = dateRanges;+ firstDateRange.startDate = adjustDate(rollingWindow);+ }++ if (historicalRanges && historicalRanges.length) {+ layer.startDate = historicalRanges[0].startDate;+ historicalRanges.reverse().forEach((range) => {+ layer.dateRanges.unshift(range);+ });+ } else {+ layer.startDate = adjustDate(rollingWindow);+ }+ };++ return Object.values(layers).forEach(applyDateAdjustment);+}