Interactive interface for browsing global, full-resolution satellite imagery
Added checks for today's date in events if it's a severe storm - Sorts multi-day data by most recent first. - If it's a severe storm & the latest date is today's date then the today's date is removed.
ZachTRiceff8f0b0c2f39
diff --git a/web/js/naturalEvents/wv.naturalEvents.request.js b/web/js/naturalEvents/wv.naturalEvents.request.jsindex d3f7f14cc..165755853 100644--- a/web/js/naturalEvents/wv.naturalEvents.request.js+++ b/web/js/naturalEvents/wv.naturalEvents.request.js@@ -24,7 +24,6 @@ wv.naturalEvents.request = wv.naturalEvents.request || function(models, ui, confself.EVENT_QUERY_RESULTS = "queryResults";self.EVENT_SELECT = "select";- // Set URL to http://localhost:3000/mock for testing data.self.apiURL = config.features.naturalEvents.host;var querySuccessFlag = false;var model = models.naturalEvents;@@ -60,7 +59,7 @@ wv.naturalEvents.request = wv.naturalEvents.request || function(models, ui, conf}};- // Point url to test_file.json to pull in mock data.+var queryEvents = function(callback) {var url = self.apiURL + "/events";$.getJSON(url, function(data) {diff --git a/web/js/naturalEvents/wv.naturalEvents.ui.js b/web/js/naturalEvents/wv.naturalEvents.ui.jsindex 449469414..2169544ea 100644--- a/web/js/naturalEvents/wv.naturalEvents.ui.js+++ b/web/js/naturalEvents/wv.naturalEvents.ui.js@@ -287,28 +287,27 @@ wv.naturalEvents.ui = wv.naturalEvents.ui || function(models, ui, config, reques};var refreshEvent = function($content, event, index) {-var eventCategoryID = event.categories[0].id || null;-- // If an event is an IceBerg (15) or Volcanoes (12), then sort by newest events first- // TODO: For events that may not have data available today, check for today's date and use geoms.pop(); before reversing order to remove today's (incomplete) data.- var geoms = toArray(event.geometries);-+ var geoms = toArray(event.geometries);eventDate = wv.util.parseDateUTC(geoms[0].date);- var eventDateISOString = wv.util.toISOStringDate(eventDate);- var todayDateISOString = wv.util.toISOStringDate(wv.util.today());+ // Check if an event is an Severe Storms (10)+ if(eventCategoryID == 10) {+ var geomsLatestGeom = geoms[geoms.length - 1];+ var geomsLatestDate = wv.util.parseDateUTC(geomsLatestGeom.date);+ var eventDateISOString = wv.util.toISOStringDate(geomsLatestDate);+ var todayDateISOString = wv.util.toISOStringDate(wv.util.today());- // If an event is an IceBerg (15) or Volcanoes (12), then sort by newest events first- // Alternatively, remove this check to reverse sort all data and only perform date check on certain categories.- if(eventCategoryID == 15 || eventCategoryID == 12) {+ // Sort by latest dates firstgeoms.reverse();-- // If the latest date is equal to today, then remove that date as it might have incomplete data.+ // If the latest date is equal to today,+ // then remove that date as it might have incomplete data.if(eventDateISOString == todayDateISOString) {geoms.shift();}+ } else {+ geoms.reverse();}diff --git a/web/mock/test_events.json b/web/mock/test_events.jsonindex 89b1933cc..a81808e32 100644--- a/web/mock/test_events.json+++ b/web/mock/test_events.json@@ -236,6 +236,152 @@]},+ {+ "id": "EONET_2733",+ "title": "Iceberg B30-TEST",+ "description": "",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2733",+ "categories": [+ {+ "id": 15,+ "title": "Sea and Lake Ice"+ }+ ],+ "sources": [+ {+ "id": "NATICE",+ "url": ""+ }++ ],+ "geometries": [+ {+ "date": "2012-08-08T00:00:00Z",+ "type": "Point", "coordinates": [ -107.0791, -74.6012 ]+ },+ {+ "date": "2012-09-09T00:00:00Z",+ "type": "Point", "coordinates": [ -107.0791, -74.6012 ]+ },+ {+ "date": "2012-10-01T00:00:00Z",+ "type": "Point", "coordinates": [ -106.8485, -74.4301 ]+ },+ {+ "date": "2012-11-09T00:00:00Z",+ "type": "Point", "coordinates": [ -107.0473, -73.9919 ]+ },+ {+ "date": "2012-12-04T00:00:00Z",+ "type": "Point", "coordinates": [ -108.3369, -73.3476 ]+ },+ {+ "date": "2013-01-21T00:00:00Z",+ "type": "Point", "coordinates": [ -109.1054, -72.9535 ]+ },+ {+ "date": "2013-02-10T00:00:00Z",+ "type": "Point", "coordinates": [ -109.9264, -72.6757 ]+ },+ {+ "date": "2013-03-12T00:00:00Z",+ "type": "Point", "coordinates": [ -110.5143, -72.7185 ]+ },+ {+ "date": "2013-04-04T00:00:00Z",+ "type": "Point", "coordinates": [ -112.2076, -72.3576 ]+ },+ {+ "date": "2013-09-04T00:00:00Z",+ "type": "Point", "coordinates": [ -114.8741, -71.4385 ]+ },+ {+ "date": "2013-10-03T00:00:00Z",+ "type": "Point", "coordinates": [ -115.4525, -71.5515 ]+ },+ {+ "date": "2013-11-03T00:00:00Z",+ "type": "Point", "coordinates": [ -119.1569, -71.6348 ]+ },+ {+ "date": "2013-12-03T00:00:00Z",+ "type": "Point", "coordinates": [ -119.6126, -71.4968 ]+ },+ {+ "date": "2014-01-03T00:00:00Z",+ "type": "Point", "coordinates": [ -118.7164, -71.5061 ]+ },+ {+ "date": "2014-02-04T00:00:00Z",+ "type": "Point", "coordinates": [ -120.0084, -71.3578 ]+ },+ {+ "date": "2014-04-02T00:00:00Z",+ "type": "Point", "coordinates": [ -120.3049, -71.4506 ]+ },+ {+ "date": "2014-09-02T00:00:00Z",+ "type": "Point", "coordinates": [ -122.4766, -71.7122 ]+ },+ {+ "date": "2014-10-03T00:00:00Z",+ "type": "Point", "coordinates": [ -129.4619, -73.2982 ]+ },+ {+ "date": "2014-11-15T00:00:00Z",+ "type": "Point", "coordinates": [ -128.7063, -73.5593 ]+ },+ {+ "date": "2014-12-05T00:00:00Z",+ "type": "Point", "coordinates": [ -128.3491, -73.9525 ]+ },+ {+ "date": "2015-01-18T00:00:00Z",+ "type": "Point", "coordinates": [ -128.7291, -73.7930 ]+ },+ {+ "date": "2015-02-14T00:00:00Z",+ "type": "Point", "coordinates": [ -130.1039, -73.9265 ]+ },+ {+ "date": "2015-03-06T00:00:00Z",+ "type": "Point", "coordinates": [ -131.3582, -74.0653 ]+ },+ {+ "date": "2015-11-15T00:00:00Z",+ "type": "Point", "coordinates": [ -131.6436, -73.8799 ]+ },+ {+ "date": "2015-12-10T00:00:00Z",+ "type": "Point", "coordinates": [ -131.7159, -73.6767 ]+ },+ {+ "date": "2016-01-15T00:00:00Z",+ "type": "Point", "coordinates": [ -132.3065, -73.8905 ]+ },+ {+ "date": "2016-02-01T00:00:00Z",+ "type": "Point", "coordinates": [ -134.2615, -73.7783 ]+ },+ {+ "date": "2016-03-12T00:00:00Z",+ "type": "Point", "coordinates": [ -137.2411, -74.0321 ]+ },+ {+ "date": "2016-04-09T00:00:00Z",+ "type": "Point", "coordinates": [ -140.9370, -74.0345 ]+ },+ {+ "date": "2017-02-24T00:00:00Z",+ "type": "Point", "coordinates": [ -155.23, -73.63 ]+ },+ {+ "date": "2017-05-24T00:00:00Z",+ "type": "Point", "coordinates": [ -155.23, -73.63 ]+ }++ ]+ },{"id": "EONET_0001","title": "Example id 1",