Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

added the basics for the VIIRS fire handler

Mike McGannec92c6dd8f6e
diff --git a/doc/data_download.md b/doc/data_download.md
index 13941e312..db18b7c55 100644
--- a/doc/data_download.md
+++ b/doc/data_download.md
@@ -131,7 +131,11 @@ only one of these.
### ConnectSwaths
Uses the acquisition times to create connector lines to show the swath
-ground track.
+ground track. Swaths are normally connected when the start time of one
+granule matches the end time of another granule. If this is not the
+case, use the `delta` parameter to specify, in seconds, how much time should
+be added to the start time to match the end time of another granule. For
+VIIRS, this is -60.
### DateTimeLabel
diff --git a/web/js/data/handler.js b/web/js/data/handler.js
index 67414c31a..05b1e3807 100644
--- a/web/js/data/handler.js
+++ b/web/js/data/handler.js
@@ -47,7 +47,8 @@ export function dataHandlerGetByName(name) {
'MODISMix': dataHandlerModisMix,
'MODISSwath': dataHandlerModisSwath,
'TerraSwathMultiDay': dataHandlerTerraSwathMultiDay,
- 'HalfOrbit': dataHandlerHalfOrbit
+ 'HalfOrbit': dataHandlerHalfOrbit,
+ 'VIIRSSwath': dataHandlerVIIRSSwath
};
var handler = map[name];
if (!handler) {
@@ -640,7 +641,62 @@ export function dataHandlerHalfOrbit(config, model, spec) {
dataResultsTransform(model.crs),
dataResultsTimeLabel(model.time)
];
- console.log('before process', results);
+ return chain.process(results);
+ };
+
+ init();
+ return self;
+};
+
+export function dataHandlerVIIRSSwath(config, model) {
+ var self = dataHandlerBase(config, model);
+
+ var spec = {
+ startTimeDelta: -180,
+ endTimeDelta: 180,
+ maxDistance: 270,
+ eastZone: 300,
+ westZone: 1380
+ };
+
+ var init = function () {
+ // Normal north-south extent minus a degree on each side. This removes
+ // granules that misbehave at the poles
+ self.extents[CRS_WGS_84] = [-180, -59, 180, 59];
+ };
+
+ self._submit = function (queryData) {
+ var queryOptions = {
+ time: model.time,
+ data: queryData
+ };
+
+ return self.cmr.submit(queryOptions);
+ };
+
+ self._processResults = function (data) {
+ var results = {
+ meta: {},
+ granules: data
+ };
+
+ // var productConfig = config.products[model.selectedProduct];
+ var chain = dataResultsChain();
+ chain.processes = [
+ dataResultsGeometryFromCMR(),
+ dataResultsTransform(model.crs),
+ dataResultsExtentFilter(model.crs, self.extents[model.crs]),
+ dataResultsTimeFilter({
+ time: model.time,
+ eastZone: spec.eastZone,
+ westZone: spec.westZone,
+ maxDistance: spec.maxDistance
+ }),
+ dataResultsTimeLabel(model.time),
+ // End of one granule is 60 seconds behind the start of the next granule.
+ // Use delta of -60.
+ dataResultsConnectSwaths(model.crs, -60)
+ ];
return chain.process(results);
};
diff --git a/web/js/data/results.js b/web/js/data/results.js
index cae1d6192..aa76de6f4 100644
--- a/web/js/data/results.js
+++ b/web/js/data/results.js
@@ -141,7 +141,7 @@ export function dataResultsCollectVersions() {
return self;
};
-export function dataResultsConnectSwaths(projection) {
+export function dataResultsConnectSwaths(projection, delta) {
var MAX_DISTANCE_GEO = 270;
var startTimes = {};
var endTimes = {};
@@ -170,7 +170,7 @@ export function dataResultsConnectSwaths(projection) {
startTimes[timeStart] = swath;
endTimes[timeEnd] = swath;
- combineSwath(swath);
+ combineSwath(swath, delta);
return granule;
};
@@ -183,14 +183,23 @@ export function dataResultsConnectSwaths(projection) {
});
};
- var combineSwath = function (swath) {
+ var combineSwath = function (swath, delta) {
var combined = false;
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);
- var otherSwath = endTimes[thisTimeStart];
+
+ // MODIS data is easily combined by matching up the end time of
+ // one granule to the start time of another granule because they
+ // are the same value. VIIRS start and end times differ by a
+ // minute. Use the delta value to adjust as needed.
+ delta = delta || 0;
+ var thisTimeStartDate = util.parseTimestampUTC(thisTimeStart);
+ thisTimeStartDate.setUTCSeconds(thisTimeStartDate.getUTCSeconds() + delta);
+ var thisTimeStartDelta = thisTimeStartDate.toISOString(thisTimeStartDate);
+ var otherSwath = endTimes[thisTimeStartDelta];
// Can this swath be added to the end of other swath?
if (otherSwath) {