Interactive interface for browsing global, full-resolution satellite imagery
add modular loaders to data download code
Benjamin King129035edaa7b
diff --git a/web/js/data/wv.data.cmr.js b/web/js/data/cmr.jssimilarity index 83%rename from web/js/data/wv.data.cmr.jsrename to web/js/data/cmr.jsindex ec8e7d23e..552bc4a6f 100644--- a/web/js/data/wv.data.cmr.js+++ b/web/js/data/cmr.js@@ -1,15 +1,17 @@-/**- * @module wv.data- */-var wv = wv || {};-wv.data = wv.data || {};-wv.data.cmr = wv.data.cmr || {};--wv.data.cmr.client = wv.data.cmr.client || function (spec) {+import $ from 'jquery';+import util from '../util/util';+import OlPolygon from 'ol/geom/polygon';++export const REL_DATA = 'http://esipfed.org/ns/fedsearch/1.1/data#';+export const REL_METADATA = 'http://esipfed.org/ns/fedsearch/1.1/metadata#';+export const REL_BROWSE = 'http://esipfed.org/ns/fedsearch/1.1/browse#';+export const DATA_EXTS = ['hdf', 'he5', 'h5', 'hdf5', 'nc', 'bz2'];++export function dataCmrClient(spec) {// Abort query after 45 secondsvar QUERY_TIMEOUT = spec.timeout || 45 * 1000;-- var ns = wv.data.cmr.client;+ var self = {};+ var ns = self;var ajaxOptions = {url: 'https://cmr.earthdata.nasa.gov/search/',@@ -18,10 +20,8 @@ wv.data.cmr.client = wv.data.cmr.client || function (spec) {timeout: QUERY_TIMEOUT};- var self = {};-var init = function () {- ns.ajax = wv.util.ajaxCache();+ ns.ajax = util.ajaxCache();};self.submit = function (parameters) {@@ -52,7 +52,7 @@ wv.data.cmr.client = wv.data.cmr.client || function (spec) {var deferred = $.Deferred();var metrics = 'ev=data-download&' + $.param(queryParameters.data, true);- wv.util.metrics(metrics);+ util.metrics(metrics);ns.ajax.submit(queryParameters).done(function (data) {deferred.resolve(data.feed.entry);@@ -67,7 +67,7 @@ wv.data.cmr.client = wv.data.cmr.client || function (spec) {return self;};-wv.data.cmr.geometry = function (result) {+export function dataCmrGeometry(result) {var self = {};self.polygons = [];@@ -82,7 +82,7 @@ wv.data.cmr.geometry = function (result) {};self.toOpenLayers = function () {- olPolygons = [];+ var olPolygons = [];$.each(self.polygons, function (index, polygon) {var olRings = [];$.each(polygon, function (index, ring) {@@ -93,7 +93,7 @@ wv.data.cmr.geometry = function (result) {});olRings.push(olPoints);});- olPolygons.push(new ol.geom.Polygon(olRings));+ olPolygons.push(new OlPolygon(olRings));});return olPolygons[0];};@@ -155,7 +155,7 @@ wv.data.cmr.geometry = function (result) {return self;};-wv.data.cmr.mockClient = function (suffix) {+export function dataCmrMockClient(suffix, models) {var endpoint;var results;@@ -177,7 +177,7 @@ wv.data.cmr.mockClient = function (suffix) {results = adjustResults(parameters, data);deferred.resolve(results.feed.entry);} catch (error) {- wv.util.error(error);+ util.error(error);}}).fail(function (jqXHR, textStatus, errorThrown) {@@ -190,17 +190,17 @@ wv.data.cmr.mockClient = function (suffix) {};var adjustResults = function (parameters, data) {- var day = wvx.models.date.selected;+ var day = models.date.selected;// Mock data was retrieved for Aug 6, 2013var resultsDay = new Date(Date.UTC(2013, 7, 6));var diffDays = (day - resultsDay) / (1000 * 60 * 60 * 24);$.each(data.feed.entry, function (index, entry) {- var timeStart = wv.util.parseTimestampUTC(entry.time_start);+ var timeStart = util.parseTimestampUTC(entry.time_start);timeStart.setUTCDate(timeStart.getUTCDate() + diffDays);entry.time_start = timeStart.toISOString();- var timeEnd = wv.util.parseTimestampUTC(entry.time_end);+ var timeEnd = util.parseTimestampUTC(entry.time_end);timeEnd.setUTCDate(timeEnd.getUTCDate() + diffDays);entry.time_end = timeEnd.toISOString();});@@ -213,13 +213,8 @@ wv.data.cmr.mockClient = function (suffix) {return self;};-wv.data.cmr.REL_DATA = 'http://esipfed.org/ns/fedsearch/1.1/data#';-wv.data.cmr.REL_METADATA = 'http://esipfed.org/ns/fedsearch/1.1/metadata#';-wv.data.cmr.REL_BROWSE = 'http://esipfed.org/ns/fedsearch/1.1/browse#';-wv.data.cmr.DATA_EXTS = ['hdf', 'he5', 'h5', 'hdf5', 'nc', 'bz2'];--wv.data.cmr.roundTime = function (timeString) {- var time = wv.util.parseTimestampUTC(timeString);+export function dataCmrRoundTime(timeString) {+ var time = util.parseTimestampUTC(timeString);if (time.getUTCMilliseconds() >= 500) {time.setUTCSeconds(time.getUTCSeconds() + 1);}diff --git a/web/js/data/data.js b/web/js/data/data.jsnew file mode 100644index 000000000..3a8b6f0b9--- /dev/null+++ b/web/js/data/data.js@@ -0,0 +1,15 @@+export function dataParser(state, errors, config) {+ if (state.dataDownload) {+ state.download = state.dataDownload;+ delete state.dataDownload;+ }+ var productId = state.download;+ if (productId) {+ if (!config.products[productId]) {+ delete state.download;+ errors.push({+ message: 'No such product: ' + productId+ });+ }+ }+};diff --git a/web/js/data/wv.data.handler.js b/web/js/data/handler.jssimilarity index 56%rename from web/js/data/wv.data.handler.jsrename to web/js/data/handler.jsindex 5a1646ccf..e11244ca3 100644--- a/web/js/data/wv.data.handler.js+++ b/web/js/data/handler.js@@ -1,24 +1,53 @@-/**- * @module wv.data- */-var wv = wv || {};-wv.data = wv.data || {};--wv.data.handler = wv.data.handler || {};--wv.data.handler.getByName = function (name) {+import $ from 'jquery';+import loEach from 'lodash/each';++import {dataCmrMockClient, dataCmrClient} from './cmr';++import util from '../util/util';+import brand from '../brand';+import {CRS_WGS_84_QUERY_EXTENT, CRS_WGS_84} from '../map/map';+import {+ dataResultsChain,+ dataResultsTagProduct,+ dataResultsTagNRT,+ dataResultsTagURS,+ dataResultsTagList,+ dataResultsCollectPreferred,+ dataResultsTagVersion,+ dataResultsPreferredFilter,+ dataResultsCollectVersions,+ dataResultsVersionFilter,+ dataResultsDateTimeLabel,+ dataResultsGeometryFromCMR,+ dataResultsAntiMeridianMulti,+ dataResultsDensify,+ dataResultsTransform,+ dataResultsExtentFilter,+ dataResultsTimeLabel,+ dataResultsConnectSwaths,+ dataResultsProductLabel,+ dataResultsTimeFilter,+ dataResultsVersionFilterExact,+ dataResultsModisGridIndex,+ dataResultsGeometryFromMODISGrid,+ dataResultsModisGridLabel,+ dataResultsOrbitFilter,+ dataResultsDividePolygon+} from './results';++export function dataHandlerGetByName(name) {var map = {- 'AquaSwathMultiDay': wv.data.handler.aquaSwathMultiDay,- 'CollectionList': wv.data.handler.collectionList,- 'CollectionMix': wv.data.handler.collectionMix,- 'List': wv.data.handler.list,- 'DailyGranuleList': wv.data.handler.dailyGranuleList,- 'DailyAMSRE': wv.data.handler.dailyAMSRE,- 'MODISGrid': wv.data.handler.modisGrid,- 'MODISMix': wv.data.handler.modisMix,- 'MODISSwath': wv.data.handler.modisSwath,- 'TerraSwathMultiDay': wv.data.handler.terraSwathMultiDay,- 'HalfOrbit': wv.data.handler.halfOrbit+ 'AquaSwathMultiDay': dataHandlerAquaSwathMultiDay,+ 'CollectionList': dataHandlerCollectionList,+ 'CollectionMix': dataHandlerCollectionMix,+ 'List': dataHandlerList,+ 'DailyGranuleList': dataHandlerDailyGranuleList,+ 'DailyAMSRE': dataHandlerDailyAMSRE,+ 'MODISGrid': dataHandlerModisGrid,+ 'MODISMix': dataHandlerModisMix,+ 'MODISSwath': dataHandlerModisSwath,+ 'TerraSwathMultiDay': dataHandlerTerraSwathMultiDay,+ 'HalfOrbit': dataHandlerHalfOrbit};var handler = map[name];if (!handler) {@@ -27,21 +56,21 @@ wv.data.handler.getByName = function (name) {return handler;};-wv.data.handler.base = function (config, model) {+export function dataHandlerBase(config, model) {var self = {};- self.events = wv.util.events();+ self.events = util.events();self.cmr = null;self.ajax = null;var init = function () {- var ns = wv.data.handler.base;+ var ns = self;if (!ns.cmr) {if (config.parameters.mockCMR) {- ns.cmr = wv.data.cmr.mockClient(+ ns.cmr = dataCmrMockClient(config.parameters.mockCMR);} else {- ns.cmr = wv.data.cmr.client({+ ns.cmr = dataCmrClient({timeout: config.parameters.timeoutCMR});}@@ -49,12 +78,12 @@ wv.data.handler.base = function (config, model) {self.cmr = ns.cmr;if (!ns.ajax) {- ns.ajax = wv.util.ajaxCache();+ ns.ajax = util.ajaxCache();}self.ajax = ns.ajax;self.extents = {};- $.each(config.projections, function (key, projection) {+ loEach(config.projections, function (key, projection) {self.extents[projection.crs] = projection.maxExtent;});};@@ -96,15 +125,15 @@ wv.data.handler.base = function (config, model) {return self;};-wv.data.handler.modisSwathMultiDay = function (config, model, spec) {+export function dataHandlerModisSwathMultiDay(config, model, spec) {var startTimeDelta = spec.startTimeDelta || 0;var endTimeDelta = spec.endTimeDelta || 0;- var self = wv.data.handler.base(config, model);+ var self = dataHandlerBase(config, model);var init = function () {- self.extents[wv.map.CRS_WGS_84] =- wv.map.CRS_WGS_84_QUERY_EXTENT;+ self.extents[CRS_WGS_84] =+ CRS_WGS_84_QUERY_EXTENT;};self._submit = function (queryData) {@@ -123,33 +152,30 @@ wv.data.handler.modisSwathMultiDay = function (config, model, spec) {meta: {},granules: data};- if (model.crs === wv.map.CRS_WGS_84) {- results.meta.queryMask = wv.map.CRS_WGS_84_QUERY_MASK;- }- var ns = wv.data.results;+ // var ns = dataResults;var productConfig = config.products[model.selectedProduct];- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.tagProduct(model.selectedProduct),- ns.tagNRT(productConfig.nrt),- ns.tagURS(productConfig.urs),- ns.collectPreferred(model.prefer),- ns.preferredFilter(model.prefer),- ns.tagVersion(),- ns.collectVersions(),- ns.versionFilter(),- ns.geometryFromCMR(),- ns.transform(model.crs),- ns.extentFilter(model.crs, self.extents[model.crs]),- ns.timeFilter({+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagNRT(productConfig.nrt),+ dataResultsTagURS(productConfig.urs),+ dataResultsCollectPreferred(model.prefer),+ dataResultsPreferredFilter(model.prefer),+ dataResultsTagVersion(),+ dataResultsCollectVersions(),+ dataResultsVersionFilter(),+ dataResultsGeometryFromCMR(),+ dataResultsTransform(model.crs),+ dataResultsExtentFilter(model.crs, self.extents[model.crs]),+ dataResultsTimeFilter({time: model.time,eastZone: spec.eastZone,westZone: spec.westZone,maxDistance: spec.maxDistance}),- ns.timeLabel(model.time),- ns.connectSwaths(model.crs)+ dataResultsTimeLabel(model.time),+ dataResultsConnectSwaths(model.crs)];return chain.process(results);};@@ -158,7 +184,7 @@ wv.data.handler.modisSwathMultiDay = function (config, model, spec) {return self;};-wv.data.handler.aquaSwathMultiDay = function (config, model) {+export function dataHandlerAquaSwathMultiDay(config, model) {var spec = {startTimeDelta: -180,endTimeDelta: 180,@@ -167,11 +193,11 @@ wv.data.handler.aquaSwathMultiDay = function (config, model) {westZone: 1380};- var self = wv.data.handler.modisSwathMultiDay(config, model, spec);+ var self = dataHandlerModisSwathMultiDay(config, model, spec);return $.extend(true, self, spec);};-wv.data.handler.terraSwathMultiDay = function (config, model) {+export function dataHandlerTerraSwathMultiDay(config, model) {var spec = {startTimeDelta: -180,endTimeDelta: 180,@@ -180,12 +206,12 @@ wv.data.handler.terraSwathMultiDay = function (config, model) {westZone: 1260};- var self = wv.data.handler.modisSwathMultiDay(config, model, spec);+ var self = dataHandlerModisSwathMultiDay(config, model, spec);return $.extend(true, self, spec);};-wv.data.handler.collectionList = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerCollectionList(config, model, spec) {+ var self = dataHandlerBase(config, model);self._submit = function (queryData) {var queryOptions = {@@ -202,17 +228,16 @@ wv.data.handler.collectionList = function (config, model, spec) {granules: data};- var ns = wv.data.results;var productConfig = config.products[model.selectedProduct];- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.tagList(),- ns.tagProduct(model.selectedProduct),- ns.tagURS(productConfig.urs),- ns.tagVersion(),- ns.collectVersions(),- ns.versionFilter(),- ns.productLabel(config.products[model.selectedProduct].name)+ dataResultsTagList(),+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagURS(productConfig.urs),+ dataResultsTagVersion(),+ dataResultsCollectVersions(),+ dataResultsVersionFilter(),+ dataResultsProductLabel(config.products[model.selectedProduct].name)];return chain.process(results);};@@ -220,8 +245,8 @@ wv.data.handler.collectionList = function (config, model, spec) {return self;};-wv.data.handler.collectionMix = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerCollectionMix(config, model, spec) {+ var self = dataHandlerBase(config, model);var nrtHandler;var scienceHandler;@@ -230,12 +255,12 @@ wv.data.handler.collectionMix = function (config, model, spec) {var nrtHandlerName = productConfig.nrt.handler;var nrtHandlerFactory =- wv.data.handler.getByName(nrtHandlerName);+ dataHandlerGetByName(nrtHandlerName);nrtHandler = nrtHandlerFactory(config, model, spec);var scienceHandlerName = productConfig.science.handler;var scienceHandlerFactory =- wv.data.handler.getByName(scienceHandlerName);+ dataHandlerGetByName(scienceHandlerName);scienceHandler = scienceHandlerFactory(config, model, spec);};@@ -256,7 +281,7 @@ wv.data.handler.collectionMix = function (config, model, spec) {};var science = self.cmr.submit(scienceQueryOptions);- return wv.util.ajaxJoin([+ return util.ajaxJoin([{item: 'nrt',promise: nrt@@ -287,8 +312,8 @@ wv.data.handler.collectionMix = function (config, model, spec) {return self;};-wv.data.handler.list = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerList(config, model, spec) {+ var self = dataHandlerBase(config, model);self._submit = function (queryData) {var queryOptions = {@@ -307,20 +332,19 @@ wv.data.handler.list = function (config, model, spec) {granules: data};- var ns = wv.data.results;var productConfig = config.products[model.selectedProduct];- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.tagList(),- ns.tagProduct(model.selectedProduct),- ns.tagNRT(productConfig.nrt),- ns.tagURS(productConfig.urs),- ns.collectPreferred(model.prefer),- ns.preferredFilter(model.prefer),- ns.tagVersion(),- ns.collectVersions(),- ns.versionFilter(),- ns.dateTimeLabel(model.time)+ dataResultsTagList(),+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagNRT(productConfig.nrt),+ dataResultsTagURS(productConfig.urs),+ dataResultsCollectPreferred(model.prefer),+ dataResultsPreferredFilter(model.prefer),+ dataResultsTagVersion(),+ dataResultsCollectVersions(),+ dataResultsVersionFilter(),+ dataResultsDateTimeLabel(model.time)];return chain.process(results);};@@ -328,8 +352,8 @@ wv.data.handler.list = function (config, model, spec) {return self;};-wv.data.handler.dailyGranuleList = function (config, model, spec) {- var self = wv.data.handler.list(config, model, spec);+export function dataHandlerDailyGranuleList(config, model, spec) {+ var self = dataHandlerList(config, model, spec);self._submit = function (queryData) {var queryOptions = {@@ -345,8 +369,8 @@ wv.data.handler.dailyGranuleList = function (config, model, spec) {return self;};-wv.data.handler.dailyAMSRE = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerDailyAMSRE(config, model, spec) {+ var self = dataHandlerBase(config, model);self._submit = function (queryData) {var queryOptions = {@@ -365,16 +389,15 @@ wv.data.handler.dailyAMSRE = function (config, model, spec) {granules: data};- var ns = wv.data.results;var productConfig = config.products[model.selectedProduct];- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.tagList(),- ns.tagProduct(model.selectedProduct),- ns.tagURS(productConfig.urs),- ns.tagVersion(),- ns.versionFilterExact(productConfig.version),- ns.dateTimeLabel(model.time)+ dataResultsTagList(),+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagURS(productConfig.urs),+ dataResultsTagVersion(),+ dataResultsVersionFilterExact(productConfig.version),+ dataResultsDateTimeLabel(model.time)];return chain.process(results);};@@ -382,8 +405,8 @@ wv.data.handler.dailyAMSRE = function (config, model, spec) {return self;};-wv.data.handler.modisGrid = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerModisGrid(config, model, spec) {+ var self = dataHandlerBase(config, model);self._submit = function () {var crs = model.crs.replace(/:/, '_');@@ -397,12 +420,11 @@ wv.data.handler.modisGrid = function (config, model, spec) {var granules = self.cmr.submit(queryOptions);var grid = self.ajax.submit({- url: 'data/MODIS_Grid.' + crs + '.json?v=' + wv.brand.BUILD_NONCE,+ url: 'data/MODIS_Grid.' + crs + '.json?v=' + brand.BUILD_NONCE,dataType: 'json'});- var promise = $.Deferred();- return wv.util.ajaxJoin([+ return util.ajaxJoin([{item: 'granules',promise: granules@@ -423,18 +445,17 @@ wv.data.handler.modisGrid = function (config, model, spec) {granules: data.granules};- var ns = wv.data.results;- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.tagProduct(model.selectedProduct),- ns.tagVersion(),- ns.tagURS(productConfig.urs),- ns.collectVersions(),- ns.versionFilter(),- ns.modisGridIndex(),- ns.geometryFromMODISGrid(model.crs),- ns.extentFilter(model.crs, self.extents[model.crs]),- ns.modisGridLabel()+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagVersion(),+ dataResultsTagURS(productConfig.urs),+ dataResultsCollectVersions(),+ dataResultsVersionFilter(),+ dataResultsModisGridIndex(),+ dataResultsGeometryFromMODISGrid(model.crs),+ dataResultsExtentFilter(model.crs, self.extents[model.crs]),+ dataResultsModisGridLabel()];return chain.process(results);};@@ -442,8 +463,8 @@ wv.data.handler.modisGrid = function (config, model, spec) {return self;};-wv.data.handler.modisMix = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerModisMix(config, model, spec) {+ var self = dataHandlerBase(config, model);var nrtHandler;var scienceHandler;@@ -452,12 +473,12 @@ wv.data.handler.modisMix = function (config, model, spec) {var nrtHandlerName = productConfig.nrt.handler;var nrtHandlerFactory =- wv.data.handler.getByName(nrtHandlerName);+ dataHandlerGetByName(nrtHandlerName);nrtHandler = nrtHandlerFactory(config, model, spec);var scienceHandlerName = productConfig.science.handler;var scienceHandlerFactory =- wv.data.handler.getByName(scienceHandlerName);+ dataHandlerGetByName(scienceHandlerName);scienceHandler = scienceHandlerFactory(config, model, spec);};@@ -479,11 +500,11 @@ wv.data.handler.modisMix = function (config, model, spec) {var science = self.cmr.submit(scienceQueryOptions);var grid = self.ajax.submit({- url: 'data/MODIS_Grid.' + crs + '.json?v=' + wv.brand.BUILD_NONCE,+ url: 'data/MODIS_Grid.' + crs + '.json?v=' + brand.BUILD_NONCE,dataType: 'json'});- return wv.util.ajaxJoin([+ return util.ajaxJoin([{item: 'nrt',promise: nrt@@ -521,13 +542,13 @@ wv.data.handler.modisMix = function (config, model, spec) {return self;};-wv.data.handler.modisSwath = function (config, model, spec) {+export function dataHandlerModisSwath(config, model, spec) {var MAX_DISTANCE = 270;- var self = wv.data.handler.base(config, model);+ var self = dataHandlerBase(config, model);var init = function () {- self.extents[wv.map.CRS_WGS_84] =- wv.map.CRS_WGS_84_QUERY_EXTENT;+ self.extents[CRS_WGS_84] =+ CRS_WGS_84_QUERY_EXTENT;};self._submit = function (queryData) {@@ -544,29 +565,25 @@ wv.data.handler.modisSwath = function (config, model, spec) {meta: {},granules: data};- if (model.crs === wv.map.CRS_WGS_84) {- results.meta.queryMask = wv.map.CRS_WGS_84_QUERY_MASK;- }- var ns = wv.data.results;var productConfig = config.products[model.selectedProduct];- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.tagProduct(model.selectedProduct),- ns.tagNRT(productConfig.nrt),- ns.tagURS(productConfig.urs),- ns.collectPreferred(model.prefer),- ns.preferredFilter(model.prefer),- ns.tagVersion(),- ns.collectVersions(),- ns.versionFilter(),- ns.geometryFromCMR(),- ns.antiMeridianMulti(MAX_DISTANCE),- ns.densify(),- ns.transform(model.crs),- ns.extentFilter(model.crs, self.extents[model.crs]),- ns.timeLabel(model.time),- ns.connectSwaths(model.crs)+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagNRT(productConfig.nrt),+ dataResultsTagURS(productConfig.urs),+ dataResultsCollectPreferred(model.prefer),+ dataResultsPreferredFilter(model.prefer),+ dataResultsTagVersion(),+ dataResultsCollectVersions(),+ dataResultsVersionFilter(),+ dataResultsGeometryFromCMR(),+ dataResultsAntiMeridianMulti(MAX_DISTANCE),+ dataResultsDensify(),+ dataResultsTransform(model.crs),+ dataResultsExtentFilter(model.crs, self.extents[model.crs]),+ dataResultsTimeLabel(model.time),+ dataResultsConnectSwaths(model.crs)];return chain.process(results);};@@ -575,12 +592,12 @@ wv.data.handler.modisSwath = function (config, model, spec) {return self;};-wv.data.handler.halfOrbit = function (config, model, spec) {- var self = wv.data.handler.base(config, model);+export function dataHandlerHalfOrbit(config, model, spec) {+ var self = dataHandlerBase(config, model);var init = function () {- self.extents[wv.map.CRS_WGS_84] =- wv.map.CRS_WGS_84_QUERY_EXTENT;+ self.extents[CRS_WGS_84] =+ CRS_WGS_84_QUERY_EXTENT;};self._submit = function (queryData) {@@ -597,28 +614,24 @@ wv.data.handler.halfOrbit = function (config, model, spec) {meta: {},granules: data};- if (model.crs === wv.map.CRS_WGS_84) {- results.meta.queryMask = wv.map.CRS_WGS_84_QUERY_MASK;- }- var ns = wv.data.results;var productConfig = config.products[model.selectedProduct];- var chain = ns.chain();+ var chain = dataResultsChain();chain.processes = [- ns.orbitFilter(productConfig.orbit),- ns.tagProduct(model.selectedProduct),- ns.tagNRT(productConfig.nrt),- ns.tagURS(productConfig.urs),- ns.collectPreferred(model.prefer),- ns.preferredFilter(model.prefer),- ns.tagVersion(),- ns.collectVersions(),- ns.versionFilter(),- ns.geometryFromCMR(),- ns.dividePolygon(),- ns.densify(),- ns.transform(model.crs),- ns.timeLabel(model.time)+ dataResultsOrbitFilter(productConfig.orbit),+ dataResultsTagProduct(model.selectedProduct),+ dataResultsTagNRT(productConfig.nrt),+ dataResultsTagURS(productConfig.urs),+ dataResultsCollectPreferred(model.prefer),+ dataResultsPreferredFilter(model.prefer),+ dataResultsTagVersion(),+ dataResultsCollectVersions(),+ dataResultsVersionFilter(),+ dataResultsGeometryFromCMR(),+ dataResultsDividePolygon(),+ dataResultsDensify(),+ dataResultsTransform(model.crs),+ dataResultsTimeLabel(model.time)];console.log('before process', results);return chain.process(results);diff --git a/web/js/data/wv.data.map.js b/web/js/data/map.jssimilarity index 75%rename from web/js/data/wv.data.map.jsrename to web/js/data/map.jsindex e7ff3136e..497ec97ee 100644--- a/web/js/data/wv.data.map.js+++ b/web/js/data/map.js@@ -1,7 +1,19 @@-var wv = wv || {};-wv.data = wv.data || {};+import $ from 'jquery';+import loEach from 'lodash/each';+import OlStyleStyle from 'ol/style/style';+import OlStyleIcon from 'ol/style/icon';+import OlStyleText from 'ol/style/text';+import OlStyleFill from 'ol/style/fill';+import OlStyleStroke from 'ol/style/stroke';+import OlLayerVector from 'ol/layer/vector';+import OlSourceVector from 'ol/source/vector';+import OlGeomLineString from 'ol/geom/linestring';+import OlFormatGeoJSON from 'ol/format/geojson';+import OlFeature from 'ol/feature';-wv.data.map = wv.data.map || function (model, maps, config) {+import {CRS_WGS_84, mapToPolys, mapDistanceX} from '../map/map';++export function dataMap(model, maps, config) {var self = {};var map = null;@@ -11,6 +23,7 @@ wv.data.map = wv.data.map || function (model, maps, config) {var buttonLayer = null;var selectionLayer = null;var gridLayer = null;+ var swathLayer = null;var hovering = null;var selectedFeatures = null;@@ -35,26 +48,26 @@ wv.data.map = wv.data.map || function (model, maps, config) {}if (feature !== hovering) {- return [new ol.style.Style({- image: new ol.style.Icon({+ return [new OlStyleStyle({+ image: new OlStyleIcon({src: image,scale: dim.scale})})];} else {var offset = -(dim.size / 2.0 + 14);- return [new ol.style.Style({- image: new ol.style.Icon({+ return [new OlStyleStyle({+ image: new OlStyleIcon({src: image,scale: dim.scale}),- text: new ol.style.Text({+ text: new OlStyleText({font: 'bold 14px ‘Lucida Sans’, Arial, Sans-Serif',text: feature.granule.label,- fill: new ol.style.Fill({+ fill: new OlStyleFill({color: '#ffffff'}),- stroke: new ol.style.Stroke({+ stroke: new OlStyleStroke({color: 'rgba(0, 0, 0, .7)',width: 5}),@@ -66,21 +79,21 @@ wv.data.map = wv.data.map || function (model, maps, config) {var hoverStyle = function (feature) {if (!model.isSelected(feature.granule)) {- return [new ol.style.Style({- fill: new ol.style.Fill({+ return [new OlStyleStyle({+ fill: new OlStyleFill({color: 'rgba(181, 158, 50, 0.25)'}),- stroke: new ol.style.Stroke({+ stroke: new OlStyleStroke({color: 'rgb(251, 226, 109)',width: 3})})];} else {- return [new ol.style.Style({- fill: new ol.style.Fill({+ return [new OlStyleStyle({+ fill: new OlStyleFill({color: 'rgba(242, 12, 12, 0.25)'}),- stroke: new ol.style.Stroke({+ stroke: new OlStyleStroke({color: 'rgb(255, 6, 0)',width: 3})@@ -89,8 +102,8 @@ wv.data.map = wv.data.map || function (model, maps, config) {};var createButtonLayer = function () {- buttonLayer = new ol.layer.Vector({- source: new ol.source.Vector({+ buttonLayer = new OlLayerVector({+ source: new OlSourceVector({wrapX: false}),style: buttonStyle@@ -99,8 +112,8 @@ wv.data.map = wv.data.map || function (model, maps, config) {};var createHoverLayer = function () {- hoverLayer = new ol.layer.Vector({- source: new ol.source.Vector({+ hoverLayer = new OlLayerVector({+ source: new OlSourceVector({wrapX: false}),style: hoverStyle@@ -109,15 +122,15 @@ wv.data.map = wv.data.map || function (model, maps, config) {};var createSelectionLayer = function () {- selectionLayer = new ol.layer.Vector({- source: new ol.source.Vector({+ selectionLayer = new OlLayerVector({+ source: new OlSourceVector({wrapX: false}),- style: new ol.style.Style({- fill: new ol.style.Fill({+ style: new OlStyleStyle({+ fill: new OlStyleFill({color: 'rgba(127, 127, 127, 0.2)'}),- stroke: new ol.style.Stroke({+ stroke: new OlStyleStroke({color: 'rgb(127, 127, 127)',width: 3}),@@ -128,12 +141,12 @@ wv.data.map = wv.data.map || function (model, maps, config) {};var createSwathLayer = function () {- swathLayer = new ol.layer.Vector({- source: new ol.source.Vector({+ swathLayer = new OlLayerVector({+ source: new OlSourceVector({wrapX: false}),- style: new ol.style.Style({- stroke: new ol.style.Stroke({+ style: new OlStyleStyle({+ stroke: new OlStyleStroke({color: 'rgba(195, 189, 123, 0.75)',width: 2})@@ -143,12 +156,12 @@ wv.data.map = wv.data.map || function (model, maps, config) {};var createGridLayer = function () {- gridLayer = new ol.layer.Vector({- source: new ol.source.Vector({+ gridLayer = new OlLayerVector({+ source: new OlSourceVector({wrapX: false}),- style: new ol.style.Style({- stroke: new ol.style.Stroke({+ style: new OlStyleStyle({+ stroke: new OlStyleStroke({color: 'rgba(186, 180, 152, 0.6)',width: 1.5})@@ -192,7 +205,7 @@ wv.data.map = wv.data.map || function (model, maps, config) {updateButtons();updateSwaths();updateGrid();- _.each(model.selectedGranules, function (granule) {+ loEach(model.selectedGranules, function (granule) {if (selectedFeatures[granule.id]) {selectionLayer.getSource().removeFeature(selectedFeatures[granule.id]);@@ -206,12 +219,12 @@ wv.data.map = wv.data.map || function (model, maps, config) {buttonLayer.getSource().clear();var features = [];- _.each(granules, function (granule) {+ loEach(granules, function (granule) {if (!granule.centroid || !granule.centroid[model.crs]) {return;}var centroid = granule.centroid[model.crs];- var feature = new ol.Feature({+ var feature = new OlFeature({geometry: centroid});feature.button = true;@@ -230,28 +243,28 @@ wv.data.map = wv.data.map || function (model, maps, config) {if (!swaths) {return;}- var maxDistance = (model.crs === wv.map.CRS_WGS_84)+ var maxDistance = (model.crs === CRS_WGS_84)? 270 : Number.POSITIVE_INFINITY;var features = [];- _.each(swaths, function (swath) {+ loEach(swaths, function (swath) {var lastGranule = null;- _.each(swath, function (granule) {+ loEach(swath, function (granule) {if (!lastGranule) {lastGranule = granule;return;}- var polys1 = wv.map.toPolys(lastGranule.geometry[model.crs]);- var polys2 = wv.map.toPolys(granule.geometry[model.crs]);- _.each(polys1, function (poly1) {- _.each(polys2, function (poly2) {+ var polys1 = mapToPolys(lastGranule.geometry[model.crs]);+ var polys2 = mapToPolys(granule.geometry[model.crs]);+ loEach(polys1, function (poly1) {+ loEach(polys2, function (poly2) {var c1 = poly1.getInteriorPoint().getCoordinates();var c2 = poly2.getInteriorPoint().getCoordinates();- var distanceX = wv.map.distanceX(c1[0], c2[0]);+ var distanceX = mapDistanceX(c1[0], c2[0]);if (distanceX < maxDistance) {- var ls = new ol.geom.LineString([c1, c2]);- features.push(new ol.Feature(ls));+ var ls = new OlGeomLineString([c1, c2]);+ features.push(new OlFeature(ls));}});});@@ -270,10 +283,10 @@ wv.data.map = wv.data.map || function (model, maps, config) {return;}var features = [];- var parser = new ol.format.GeoJSON();- _.each(grid, function (cell) {+ var parser = new OlFormatGeoJSON();+ loEach(grid, function (cell) {var geom = parser.readGeometry(cell.geometry);- var feature = new ol.Feature(geom);+ var feature = new OlFeature(geom);features.push(feature);});gridLayer.getSource()@@ -285,7 +298,7 @@ wv.data.map = wv.data.map || function (model, maps, config) {return;}granule.feature.changed();- var select = new ol.Feature(granule.geometry[model.crs]);+ var select = new OlFeature(granule.geometry[model.crs]);select.granule = granule;// granule.selectedFeature = select;selectionLayer.getSource()@@ -362,11 +375,11 @@ wv.data.map = wv.data.map || function (model, maps, config) {};var hoverOver = function (feature) {- granule = feature.granule;+ var granule = feature.granule;if (!granule.geometry) {return;}- var hover = new ol.Feature(granule.geometry[model.crs]);+ var hover = new OlFeature(granule.geometry[model.crs]);hover.granule = granule;hoverLayer.getSource().clear();diff --git a/web/js/data/wv.data.model.js b/web/js/data/model.jssimilarity index 94%rename from web/js/data/wv.data.model.jsrename to web/js/data/model.jsindex 4c78b3455..6c2ca041b 100644--- a/web/js/data/wv.data.model.js+++ b/web/js/data/model.js@@ -1,27 +1,16 @@-/**- * @module wv.data- */-var wv = wv || {};-wv.data = wv.data || {};--/**- * Undocumented.- *- * @class wv.data.model- */-wv.data.model = wv.data.model || function (models, config) {+import $ from 'jquery';+import loEach from 'lodash/each';+import loFind from 'lodash/find';+import util from '../util/util';+import {dataHandlerGetByName} from './handler';++export function dataModel(models, config) {var NO_PRODUCT_ID = '__NO_PRODUCT';var NO_PRODUCT = {name: 'Not available for download <span class=\'link\'>(?)</span>',notSelectable: true};- var state = {- layersString: null,- projection: null,- epsg: null,- time: null- };var layersModel = models.layers;var queryExecuting = false;var nextQuery = null;@@ -70,7 +59,7 @@ wv.data.model = wv.data.model || function (models, config) {* @readOnly* @type Events*/- self.events = wv.util.events();+ self.events = util.events();self.selectedProduct = null;self.selectedGranules = {};@@ -178,7 +167,7 @@ wv.data.model = wv.data.model || function (models, config) {// especially for IE9. This whole function needs clean up.var results = {};var none = products.__NO_PRODUCT;- _.each(products, function (product, key) {+ loEach(products, function (product, key) {if (key !== NO_PRODUCT_ID) {results[key] = product;}@@ -262,7 +251,7 @@ wv.data.model = wv.data.model || function (models, config) {};self.getSelectionCounts = function () {- counts = {};+ var counts = {};$.each(self.layers, function (index, layer) {if (layer.product) {counts[layer.product] = 0;@@ -288,7 +277,7 @@ wv.data.model = wv.data.model || function (models, config) {self.load = function (state, errors) {var productId = state.download;if (productId) {- var found = _.find(models.layers.active, {+ var found = loFind(models.layers.active, {product: productId});if (!found) {@@ -321,7 +310,7 @@ wv.data.model = wv.data.model || function (models, config) {throw Error('Product not defined: ' + self.selectedProduct);}- var handlerFactory = wv.data.handler.getByName(productConfig.handler);+ var handlerFactory = dataHandlerGetByName(productConfig.handler);var handler = handlerFactory(config, self);handler.events.on('query', function () {self.events.trigger(self.EVENT_QUERY);@@ -370,7 +359,7 @@ wv.data.model = wv.data.model || function (models, config) {var updateLayers = function () {self.layers = [];var foundSelected = false;- _.each(models.layers.get(), function (layer) {+ loEach(models.layers.get(), function (layer) {var id = layer.id;var names = models.layers.getTitles(layer.id);var layerName = names.title;@@ -399,7 +388,7 @@ wv.data.model = wv.data.model || function (models, config) {// FIXME: This is a hack for now and should be cleaned up when// everything changes to models.var products = self.groupByProducts();- _.each(self.selectedGranules, function (selected) {+ loEach(self.selectedGranules, function (selected) {if (!products[selected.product] &&!productActive(selected.product)) {self.unselectGranule(selected);@@ -409,7 +398,7 @@ wv.data.model = wv.data.model || function (models, config) {var productActive = function (product) {var active = false;- _.each(layersModel.active, function (layer) {+ loEach(layersModel.active, function (layer) {if (layer.product === product) {active = true;return false;diff --git a/web/js/data/wv.data.results.js b/web/js/data/results.jssimilarity index 74%rename from web/js/data/wv.data.results.jsrename to web/js/data/results.jsindex f843cf1e6..537ba75b5 100644--- a/web/js/data/wv.data.results.js+++ b/web/js/data/results.js@@ -1,37 +1,51 @@-/**- * @module wv.data- */-var wv = wv || {};-wv.data = wv.data || {};--wv.data.results = wv.data.results || {};--wv.data.results.antiMeridianMulti = function (maxDistance) {+import $ from 'jquery';++import OlGeomMultiPolygon from 'ol/geom/multipolygon';+import OlGeomMultiPoint from 'ol/geom/multipoint';+import OlFormatGeoJSON from 'ol/format/geojson';+import OlGeomPolygon from 'ol/geom/polygon';+import OlGeomPoint from 'ol/geom/point';+import olExtent from 'ol/extent';+import loClone from 'lodash/clone';+import loEach from 'lodash/each';+import {dataCmrRoundTime, dataCmrGeometry} from './cmr';+import util from '../util/util';+import {dataHelper} from '../edsc';+import {+ CRS_WGS_84,+ mapIsPolygonValid,+ mapAdjustAntiMeridian,+ mapToPolys,+ mapDistance2D,+ mapInterpolate2D+} from '../map/map';++export function dataResultsAntiMeridianMulti(maxDistance) {var self = {};self.name = 'AntiMeridianMulti';self.process = function (meta, granule) {- var geom = granule.geometry[wv.map.CRS_WGS_84];+ var geom = granule.geometry[CRS_WGS_84];// Semi-hack of ensuring geometry isn't a MultiPolygon since// isPolygonValid can't handle it; addresses WV-1574- if ((!(geom instanceof ol.geom.MultiPolygon)) &&- (!wv.map.isPolygonValid(geom, maxDistance))) {- var geomEast = wv.map.adjustAntiMeridian(geom, 1);- var geomWest = wv.map.adjustAntiMeridian(geom, -1);+ if ((!(geom instanceof OlGeomMultiPolygon)) &&+ (!mapIsPolygonValid(geom, maxDistance))) {+ var geomEast = mapAdjustAntiMeridian(geom, 1);+ var geomWest = mapAdjustAntiMeridian(geom, -1);var centroidEast = geomEast.getInteriorPoint();var centroidWest = geomWest.getInteriorPoint();var newGeom =- new ol.geom.MultiPolygon([+ new OlGeomMultiPolygon([geomEast.getCoordinates(),geomWest.getCoordinates()]);var newCentroid =- new ol.geom.MultiPoint([+ new OlGeomMultiPoint([centroidEast.getCoordinates(),centroidWest.getCoordinates()]);- granule.geometry[wv.map.CRS_WGS_84] = newGeom;- granule.centroid[wv.map.CRS_WGS_84] = newCentroid;+ granule.geometry[CRS_WGS_84] = newGeom;+ granule.centroid[CRS_WGS_84] = newCentroid;}return granule;};@@ -39,7 +53,7 @@ wv.data.results.antiMeridianMulti = function (maxDistance) {return self;};-wv.data.results.chain = function () {+export function dataResultsChain() {var self = {};self.processes = [];@@ -64,8 +78,8 @@ wv.data.results.chain = function () {}});- newGranules = [];- filteredGranules = {};+ var newGranules = [];+ var filteredGranules = {};$.each(results.granules, function (index, granule) {if (!granule.filtered) {newGranules.push(granule);@@ -87,7 +101,7 @@ wv.data.results.chain = function () {return self;};-wv.data.results.collectPreferred = function (prefer) {+export function dataResultsCollectPreferred(prefer) {var self = {};self.name = 'CollectPreferred';@@ -100,7 +114,7 @@ wv.data.results.collectPreferred = function (prefer) {(prefer === 'nrt' && granule.nrt) ||(prefer === 'science' && !granule.nrt);if (preferred) {- var timeStart = wv.data.cmr.roundTime(granule.time_start);+ var timeStart = dataCmrRoundTime(granule.time_start);meta.preferred[timeStart] = granule;}return granule;@@ -109,7 +123,7 @@ wv.data.results.collectPreferred = function (prefer) {return self;};-wv.data.results.collectVersions = function () {+export function dataResultsCollectVersions() {var self = {};self.name = 'CollectVersions';@@ -119,7 +133,7 @@ wv.data.results.collectVersions = function () {meta.versions = {};}if (granule.version) {- var timeStart = wv.data.cmr.roundTime(granule.time_start);+ var timeStart = dataCmrRoundTime(granule.time_start);var previousVersion = meta.versions[timeStart] || 0;meta.versions[timeStart] = Math.max(previousVersion,granule.version);@@ -130,7 +144,7 @@ wv.data.results.collectVersions = function () {return self;};-wv.data.results.connectSwaths = function (projection) {+export function dataResultsConnectSwaths(projection) {var MAX_DISTANCE_GEO = 270;var startTimes = {};var endTimes = {};@@ -175,7 +189,7 @@ wv.data.results.connectSwaths = function (projection) {var combineSwath = function (swath) {var combined = false;- var maxDistance = (projection === wv.map.CRS_WGS_84)+ var maxDistance = (projection === CRS_WGS_84)? MAX_DISTANCE_GEO : Number.POSITIVE_INFINITY;var thisTimeStart = roundTime(swath[0].time_start);var thisTimeEnd = roundTime(swath[swath.length - 1].time_end);@@ -219,8 +233,8 @@ wv.data.results.connectSwaths = function (projection) {// Connection is allowed as long as there is at least one path between// centroids that is less than the max distancevar connectionAllowed = function (g1, g2, maxDistance) {- var polys1 = wv.map.toPolys(g1.geometry[projection]);- var polys2 = wv.map.toPolys(g2.geometry[projection]);+ var polys1 = mapToPolys(g1.geometry[projection]);+ var polys2 = mapToPolys(g2.geometry[projection]);var allowed = false;$.each(polys1, function (index, poly1) {$.each(polys2, function (index, poly2) {@@ -238,29 +252,29 @@ wv.data.results.connectSwaths = function (projection) {};var roundTime = function (timeString) {- return wv.data.cmr.roundTime(timeString);+ return dataCmrRoundTime(timeString);};return self;};-wv.data.results.dateTimeLabel = function (time) {+export function dataResultsDateTimeLabel(time) {var self = {};self.name = 'DateTimeLabel';self.process = function (meta, granule) {- var timeStart = wv.util.parseTimestampUTC(granule.time_start);+ var timeStart = util.parseTimestampUTC(granule.time_start);// Some granules may not have an end timeif (granule.time_end) {- var timeEnd = wv.util.parseTimestampUTC(granule.time_end);- granule.label = wv.util.toISOStringDate(timeStart) + ': ' +- wv.util.toISOStringTimeHM(timeStart) + '-' +- wv.util.toISOStringTimeHM(timeEnd) + ' UTC';+ var timeEnd = util.parseTimestampUTC(granule.time_end);+ granule.label = util.toISOStringDate(timeStart) + ': ' ++ util.toISOStringTimeHM(timeStart) + '-' ++ util.toISOStringTimeHM(timeEnd) + ' UTC';} else {- granule.label = wv.util.toISOStringDate(timeStart) + ': ' +- wv.util.toISOStringTimeHM(timeStart) + ' UTC';+ granule.label = util.toISOStringDate(timeStart) + ': ' ++ util.toISOStringTimeHM(timeStart) + ' UTC';}return granule;@@ -269,7 +283,7 @@ wv.data.results.dateTimeLabel = function (time) {return self;};-wv.data.results.densify = function () {+export function dataResultsDensify() {var MAX_DISTANCE = 5;var self = {};@@ -282,19 +296,19 @@ wv.data.results.densify = function () {return granule;/*- var geom = granule.geometry[wv.map.CRS_WGS_84];+ var geom = granule.geometry[CRS_WGS_84];var newGeom = null;if ( geom.getPolygons ) {var polys = [];- _.each(geom.getPolygons(), function(poly) {+ loEach(geom.getPolygons(), function(poly) {polys.push(densifyPolygon(poly));});- newGeom = new ol.geom.MultiPolygon([polys]);+ newGeom = new OlGeomMultiPolygon([polys]);} else {var ring = densifyPolygon(geom);newGeom = new ol.geom.Polygon([ring]);}- granule.geometry[wv.map.CRS_WGS_84] = newGeom;+ granule.geometry[CRS_WGS_84] = newGeom;return granule;*/};@@ -308,24 +322,24 @@ wv.data.results.densify = function () {for (var i = 0; i < ring.length - 2; i++) {var start = ring[i];end = ring[i + 1];- var distance = wv.map.distance2D(start, end);+ var distance = mapDistance2D(start, end);var numPoints = Math.floor(distance / MAX_DISTANCE);- points.push(_.clone(start));+ points.push(loClone(start));for (var j = 1; j < numPoints - 1; j++) {var d = j / numPoints;// This is what REVERB does, so we will do the same- var p = wv.map.interpolate2D(start, end, d);+ var p = mapInterpolate2D(start, end, d);points.push(p);}}- points.push(_.clone(end));+ points.push(loClone(end));return points;};return self;};-wv.data.results.dividePolygon = function () {+export function dataResultsDividePolygon() {var self = {};self.name = 'DividePolygon';@@ -337,29 +351,29 @@ wv.data.results.dividePolygon = function () {var ring = granule.geometry['EPSG:4326'].getLinearRing(0);var coords = ring.getCoordinates();var latlons = [];- _.each(coords, function (coord) {- var latlon = new L.LatLng(coord[1], coord[0]);+ loEach(coords, function (coord) {+ var latlon = new dataHelper.LatLng(coord[1], coord[0]);latlons.push(latlon);});- var result = L.sphericalPolygon.dividePolygon(latlons);+ var result = dataHelper.sphericalPolygon.dividePolygon(latlons);var newPolys = result.interiors;var resultMultiPoly = [];- _.each(newPolys, function (newPoly) {+ loEach(newPolys, function (newPoly) {var resultPoly = [];- _.each(newPoly, function (newCoord) {+ loEach(newPoly, function (newCoord) {resultPoly.push([newCoord.lng, newCoord.lat]);});resultMultiPoly.push(resultPoly);});granule.geometry['EPSG:4326'] =- new ol.geom.MultiPolygon([resultMultiPoly]);+ new OlGeomMultiPolygon([resultMultiPoly]);return granule;};return self;};-wv.data.results.extentFilter = function (projection, extent) {+export function dataResultsExtentFilter(projection, extent) {var self = {};self.name = 'ExtentFilter';@@ -370,7 +384,7 @@ wv.data.results.extentFilter = function (projection, extent) {return result;}var mbr = geom.getExtent();- if (ol.extent.intersects(extent, mbr)) {+ if (olExtent.intersects(extent, mbr)) {return granule;}};@@ -382,7 +396,7 @@ wv.data.results.extentFilter = function (projection, extent) {return self;};-wv.data.results.geometryFromCMR = function (densify) {+export function dataResultsGeometryFromCMR(densify) {var self = {};self.name = 'GeometryFromCMR';@@ -395,12 +409,12 @@ wv.data.results.geometryFromCMR = function (densify) {granule.centroid = {};}- if (!granule.geometry[wv.map.CRS_WGS_84]) {- var cmrGeom = wv.data.cmr.geometry(granule, densify);+ if (!granule.geometry[CRS_WGS_84]) {+ var cmrGeom = dataCmrGeometry(granule, densify);var geom = cmrGeom.toOpenLayers();var centroid = geom.getInteriorPoint();- granule.geometry[wv.map.CRS_WGS_84] = geom;- granule.centroid[wv.map.CRS_WGS_84] = centroid;+ granule.geometry[CRS_WGS_84] = geom;+ granule.centroid[CRS_WGS_84] = centroid;}return granule;};@@ -408,8 +422,8 @@ wv.data.results.geometryFromCMR = function (densify) {return self;};-wv.data.results.geometryFromMODISGrid = function (projection) {- var parser = new ol.format.GeoJSON();+export function dataResultsGeometryFromMODISGrid(projection) {+ var parser = new OlFormatGeoJSON();var self = {};@@ -428,7 +442,7 @@ wv.data.results.geometryFromMODISGrid = function (projection) {}var grid = meta.grid[granule.hv];var geom = parser.readGeometry(meta.grid[granule.hv].geometry);- var centroid = new ol.geom.Point([+ var centroid = new OlGeomPoint([grid.properties.CENTER_X,grid.properties.CENTER_Y]);@@ -442,7 +456,7 @@ wv.data.results.geometryFromMODISGrid = function (projection) {return self;};-wv.data.results.modisGridIndex = function () {+export function dataResultsModisGridIndex() {var self = {};self.name = 'MODISGridIndex';@@ -467,7 +481,7 @@ wv.data.results.modisGridIndex = function () {return self;};-wv.data.results.modisGridLabel = function () {+export function dataResultsModisGridLabel() {var self = {};self.name = 'MODISGridLabel';@@ -475,8 +489,8 @@ wv.data.results.modisGridLabel = function () {self.process = function (meta, granule) {granule.label = 'h' + granule.h + ' - ' + 'v' + granule.v;- var timeStart = wv.util.parseTimestampUTC(granule.time_start);- var date = wv.util.toISOStringDate(timeStart);+ var timeStart = util.parseTimestampUTC(granule.time_start);+ var date = util.toISOStringDate(timeStart);granule.downloadLabel = date + ': h' + granule.h + '-' + granule.v;@@ -486,7 +500,7 @@ wv.data.results.modisGridLabel = function () {return self;};-wv.data.results.orbitFilter = function (spec) {+export function dataResultsOrbitFilter(spec) {var self = {};self.name = 'OrbitFilter';@@ -507,13 +521,13 @@ wv.data.results.orbitFilter = function (spec) {return self;};-wv.data.results.preferredFilter = function (prefer) {+export function dataResultsPreferredFilter(prefer) {var self = {};self.name = 'PreferredFilter';self.process = function (meta, granule) {- var timeStart = wv.data.cmr.roundTime(granule.time_start);+ var timeStart = dataCmrRoundTime(granule.time_start);if (meta.preferred[timeStart]) {if (prefer === 'nrt' && !granule.nrt) {return;@@ -528,7 +542,7 @@ wv.data.results.preferredFilter = function (prefer) {return self;};-wv.data.results.productLabel = function (name) {+export function dataResultsProductLabel(name) {var self = {};self.name = 'ProductLabel';@@ -541,7 +555,7 @@ wv.data.results.productLabel = function (name) {return self;};-wv.data.results.tagList = function (spec) {+export function dataResultsTagList(spec) {var self = {};self.name = 'TagList';@@ -557,7 +571,7 @@ wv.data.results.tagList = function (spec) {return self;};-wv.data.results.tagNRT = function (spec) {+export function dataResultsTagNRT(spec) {var self = {};self.name = 'TagNRT';@@ -586,7 +600,7 @@ wv.data.results.tagNRT = function (spec) {return self;};-wv.data.results.tagProduct = function (product) {+export function dataResultsTagProduct(product) {var self = {};self.name = 'TagProduct';@@ -600,7 +614,7 @@ wv.data.results.tagProduct = function (product) {};// FIXME: Code copy and pasted from TagNRT, maybe consoldate this?-wv.data.results.tagURS = function (spec) {+export function dataResultsTagURS(spec) {var self = {};self.name = 'TagURS';@@ -631,7 +645,7 @@ wv.data.results.tagURS = function (spec) {return self;};-wv.data.results.tagVersion = function () {+export function dataResultsTagVersion() {var self = {};self.name = 'TagVersion';@@ -657,11 +671,11 @@ wv.data.results.tagVersion = function () {return self;};-wv.data.results.timeFilter = function (spec) {+export function dataResultsTimeFilter(spec) {var westZone = null;var eastZone = null;var maxDistance = null;-+ var timeOffset;var self = {};self.name = 'TimeFilter';@@ -676,22 +690,22 @@ wv.data.results.timeFilter = function (spec) {};self.process = function (meta, granule) {- var geom = granule.geometry[wv.map.CRS_WGS_84];- var time = wv.util.parseTimestampUTC(granule.time_start);+ var geom = granule.geometry[CRS_WGS_84];+ var time = util.parseTimestampUTC(granule.time_start);time.setUTCMinutes(time.getUTCMinutes() + timeOffset);// Semi-hack of ensuring geometry isn't a MultiPolygon since// isPolygonValid can't handle it; addresses WV-1574- if ((!(geom instanceof ol.geom.MultiPolygon)) &&- (!wv.map.isPolygonValid(geom, maxDistance))) {+ if ((!(geom instanceof OlGeomMultiPolygon)) &&+ (!mapIsPolygonValid(geom, maxDistance))) {var adjustSign = (time < eastZone) ? 1 : -1;geom =- wv.map.adjustAntiMeridian(geom, adjustSign);- granule.geometry[wv.map.CRS_WGS_84] = geom;- granule.centroid[wv.map.CRS_WGS_84] = geom.getInteriorPoint();+ mapAdjustAntiMeridian(geom, adjustSign);+ granule.geometry[CRS_WGS_84] = geom;+ granule.centroid[CRS_WGS_84] = geom.getInteriorPoint();}- var x = granule.centroid[wv.map.CRS_WGS_84].getCoordinates()[0];+ var x = granule.centroid[CRS_WGS_84].getCoordinates()[0];if (time < eastZone && x < 0) {return;}@@ -705,18 +719,18 @@ wv.data.results.timeFilter = function (spec) {return self;};-wv.data.results.timeLabel = function (time) {+export function dataResultsTimeLabel(time) {var self = {};self.name = 'TimeLabel';self.process = function (meta, granule) {- var timeStart = wv.util.parseTimestampUTC(granule.time_start);+ var timeStart = util.parseTimestampUTC(granule.time_start);// Sometimes an end time is not provided by CMRvar timeEnd;if (granule.time_end) {- timeEnd = wv.util.parseTimestampUTC(granule.time_end);+ timeEnd = util.parseTimestampUTC(granule.time_end);}var diff = Math.floor(@@ -731,16 +745,16 @@ wv.data.results.timeLabel = function (time) {suffix = ' (+' + diff + ' day)';}}- var displayStart = wv.util.toISOStringTimeHM(timeStart);+ var displayStart = util.toISOStringTimeHM(timeStart);var displayEnd = null;if (timeEnd) {- displayEnd = wv.util.toISOStringTimeHM(timeEnd);+ displayEnd = util.toISOStringTimeHM(timeEnd);} else {displayEnd = '?';}granule.label = displayStart + ' - ' + displayEnd + ' UTC' + suffix;- granule.downloadLabel = wv.util.toISOStringDate(timeStart) + ': ' ++ granule.downloadLabel = util.toISOStringDate(timeStart) + ': ' +displayStart + '-' + displayEnd + ' UTC';return granule;@@ -749,7 +763,7 @@ wv.data.results.timeLabel = function (time) {return self;};-wv.data.results.transform = function (projection) {+export function dataResultsTransform(projection) {var self = {};self.name = 'Transform';@@ -758,15 +772,15 @@ wv.data.results.transform = function (projection) {if (granule.geometry[projection]) {return granule;}- var geom = granule.geometry[wv.map.CRS_WGS_84];+ var geom = granule.geometry[CRS_WGS_84];var projGeom = geom.clone()- .transform(wv.map.CRS_WGS_84, projection);+ .transform(CRS_WGS_84, projection);granule.geometry[projection] = projGeom;- if (projGeom instanceof ol.geom.Polygon) {+ if (projGeom instanceof OlGeomPolygon) {granule.centroid[projection] = projGeom.getInteriorPoint();} else {- // Assuming that projGeom is a ol.geom.MultiPolygon+ // Assuming that projGeom is a OlGeomMultiPolygongranule.centroid[projection] =projGeom.getInteriorPoints().getPoint(0);@@ -778,14 +792,14 @@ wv.data.results.transform = function (projection) {return self;};-wv.data.results.versionFilter = function () {+export function dataResultsVersionFilter() {var self = {};self.name = 'VersionFilter';self.process = function (meta, granule) {if (granule.version) {- var timeStart = wv.data.cmr.roundTime(granule.time_start);+ var timeStart = dataCmrRoundTime(granule.time_start);if (meta.versions[timeStart]) {if (meta.versions[timeStart] !== granule.version) {return;@@ -798,7 +812,7 @@ wv.data.results.versionFilter = function () {return self;};-wv.data.results.versionFilterExact = function (version) {+export function dataResultsVersionFilterExact(version) {var self = {};self.name = 'versionFilterExact';diff --git a/web/js/data/wv.data.ui.js b/web/js/data/ui.jssimilarity index 79%rename from web/js/data/wv.data.ui.jsrename to web/js/data/ui.jsindex 33961037c..a9d2bbf13 100644--- a/web/js/data/wv.data.ui.js+++ b/web/js/data/ui.js@@ -1,7 +1,16 @@-var wv = wv || {};-wv.data = wv.data || {};--wv.data.ui = wv.data.ui || function (models, ui, config) {+import $ from 'jquery';+import loSize from 'lodash/size';+import loEach from 'lodash/each';+import {GA as GoogleAnalytics} from 'worldview-components';+import olExtent from 'ol/extent';++import {dataMap} from './map';+import uiIndicator from '../ui/indicator';+import util from '../util/util';+import wvui from '../ui/ui';+import {REL_DATA, REL_METADATA, REL_BROWSE, DATA_EXTS} from './cmr';++export function dataUi(models, ui, config) {var queryActive = false;var model = models.data;var mapController = null;@@ -207,34 +216,34 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {var extent = map.getView().calculateExtent(map.getSize());var crs = models.proj.selected.crs;- _.each(lastResults.granules, function (granule) {+ loEach(lastResults.granules, function (granule) {if (granule.centroid && granule.centroid[crs]) {hasCentroids = true;- if (ol.extent.intersects(extent,+ if (olExtent.intersects(extent,granule.centroid[crs].getExtent())) {inView = true;return true;}}});- wv.ui.indicator.hide(indicators.noneInView);+ uiIndicator.hide(indicators.noneInView);if (hasCentroids && !inView) {indicators.noneInView =- wv.ui.indicator.show('Zoom out or move map');+ uiIndicator.show('Zoom out or move map');}};var onActivate = function () {ui.sidebar.selectTab('download');if (!mapController) {- mapController = wv.data.map(model, maps, config);+ mapController = dataMap(model, maps, config);}onLayerUpdate();updateSelection();};var onDeactivate = function () {- wv.ui.indicator.hide(indicators);+ uiIndicator.hide(indicators);if (selectionListPanel) {selectionListPanel.hide();}@@ -258,7 +267,7 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {var onQuery = function () {queryActive = true;- indicators.query = wv.ui.indicator.searching(indicators);+ indicators.query = uiIndicator.searching(indicators);if (selectionListPanel) {selectionListPanel.hide();}@@ -274,15 +283,15 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {}queryActive = false;lastResults = results;- wv.ui.indicator.hide(indicators);+ uiIndicator.hide(indicators);var hasResults = true;if (model.selectedProduct !== null && results.granules.length === 0) {- indicators.noData = wv.ui.indicator.noData(indicators);+ indicators.noData = uiIndicator.noData(indicators);hasResults = false;}if (results.meta.showList && hasResults) {selectionListPanel =- wv.data.ui.selectionListPanel(model, results);+ dataUiSelectionListPanel(model, results);selectionListPanel.show();}updateSelection();@@ -290,23 +299,23 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {var onQueryCancel = function () {queryActive = false;- wv.ui.indicator.hide(indicators);+ uiIndicator.hide(indicators);};var onQueryError = function (status, error) {queryActive = false;- wv.ui.indicator.hide(indicators);+ uiIndicator.hide(indicators);if (status !== 'abort') {console.error('Unable to search', status, error);- wv.ui.notify('Unable to search at this time.<br/><br/>Please try ' ++ wvui.notify('Unable to search at this time.<br/><br/>Please try ' +'again later.');}};var onQueryTimeout = function () {queryActive = false;- wv.ui.indicator.hide(indicators);- wv.ui.notify(+ uiIndicator.hide(indicators);+ wvui.notify('No results received yet. This may be due to a ' +'connectivity issue. Please try again later.');@@ -314,7 +323,7 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {var updateSelection = function () {var $button = $('#wv-data-download-button');- var selected = _.size(model.selectedGranules);+ var selected = loSize(model.selectedGranules);if (selected > 0) {$button.button('enable');var totalSize = model.getSelectionSize();@@ -343,13 +352,13 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {};var showDownloadList = function () {- WVC.GA.event('Data Download', 'Click', 'Download Button');+ GoogleAnalytics.event('Data Download', 'Click', 'Download Button');if (selectionListPanel) {selectionListPanel.setVisible(false);}if (!downloadListPanel) {downloadListPanel =- wv.data.ui.downloadListPanel(config, model);+ dataUiDownloadListPanel(config, model);downloadListPanel.events.on('close', function () {if (selectionListPanel) {selectionListPanel.setVisible(true);@@ -363,133 +372,131 @@ wv.data.ui = wv.data.ui || function (models, ui, config) {var headerMsg = '<h3 class=\'wv-data-unavailable-header\'>Why are these layers not available for downloading?</h3>';var bodyMsg = 'Some layers in Worldview do not have corresponding source data products available for download. These include National Boundaries, Orbit Tracks, Earth at Night, and MODIS Corrected Reflectance products.<br><br>For a downloadable product similar to MODIS Corrected Reflectance, please try the MODIS Land Surface Reflectance layers available in Worldview. If you would like to generate MODIS Corrected Reflectance imagery yourself, please see the following document: <a href="https://earthdata.nasa.gov/sites/default/files/field/document/MODIS_True_Color.pdf" target="_blank">https://earthdata.nasa.gov/sites/default/files/field/document/MODIS_True_Color.pdf</a><br><br>If you would like to download only an image, please use the "camera" icon in the upper right.<br><br> Data download will not work for "Terra and Aqua" Fires, select Terra only Fires and/or Aqua only Fires to download the associated data files.';- wv.ui.notify(headerMsg + bodyMsg, 'Notice', 600);+ wvui.notify(headerMsg + bodyMsg, 'Notice', 600);};init();return self;};-wv.data.ui.bulkDownloadPage = wv.data.ui.bulkDownloadPage ||- (function () {- var ns = {};- var pages = {- wget: 'pages/wget.html',- curl: 'pages/curl.html'- };+var dataUiBulkDownloadPage = (function () {+ var ns = {};+ var pages = {+ wget: 'pages/wget.html',+ curl: 'pages/curl.html'+ };- ns.show = function (selection, type) {- var nonce = Date.now();- var page = window.open(pages[type] + '?v=' + nonce,- 'Worldview_' + nonce);+ ns.show = function (selection, type) {+ var nonce = Date.now();+ var page = window.open(pages[type] + '?v=' + nonce,+ 'Worldview_' + nonce);- var loaded = false;- page.onload = function () {- if (!loaded) {- fillPage(page, selection, type);- loaded = true;- }- };- var checkCount = 0;- var timer = setInterval(function () {- checkCount++;- if (loaded) {- clearInterval(timer);- return;- }- if (checkCount > 20) {- clearInterval(timer);- return;- }- if (fillPage(page, selection, type)) {- loaded = true;- clearInterval(timer);- }- }, 100);+ var loaded = false;+ page.onload = function () {+ if (!loaded) {+ fillPage(page, selection, type);+ loaded = true;+ }};+ var checkCount = 0;+ var timer = setInterval(function () {+ checkCount++;+ if (loaded) {+ clearInterval(timer);+ return;+ }+ if (checkCount > 20) {+ clearInterval(timer);+ return;+ }+ if (fillPage(page, selection, type)) {+ loaded = true;+ clearInterval(timer);+ }+ }, 100);+ };- var fillPage = function (page, selection, type) {- var downloadLinks = [];- var hosts = {};- var indirectLinks = [];- $.each(selection, function (index, product) {- $.each(product.list, function (index2, granule) {- var netrc = '';- if (granule.urs) {- netrc = '--netrc ';+ var fillPage = function (page, selection, type) {+ var downloadLinks = [];+ var hosts = {};+ var indirectLinks = [];+ $.each(selection, function (index, product) {+ $.each(product.list, function (index2, granule) {+ var netrc = '';+ if (granule.urs) {+ netrc = '--netrc ';+ }+ $.each(granule.links, function (index2, link) {+ if (!link.data) {+ return;}- $.each(granule.links, function (index2, link) {- if (!link.data) {- return;- }- if (product.noBulkDownload) {- indirectLinks.push('<li><a href=\'' + link.href + '\'>' +- link.href + '</a></li>');- return;- }- if (type === 'curl') {- downloadLinks.push('curl --remote-name ' + netrc +- link.href);- } else {- downloadLinks.push(link.href);- }- if (granule.urs) {- // Get the hostname from the URL, the text between- // the double slash and the first slash after that- var host = /\/\/([^\/]*)\//.exec(link.href);- if (host) {- hosts[host[1]] = true;- }+ if (product.noBulkDownload) {+ indirectLinks.push('<li><a href=\'' + link.href + '\'>' ++ link.href + '</a></li>');+ return;+ }+ if (type === 'curl') {+ downloadLinks.push('curl --remote-name ' + netrc ++ link.href);+ } else {+ downloadLinks.push(link.href);+ }+ if (granule.urs) {+ // Get the hostname from the URL, the text between+ // the double slash and the first slash after that+ var host = /\/\/([^\/]*)\//.exec(link.href);+ if (host) {+ hosts[host[1]] = true;}- });+ }});});- var links = page.document.getElementById('links');- if (!links) return false;- links.innerHTML = '<pre>' + downloadLinks.join('\n') + '</pre>';-- var netrcEntries = [];- var hostnames = [];- $.each(hosts, function (host) {- netrcEntries.push('machine ' + host + ' login URS_USER ' +- 'password URS_PASSWORD');- hostnames.push(host);- });- if (netrcEntries.length > 0) {- page.document.getElementById('netrc')- .innerHTML =- '<pre>' + netrcEntries.join('\n') + '</pre>';- page.document.getElementById('bulk-password-notice')- .style.display = 'block';- page.document.getElementById('netrc-instructions')- .style.display = 'block';- var instructions =- page.document.getElementById('fdm-password-instructions');- if (instructions) {- instructions.style.display = 'block';- }- var machineNames =- page.document.getElementById('fdm-machine-names');- if (machineNames) {- machineNames.innerHTML = '<pre>' + hostnames.join('\n') +- '</pre>';- }+ });+ var links = page.document.getElementById('links');+ if (!links) return false;+ links.innerHTML = '<pre>' + downloadLinks.join('\n') + '</pre>';++ var netrcEntries = [];+ var hostnames = [];+ $.each(hosts, function (host) {+ netrcEntries.push('machine ' + host + ' login URS_USER ' ++ 'password URS_PASSWORD');+ hostnames.push(host);+ });+ if (netrcEntries.length > 0) {+ page.document.getElementById('netrc')+ .innerHTML =+ '<pre>' + netrcEntries.join('\n') + '</pre>';+ page.document.getElementById('bulk-password-notice')+ .style.display = 'block';+ page.document.getElementById('netrc-instructions')+ .style.display = 'block';+ var instructions =+ page.document.getElementById('fdm-password-instructions');+ if (instructions) {+ instructions.style.display = 'block';}- if (indirectLinks.length > 0) {- page.document.getElementById('indirect-instructions')- .style.display = 'block';- page.document.getElementById('indirect')- .innerHTML =- '<ul>' + indirectLinks.join('\n') + '</ul>';+ var machineNames =+ page.document.getElementById('fdm-machine-names');+ if (machineNames) {+ machineNames.innerHTML = '<pre>' + hostnames.join('\n') ++ '</pre>';}- return true;- };+ }+ if (indirectLinks.length > 0) {+ page.document.getElementById('indirect-instructions')+ .style.display = 'block';+ page.document.getElementById('indirect')+ .innerHTML =+ '<ul>' + indirectLinks.join('\n') + '</ul>';+ }+ return true;+ };- return ns;- })();+ return ns;+})();-wv.data.ui.downloadListPanel = function (config, model) {- var cmr = wv.data.cmr;+var dataUiDownloadListPanel = function (config, model) {var NOTICE ='<div id=\'wv-data-selection-notice\'>' +'<i class=\'icon fa fa-info-circle fa-3x\'></i>' +@@ -507,10 +514,10 @@ wv.data.ui.downloadListPanel = function (config, model) {var urs = false;var $dialog;- self.events = wv.util.events();+ self.events = util.events();self.show = function () {- $dialog = wv.ui.getDialog()+ $dialog = wvui.getDialog().attr('id', 'wv-data-selection');$dialog.dialog({@@ -557,7 +564,7 @@ wv.data.ui.downloadListPanel = function (config, model) {$('#wv-data-selection').html(bodyText(selection));var bulkVisible = isBulkDownloadable() &&- _.size(model.selectedGranules) !== 0;+ loSize(model.selectedGranules) !== 0;if (bulkVisible) {$('wv-data-bulk-download-links').show();@@ -625,9 +632,9 @@ wv.data.ui.downloadListPanel = function (config, model) {if (hrefExt && hrefExt.length > 0) {hrefExt = hrefExt[0];}- if ((cmr.DATA_EXTS.indexOf(hrefExt) === -1 &&- link.rel !== cmr.REL_BROWSE) ||- link.rel === cmr.REL_METADATA) {+ if ((DATA_EXTS.indexOf(hrefExt) === -1 &&+ link.rel !== REL_BROWSE) ||+ link.rel === REL_METADATA) {if (!product.counts[link.href]) {product.counts[link.href] = 1;} else {@@ -665,7 +672,7 @@ wv.data.ui.downloadListPanel = function (config, model) {return;}// Skip browse images per Kevin's request- if (link.rel === cmr.REL_BROWSE) {+ if (link.rel === REL_BROWSE) {return;}item.links.push(reformatLink(link));@@ -712,7 +719,7 @@ wv.data.ui.downloadListPanel = function (config, model) {return {href: link.href,title: titleVal,- data: (link.rel === cmr.REL_DATA)+ data: (link.rel === REL_DATA)};};@@ -777,7 +784,7 @@ wv.data.ui.downloadListPanel = function (config, model) {};var bodyText = function () {- if (_.size(model.selectedGranules) === 0) {+ if (loSize(model.selectedGranules) === 0) {return '<br/><h3>Selection Empty</h3>';}var elements = [];@@ -810,11 +817,11 @@ wv.data.ui.downloadListPanel = function (config, model) {};var showWgetPage = function () {- wv.data.ui.bulkDownloadPage.show(selection, 'wget');+ dataUiBulkDownloadPage.show(selection, 'wget');};var showCurlPage = function () {- wv.data.ui.bulkDownloadPage.show(selection, 'curl');+ dataUiBulkDownloadPage.show(selection, 'curl');};var removeGranule = function () {@@ -826,20 +833,18 @@ wv.data.ui.downloadListPanel = function (config, model) {var onHoverOver = function () {model.events.trigger('hoverOver',- model.selectedGranules[$(this)- .attr('data-granule')]);+ model.selectedGranules[$(this).attr('data-granule')]);};var onHoverOut = function () {model.events.trigger('hoverOut',- model.selectedGranules[$(this)- .attr('data-granule')]);+ model.selectedGranules[$(this).attr('data-granule')]);};return self;};-wv.data.ui.selectionListPanel = function (model, results) {+var dataUiSelectionListPanel = function (model, results) {var self = {};var granules = {};var $dialog;@@ -849,7 +854,7 @@ wv.data.ui.selectionListPanel = function (model, results) {};self.show = function () {- $dialog = wv.ui.getDialog('wv-data-list');+ $dialog = wvui.getDialog('wv-data-list');$dialog.attr('id', 'wv-data-list').html(bodyText())@@ -922,8 +927,7 @@ wv.data.ui.selectionListPanel = function (model, results) {};var toggleSelection = function () {- var granule = granules[$(this)- .attr('value')];+ var granule = granules[$(this).attr('value')];var selected = $(this).prop('checked');if (selected) {diff --git a/web/js/data/wv.data.js b/web/js/data/wv.data.jsdeleted file mode 100644index b21831311..000000000--- a/web/js/data/wv.data.js+++ /dev/null@@ -1,21 +0,0 @@-var wv = wv || {};--wv.data = (function (self) {- self.parse = function (state, errors, config) {- if (state.dataDownload) {- state.download = state.dataDownload;- delete state.dataDownload;- }- var productId = state.download;- if (productId) {- if (!config.products[productId]) {- delete state.download;- errors.push({- message: 'No such product: ' + productId- });- }- }- };-- return self;-})(wv.data || {});