Interactive interface for browsing global, full-resolution satellite imagery
Issue #226. Added new test json files & created event ID and time check
ZachTRicea1111cca03d9
diff --git a/web/js/naturalEvents/wv.naturalEvents.request.js b/web/js/naturalEvents/wv.naturalEvents.request.jsindex 165755853..d3f7f14cc 100644--- a/web/js/naturalEvents/wv.naturalEvents.request.js+++ b/web/js/naturalEvents/wv.naturalEvents.request.js@@ -24,6 +24,7 @@ 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;@@ -59,7 +60,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 e0d0618fb..449469414 100644--- a/web/js/naturalEvents/wv.naturalEvents.ui.js+++ b/web/js/naturalEvents/wv.naturalEvents.ui.js@@ -288,9 +288,30 @@ wv.naturalEvents.ui = wv.naturalEvents.ui || function(models, ui, config, requesvar refreshEvent = function($content, event, index) {- var geoms = toArray(event.geometries).reverse();+ 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);++eventDate = wv.util.parseDateUTC(geoms[0].date);+ var eventDateISOString = wv.util.toISOStringDate(eventDate);+ 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) {+ geoms.reverse();++ // If the latest date is equal to today, then remove that date as it might have incomplete data.+ if(eventDateISOString == todayDateISOString) {+ geoms.shift();+ }+ }++dateString = wv.util.giveWeekDay(eventDate) + ", " +wv.util.giveMonth(eventDate) + " " +eventDate.getUTCDate();diff --git a/web/mock/test_categories.json b/web/mock/test_categories.jsonnew file mode 100644index 000000000..884503c31--- /dev/null+++ b/web/mock/test_categories.json@@ -0,0 +1,99 @@++{+ "title": "EONET Event Categories",+ "description": "List of all the available event categories in the EONET system",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories",+ "categories": [+ {+ "id": 6,+ "title": "Drought",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/6",+ "description": "Long lasting absence of precipitation affecting agriculture and livestock, and the overall availability of food and water.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/6"+ },+ {+ "id": 7,+ "title": "Dust and Haze",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/7",+ "description": "Related to dust storms, air pollution and other non-volcanic aerosols. Volcano-related plumes shall be included with the originating eruption event.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/7"+ },+ {+ "id": 16,+ "title": "Earthquakes",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/16",+ "description": "Related to all manner of shaking and displacement. Certain aftermath of earthquakes may also be found under landslides and floods.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/16"+ },+ {+ "id": 9,+ "title": "Floods",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/9",+ "description": "Related to aspects of actual flooding--e.g., inundation, water extending beyond river and lake extents.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/9"+ },+ {+ "id": 14,+ "title": "Landslides",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/14",+ "description": "Related to landslides and variations thereof: mudslides, avalanche.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/14"+ },+ {+ "id": 19,+ "title": "Manmade",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/19",+ "description": "Events that have been human-induced and are extreme in their extent.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/19"+ },+ {+ "id": 15,+ "title": "Sea and Lake Ice",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/15",+ "description": "Related to all ice that resides on oceans and lakes, including sea and lake ice (permanent and seasonal) and icebergs.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/15"+ },+ {+ "id": 10,+ "title": "Severe Storms",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/10",+ "description": "Related to the atmospheric aspect of storms (hurricanes, cyclones, tornadoes, etc.). Results of storms may be included under floods, landslides, etc.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/10"+ },+ {+ "id": 17,+ "title": "Snow",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/17",+ "description": "Related to snow events, particularly extreme/anomalous snowfall in either timing or extent/depth.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/17"+ },+ {+ "id": 18,+ "title": "Temperature Extremes",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/18",+ "description": "Related to anomalous land temperatures, either heat or cold.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/18"+ },+ {+ "id": 12,+ "title": "Volcanoes",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/12",+ "description": "Related to both the physical effects of an eruption (rock, ash, lava) and the atmospheric (ash and gas plumes). ",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/12"+ },+ {+ "id": 13,+ "title": "Water Color",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/13",+ "description": "Related to events that alter the appearance of water: phytoplankton, red tide, algae, sediment, whiting, etc.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/13"+ },+ {+ "id": 8,+ "title": "Wildfires",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/categories/8",+ "description": "Wildfires includes all nature of fire, including forest and plains fires, as well as urban and industrial fire events. Fires may be naturally caused or manmade.",+ "layers": "http://eonet.sci.gsfc.nasa.gov/api/v2/layers/8"+ }+ ]+}diff --git a/web/mock/test_events.json b/web/mock/test_events.jsonnew file mode 100644index 000000000..89b1933cc--- /dev/null+++ b/web/mock/test_events.json@@ -0,0 +1,270 @@++{+ "title": "EONET Events",+ "description": "Natural events from EONET.",+ "link": "https://eonet.sci.gsfc.nasa.gov/api/v2/events",+ "events": [+ {+ "id": "EONET_2793",+ "title": "Elm Fire, California",+ "description": "",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2793",+ "categories": [+ {+ "id": 8,+ "title": "Wildfires"+ }+ ],+ "sources": [+ {+ "id": "CALFIRE",+ "url": "http://www.fire.ca.gov/current_incidents/incidentdetails/Index/1496"+ }++ ],+ "geometries": [+ {+ "date": "2017-05-18T00:00:00Z",+ "type": "Point", "coordinates": [ -120.37116, 36.12089 ]+ },+ {+ "date": "2017-06-18T00:00:00Z",+ "type": "Point", "coordinates": [ -120.37116, 36.12089 ]+ }++ ]+ },+ {+ "id": "EONET_2792",+ "title": "Santiago, Chile Flooding",+ "description": "",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2792",+ "categories": [+ {+ "id": 9,+ "title": "Floods"+ }+ ],+ "sources": [+ {+ "id": "IDC",+ "url": "https://www.disasterscharter.org/web/guest/-/flood-in-chile-call-609-"+ }++ ],+ "geometries": [+ {+ "date": "2017-05-13T00:00:00Z",+ "type": "Point", "coordinates": [ -70.6640625, -33.45894275368763 ]+ },+ {+ "date": "2017-06-13T00:00:00Z",+ "type": "Point", "coordinates": [ -70.6640625, -33.45894275368763 ]+ }++ ]+ },+ {+ "id": "EONET_2781",+ "title": "Langila Volcano, Papua New Guinea",+ "description": "",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_2781",+ "categories": [+ {+ "id": 12,+ "title": "Volcanoes"+ }+ ],+ "sources": [+ {+ "id": "SIVolcano",+ "url": "http://volcano.si.edu/volcano.cfm?vn=252010"+ }++ ],+ "geometries": [+ {+ "date": "2017-04-23T00:00:00Z",+ "type": "Point", "coordinates": [ 148.42, -5.525 ]+ },+ {+ "date": "2017-05-23T00:00:00Z",+ "type": "Point", "coordinates": [ 148.42, -5.525 ]+ }++ ]+ },+ {+ "id": "EONET_2733",+ "title": "Iceberg B30",+ "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 ]+ }++ ]+ },+ {+ "id": "EONET_0001",+ "title": "Example id 1",+ "description": "",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events/EONET_0001",+ "categories": [+ {+ "id": 1,+ "title": "Sea and Lake Ice"+ }+ ],+ "sources": [+ {+ "id": "NATICE",+ "url": ""+ }++ ],+ "geometries": [+ {+ "date": "2012-10-04T00:00:00Z",+ "type": "Point", "coordinates": [ -41.3934, -75.8634 ]+ },+ {+ "date": "2012-11-04T00:00:00Z",+ "type": "Point", "coordinates": [ -41.3934, -75.8634 ]+ }++ ]+ }+ ]+}diff --git a/web/mock/test_sources.json b/web/mock/test_sources.jsonnew file mode 100644index 000000000..5b7e65242--- /dev/null+++ b/web/mock/test_sources.json@@ -0,0 +1,122 @@++{+ "title": "EONET Event Sources",+ "description": "List of all the available event sources in the EONET system",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/sources",+ "sources": [+ {+ "id": "AU_BOM",+ "title": "Australia Bureau of Meteorology",+ "source": "http://www.bom.gov.au/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=AU_BOM"+ },+ {+ "id": "BCWILDFIRE",+ "title": "British Columbia Wildfire Service",+ "source": "http://bcwildfire.ca/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=BCWILDFIRE"+ },+ {+ "id": "CALFIRE",+ "title": "California Department of Forestry and Fire Protection",+ "source": "http://www.calfire.ca.gov/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=CALFIRE"+ },+ {+ "id": "CEMS",+ "title": "Copernicus Emergency Management Service",+ "source": "http://emergency.copernicus.eu/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=CEMS"+ },+ {+ "id": "EO",+ "title": "Earth Observatory",+ "source": "http://earthobservatory.nasa.gov/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=EO"+ },+ {+ "id": "GDACS",+ "title": "Global Disaster Alert and Coordination System",+ "source": "http://www.gdacs.org/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=GDACS"+ },+ {+ "id": "GLIDE",+ "title": "GLobal IDEntifier Number (GLIDE)",+ "source": "http://www.glidenumber.net/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=GLIDE"+ },+ {+ "id": "InciWeb",+ "title": "InciWeb",+ "source": "http://inciweb.nwcg.gov/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=InciWeb"+ },+ {+ "id": "IDC",+ "title": "International Charter on Space and Major Disasters",+ "source": "https://www.disasterscharter.org/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=IDC"+ },+ {+ "id": "MRR",+ "title": "LANCE Rapid Response",+ "source": "https://lance.modaps.eosdis.nasa.gov/cgi-bin/imagery/gallery.cgi",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=MRR"+ },+ {+ "id": "NASA_ESRS",+ "title": "NASA Earth Science and Remote Sensing Unit",+ "source": "https://eol.jsc.nasa.gov/ESRS/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=NASA_ESRS"+ },+ {+ "id": "PDC",+ "title": "Pacific Disaster Center",+ "source": "http://www.pdc.org/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=PDC"+ },+ {+ "id": "ReliefWeb",+ "title": "ReliefWeb",+ "source": "http://reliefweb.int/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=ReliefWeb"+ },+ {+ "id": "SIVolcano",+ "title": "Smithsonian Institution Global Volcanism Program",+ "source": "http://www.volcano.si.edu/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=SIVolcano"+ },+ {+ "id": "NATICE",+ "title": "U.S. National Ice Center",+ "source": "http://www.natice.noaa.gov/Main_Products.htm",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=NATICE"+ },+ {+ "id": "UNISYS",+ "title": "Unisys Weather",+ "source": "http://weather.unisys.com/hurricane/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=UNISYS"+ },+ {+ "id": "USGS_CMT",+ "title": "USGS Emergency Operations Collection Management Tool",+ "source": "https://cmt.usgs.gov/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=USGS_CMT"+ },+ {+ "id": "HDDS",+ "title": "USGS Hazards Data Distribution System",+ "source": "https://hddsexplorer.usgs.gov/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=HDDS"+ },+ {+ "id": "DFES_WA",+ "title": "Western Australia Department of Fire and Emergency Services",+ "source": "https://www.dfes.wa.gov.au/",+ "link": "http://eonet.sci.gsfc.nasa.gov/api/v2/events?source=DFES_WA"+ }+ ]+}