Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Adjustments for GIBS DIT

Mike McGann4a5b0cc6fe96
diff --git a/bin/wv-options-validate b/bin/wv-options-validate
index be9b1556a..be0eb7413 100755
--- a/bin/wv-options-validate
+++ b/bin/wv-options-validate
@@ -36,6 +36,7 @@ config_dir = args[1]
error_count = 0
warning_count = 0
+remove_count = 0
def error(message):
global error_count
@@ -48,6 +49,8 @@ def warn(message):
warning_count += 1
def remove_layer(wv, layer_id):
+ global remove_count
+ remove_count += 1
del wv["layers"][layer_id]
if layer_id in wv["layerOrder"]: wv["layerOrder"].remove(layer_id)
@@ -57,13 +60,19 @@ with open(main_config_file) as fp:
with open(options_file) as fp:
opt = json.load(fp)
+if "autoLayerOrder" in opt:
+ warn("Using automatic layer ordering")
+
for layer_id in wv["layers"].keys():
layer = wv["layers"][layer_id]
if layer_id not in wv["layerOrder"]:
- if "warnOnUnexpectedLayer" in opt:
- warn("[%s] Unexpected layer" % layer_id)
- remove_layer(wv, layer_id)
- continue
+ if "autoLayerOrder" in opt:
+ wv["layerOrder"] += [layer_id]
+ else:
+ if not "allowUnexpectedLayers" in opt:
+ warn("[%s] Unexpected layer, not in layer order" % layer_id)
+ remove_layer(wv, layer_id)
+ continue
if "projections" not in layer or len(layer["projections"]) == 0:
warn("[%s] No projections defined or not found in GC documents" %
layer_id)
@@ -71,10 +80,12 @@ for layer_id in wv["layers"].keys():
if "palette" in layer:
palette_id = layer["palette"]["id"]
if not os.path.exists(os.path.join(config_dir, "palettes",
- palette_id + ".json")):
+ palette_id + ".json")) and not "ignoreUnknownPalettes" in opt:
error("[%s] Unknown palette: %s" % (layer_id, palette_id))
+ del layer["palette"]
if "group" not in layer:
- error("[%s] No group defined" % palette_id)
+ if not "allowUnexpectedLayers" in opt:
+ error("[%s] No group defined" % palette_id)
remove_layer(wv, layer_id)
continue
@@ -82,7 +93,8 @@ for layer_id in wv["layerOrder"]:
if layer_id not in wv["layers"]:
error("[%s] In layer order but no definition" % layer_id)
-print "%s: %d error(s), %d warning(s)" % (prog, error_count, warning_count)
+print "%s: %d error(s), %d warning(s), %d removed" % (prog, error_count,
+ warning_count, remove_count)
json_options = {}
json_options["indent"] = 4
diff --git a/bin/wv-options-wmts b/bin/wv-options-wmts
index cb0896646..75c90b7bb 100755
--- a/bin/wv-options-wmts
+++ b/bin/wv-options-wmts
@@ -182,7 +182,7 @@ def process_entry(entry, colormaps):
def fetch_colormaps(colormaps):
print "%s: Fetching %d colormaps" % (prog, len(colormaps))
sys.stdout.flush()
- errors = 0
+ warnings = 0
for link in colormaps.values():
try:
response = urllib.urlopen(link)
@@ -191,11 +191,11 @@ def fetch_colormaps(colormaps):
with open(output_file, "w") as fp:
fp.write(contents)
except Exception as e:
- errors += 1
- sys.stderr.write("%s: ERROR: Unable to fetch %s: %s" %
+ warnings += 1
+ sys.stderr.write("%s: WARN: Unable to fetch %s: %s" %
(prog, link, str(e)))
- return errors
+ return warnings
# Main
colormaps = {}
@@ -205,7 +205,7 @@ for entry in entries:
total_warning_count += warning_count
total_layer_count += layer_count
-total_error_count += fetch_colormaps(colormaps)
+total_warning_count += fetch_colormaps(colormaps)
print "%s: %d error(s), %d warning(s), %d layers" % (prog, total_error_count,
total_warning_count, total_layer_count)
diff --git a/src/css/wv.debug.css b/src/css/wv.debug.css
index 93ef1fe9a..a4a42cf1c 100644
--- a/src/css/wv.debug.css
+++ b/src/css/wv.debug.css
@@ -12,7 +12,7 @@
#wv-debug-gibs {
position: absolute;
top: 0px;
- right: 200px;
+ left: 200px;
height: 45px;
width: 525px;
background-color: white;
diff --git a/src/js/layers/wv.layers.model.js b/src/js/layers/wv.layers.model.js
index 20791fa0c..184f445c4 100644
--- a/src/js/layers/wv.layers.model.js
+++ b/src/js/layers/wv.layers.model.js
@@ -87,7 +87,10 @@ wv.layers.model = wv.layers.model || function(models, config) {
var projId = spec.projId || models.proj.selected.id;
var layers = ( spec.layer ) ? [_.find(self.active, {id: spec.layer})]
: self.active;
- if ( config.parameters && config.parameters.debugGIBS ) {
+ var ignoreRange =
+ config.parameters &&
+ ( config.parameters.debugGIBS || config.parameters.ignoreDateRange );
+ if ( ignoreRange ) {
return {
start: new Date(Date.UTC(1970, 0, 1)),
end: wv.util.today()
diff --git a/src/js/wv.debug.js b/src/js/wv.debug.js
index 707bac2cc..5f08404c7 100644
--- a/src/js/wv.debug.js
+++ b/src/js/wv.debug.js
@@ -218,7 +218,7 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {
}
});
models.layers.clear();
- if ( type !== "gibs" ) {
+ if ( type !== "gibs" && config.layers.Land_Water_map ) {
models.layers.add("Land_Water_Map");
}
updateLayers.apply($select);
@@ -238,7 +238,7 @@ wv.debug.layers = wv.debug.layers || function(ui, models, config) {
models.layers.add(layerId);
if ( type !== "gibs" ) {
var range = models.layers.dateRange();
- if ( range ) {
+ if ( range && (config.parameters && !config.parameters.ignoreRange) ) {
range.end.setUTCDate(range.end.getUTCDate() - 1);
models.date.select(range.end);
}
diff --git a/src/js/wv.main.js b/src/js/wv.main.js
index d799f6b84..e153d0763 100644
--- a/src/js/wv.main.js
+++ b/src/js/wv.main.js
@@ -92,11 +92,16 @@ $(function() {
elapsed("init");
// If at the beginning of the day, wait on the previous day until GIBS
// catches up (about three hours)
- var initialDate = wv.util.now();
- if ( initialDate.getUTCHours() < 3 ) {
- initialDate.setUTCDate(initialDate.getUTCDate() - 1);
+ var initialDate;
+ if ( config.defaults.startDate ) {
+ initialDate = wv.util.parseDateUTC(config.defaults.startDate);
+ } else {
+ initialDate = wv.util.now();
+ if ( initialDate.getUTCHours() < 3 ) {
+ initialDate.setUTCDate(initialDate.getUTCDate() - 1);
+ }
}
-
+
// Models
var models = {
wv: {