Interactive interface for browsing global, full-resolution satellite imagery
Validation step now in configuration build chain. Finished initial colormap work
Mike McGann80984c69fdf5
diff --git a/Gruntfile.js b/Gruntfile.jsindex 9bae97aea..2fb6d3723 100644--- a/Gruntfile.js+++ b/Gruntfile.js@@ -21,11 +21,17 @@ var buildNonce = moment.utc().format("YYYYMMDDHHmmssSSS");var buildNumber = ( process.env.BUILD_NUMBER )? "." + process.env.BUILD_NUMBER : "";-var brand = "default";-var opt = {};-module.exports = function(grunt) {+ var info = grunt.file.readJSON("package.json");+ var opt = grunt.file.readJSON("options/brand.json");+ var features = grunt.file.readJSON("options/features.json").features;++ console.log("");+ console.log("[" + opt.packageName + "] " + opt.officialName ++ ", Version " + info.version + "-" + info.release);+ console.log("");+// Lists of JavaScript and CSS files to include and in the correct// ordervar wvJs = grunt.file.readJSON("etc/deploy/wv.js.json");@@ -36,6 +42,11 @@ module.exports = function(grunt) {var banner = grunt.file.read("etc/deploy/banner.txt");grunt.initConfig({++ pkg: opt.packageName,+ opt: opt,+ features: features,+"git-rev-parse": {build: {options: {@@ -46,13 +57,6 @@ module.exports = function(grunt) {},copy: {- brand: {- files: [- { expand: true, cwd: "etc/brand.<%=brand%>",- src: ["**"], dest: "." }- ]- },-// Copies the source files to the build directorysource: {files: [@@ -66,6 +70,15 @@ module.exports = function(grunt) {]},+ config_src: {+ files: [+ { expand: true, cwd: "build/options/config",+ src: ["**"], dest: "src/config" },+ { expand: true, cwd: "build/options/brand",+ src: ["**"], dest: "src/brand" }+ ]+ },+// Copies the finished version of the debugging web root to// create a release web root. JavaScript and CSS files are omitted// since the concatenated version is used instead. Files that@@ -74,7 +87,7 @@ module.exports = function(grunt) {release: {files: [{ expand: true, cwd: "build/<%=pkg%>-debug",- src: ["**", "**/.htaccess"],+ src: ["**", "**/.htaccess"],dest: "build/<%=pkg%>" },{ expand: true, cwd: "build/<%=pkg%>-debug/web",src: [@@ -127,11 +140,7 @@ module.exports = function(grunt) {exec: {config: {- command: "PATH=python/bin:${PATH} bin/make-conf"- },-- update_gc: {- command: "bin/fetch-gibs"+ command: "PATH=python/bin:${PATH} bin/wv-options-build"},// After removing JavaScript and CSS files that are no longer@@ -371,19 +380,6 @@ module.exports = function(grunt) {}},- yuidoc: {- main: {- name: "<%=opt.officialName%>",- description: "<%=opt.description%>",- version: "<%=opt.version%>",- url: "<%=opt.url%>",- options: {- paths: ["src/js"],- outdir: "build/<%=pkg%>-doc"- }- }- },-jshint: {console: ["src/js/**/wv.*.js",@@ -435,8 +431,8 @@ module.exports = function(grunt) {"!build/<%=pkg%>-debug/web/js/map/wv.map.tileworker.js","!build/<%=pkg%>-debug/web/ext/**/*"],- conf_src: [- "src/conf/**/*"+ config_src: [+ "src/config/**/*"],dist_tar: ["dist/*.tar.bz2"],dist_rpm: ["dist/*.rpm"],@@ -447,42 +443,6 @@ module.exports = function(grunt) {});- grunt.registerTask("brand_select", "Selecting brand", function() {- if ( fs.existsSync("brand/brand.json") ) {- brand = grunt.file.readJSON("brand/brand.json").brand || "default";- }- grunt.config("brand", brand);- });-- grunt.registerTask("brand_config", "Loading branding options", function() {- opt = grunt.file.readJSON("brand/options.json");- features =- grunt.file.readJSON("conf/web/brand/features.json").features;-- console.log();- console.log("============================================================");- console.log("[" + opt.packageName + "] " + opt.officialName +- ", Version " + opt.version + "-" + opt.release);- console.log("");- console.log("Branding : " + brand);- console.log("Long name : " + opt.longName);- console.log("Short name : " + opt.shortName);- console.log("Public GIBS : " + (!process.env.GIBS_HOST));- console.log("URL shortening : " + features.urlShortening);- console.log("Data download : " + features.dataDownload);- console.log("Support email : " + opt.email);-- if ( brand !== "worldview" ) {- console.error();- grunt.log.error("Using custom branding");- }- console.log("============================================================");- console.log();-- grunt.config("opt", opt);- grunt.config("pkg", opt.packageName);- });-grunt.file.mkdir("build/rpmbuild");grunt.file.mkdir("dist");@@ -495,7 +455,6 @@ module.exports = function(grunt) {grunt.loadNpmTasks("grunt-contrib-cssmin");grunt.loadNpmTasks("grunt-contrib-jshint");grunt.loadNpmTasks("grunt-contrib-uglify");- grunt.loadNpmTasks("grunt-contrib-yuidoc");grunt.loadNpmTasks("grunt-line-remover");grunt.loadNpmTasks("grunt-exec");grunt.loadNpmTasks("grunt-git-rev-parse");@@ -508,9 +467,9 @@ module.exports = function(grunt) {grunt.registerTask("config", ["clean",- "remove:conf_src",- "exec:update_gc",- "exec:config"+ "remove:config_src",+ "exec:config",+ "copy:config_src"]);grunt.registerTask("feature_shorten", "URL Shortening", function() {@@ -530,7 +489,6 @@ module.exports = function(grunt) {});grunt.registerTask("build", [- "brand","config","copy:source","concat",@@ -571,7 +529,6 @@ module.exports = function(grunt) {"rename:apache"]);- grunt.registerTask("brand", ["brand_select", "copy:brand", "brand_config"]);grunt.registerTask("doc", ["yuidoc"]);grunt.registerTask("lint", ["jshint:console"]);grunt.registerTask("test", ["buster:console"]);diff --git a/bin/act2wv b/bin/act2wvindex 0eaa8f376..4a9cf3661 100755--- a/bin/act2wv+++ b/bin/act2wv@@ -1,11 +1,11 @@#!/usr/bin/env python## NASA Worldview-#+## This code was originally developed at NASA/Goddard Space Flight Center for-# the Earth Science Data and Information System (ESDIS) project.+# the Earth Science Data and Information System (ESDIS) project.#-# Copyright (C) 2013 United States Government as represented by the+# Copyright (C) 2013 United States Government as represented by the# Administrator of the National Aeronautics and Space Administration.# All Rights Reserved.#@@ -21,7 +21,7 @@ help_description = """\Using a json index file, this converts ACT (Adobe Color Table) files intopaletttes suitable for Worldview. Each color table is written out toa separate file.-"""+"""default_index = os.path.join(basedir, "act", "index.json")default_act_dir = os.path.join(basedir, "act")@@ -73,8 +73,8 @@ except Exception as e:sys.stderr.write("%s: Unable to load index %s\n%s" % (prog, options.index,str(e)))sys.exit(1)--return_code = 0++return_code = 0for act in index:act_file = os.path.join(options.act_dir, act["input"])notify("Reading ACT: %s" % act_file)@@ -82,7 +82,7 @@ for act in index:with open(act_file) as fp:data = fp.read()except Exception as e:- sys.stderr.write("%s: Unable to load %s\n%s" % (prog, act_file,+ sys.stderr.write("%s: Unable to load %s\n%s" % (prog, act_file,str(e)))return_code = 1stops = []@@ -105,9 +105,8 @@ for act in index:palette_file = os.path.join(output_dir, "%s.json" % act["id"])notify("Writing palette: %s" % palette_file)with open(palette_file, "w") as fp:- json.dump(palette, fp, sort_keys=True, indent=4,+ json.dump(palette, fp, sort_keys=True, indent=4,separators=(',', ': '))sys.exit(return_code)-diff --git a/bin/eventsGeoRssParser.py b/bin/eventsGeoRssParser.pyindex 7de74f293..cd7390c46 100755--- a/bin/eventsGeoRssParser.py+++ b/bin/eventsGeoRssParser.py@@ -15,11 +15,11 @@ baseDir = os.path.join(os.path.dirname(__file__), '..')parser = OptionParser()parser.add_option("-d", "--development", action="store_true",help="Use the source tree instead of the system directories")-parser.add_option("-f", "--feed",+parser.add_option("-f", "--feed",help="Use file as feed instead of Earth Observatory")(options, args) = parser.parse_args()--mockFeed = None++mockFeed = NoneimgURI = "var/images"if options.feed:# Read in the entire feed before changing directories@@ -97,7 +97,7 @@ def extractKmz(zipname):os.makedirs(f)else:z.extract(f)- return f+ return fexcept BadZipfile as e:errorLog.error('(extractKmz) Bad Zipfile: %s', zipname)return None@@ -133,7 +133,7 @@ def download(url, fileName=None):fileName = fileName or getFileName(url, r)with open(fileName, 'wb') as f:shutil.copyfileobj(r,f)-+finally:r.close()@@ -174,7 +174,7 @@ def processEntry(entry):south = ""east = ""west = ""-+# check for KMZkmzLink = findKmz(content)kmzSuccess = True@@ -198,7 +198,7 @@ def processEntry(entry):os.removedirs(kmlDir)except OSError as e:errorLog.error('(processEntry) %s: %s', e.strerror, e.filename)-+else:kmzSuccess = False@@ -233,7 +233,7 @@ def processEntry(entry):else:coords = False-+# if the entry is kept, parse the rest of the fieldsdate = entry["date"].split("T")[0]title = entry["title"]@@ -264,20 +264,20 @@ def processEntry(entry):if category == 'Fires':if lowerContent.count('red outlines') > 0:keyword = 'outlines'-- retobj = {- 'title':title,- 'date':date,- 'description':description,- 'category':category,- 'satellite':sat,- 'instrument':instrument,- 'thumbnail':worldviewThumbnailURI,- 'link':story,- 'north':north,- 'south':south,- 'east':east,- 'west':west,++ retobj = {+ 'title':title,+ 'date':date,+ 'description':description,+ 'category':category,+ 'satellite':sat,+ 'instrument':instrument,+ 'thumbnail':worldviewThumbnailURI,+ 'link':story,+ 'north':north,+ 'south':south,+ 'east':east,+ 'west':west,'keyword':keyword,'pubDate':pubData,'point':point,@@ -307,10 +307,10 @@ def main():else:last_len = len(entries) * -1recent_entries = data[last_len:]-+for r in recent_entries:recent_titles.append(r["title"])-+except ValueError:pass@@ -326,7 +326,7 @@ def main():num = num + 1else:debugLog.debug("already seen: %s" % obj["title"])-+outfile.seek(0)if len(data) < 100:json.dump(data, outfile)diff --git a/bin/wv-options-build b/bin/wv-options-buildindex 47d59c967..80cd62f16 100755--- a/bin/wv-options-build+++ b/bin/wv-options-build@@ -10,8 +10,6 @@# All Rights Reserved.#-set -e-PROG=$(basename "$0")BASE=$(dirname "$0")/..@@ -45,8 +43,8 @@ if [ -e "$BUILD_DIR/config.json" ] ; thenfiif [ -e "$BUILD_DIR/colormaps" ] ; thenmkdir -p "$BUILD_DIR"/config/palettes- find "$BUILD_DIR"/colormaps -type f -exec "$BIN_DIR/wv-options-colormap" \- {} "$BUILD_DIR/config/palettes" \;+ "$BIN_DIR/wv-options-colormap" "$BUILD_DIR/colormaps" \+ "$BUILD_DIR/config/palettes"ficonfigs=$(ls "$BUILD_DIR/config")@@ -61,3 +59,7 @@ for config in $configs; do;;esacdone++cp -r "$BUILD_DIR/brand" "$DEST_DIR"++"$BIN_DIR"/wv-options-validate "$DEST_DIR/config"diff --git a/bin/wv-options-colormap b/bin/wv-options-colormapindex b426dd860..af803bc73 100755--- a/bin/wv-options-colormap+++ b/bin/wv-options-colormap@@ -12,6 +12,7 @@from optparse import OptionParserimport os+import reimport sysimport jsonimport xmltodict@@ -23,7 +24,7 @@ help_description = """\Converts colormaps to JSON files"""-parser = OptionParser(usage="Usage: %s <input_file> <output_dir>" % prog,+parser = OptionParser(usage="Usage: %s <input_dir> <output_dir>" % prog,version="%s version %s" % (prog, version),epilog=help_description)@@ -31,37 +32,93 @@ parser = OptionParser(usage="Usage: %s <input_file> <output_dir>" % prog,if len(args) != 2:parser.error("Invalid number of arguments")-input_file = args[0]+input_dir = args[0]output_dir = args[1]-with open(input_file) as fp:- xml = fp.read()-colormap = xmltodict.parse(xml)--colors = []-labels = []-values = []-for entry in colormap["ColorMap"]["ColorMapEntry"]:- r,g,b = entry["@rgb"].split(",")- a = 0 if entry["@transparent"] == "true" else 255- color = "{0:02x}{1:02x}{2:02x}{3:02x}".format(int(r), int(g), int(b), a)- value = entry["@value"] if "@value" in entry else ""- colors += [color]- labels += [entry["@label"]]- values += [value]--id = os.path.splitext(os.path.basename(input_file))[0]-data = {- "colors": colors,- "labels": labels,- "values": values,- "id": id-}--json_options = {}-json_options["indent"] = 4-json_options["separators"] = (',', ': ')--output_file = os.path.join(output_dir, id + ".json")-with open(output_file, "w") as fp:- json.dump(data, fp, **json_options)+def process_file(file):+ input_file = os.path.join(root, file)+ with open(input_file) as fp:+ xml = fp.read()+ colormap = xmltodict.parse(xml)++ scaleColors = []+ scaleLabels = []+ scaleValues = []+ classColors = []+ classLabels = []+ specialColors = []+ specialLabels = []+ units = None+ minValue = float("inf")+ maxValue = float("-inf")++ entries = colormap["ColorMap"]["ColorMapEntry"]+ if not isinstance(entries, list):+ entries = [entries]++ for entry in entries:+ r,g,b = entry["@rgb"].split(",")+ a = 0 if entry["@transparent"] == "true" else 255+ color = "{0:02x}{1:02x}{2:02x}{3:02x}".format(int(r), int(g), int(b), a)+ label = entry["@label"]+ if "@value" in entry:+ items = re.sub(r"[\(\)\[\]]", "", entry["@value"]).split(",")+ try:+ scaleValues += [map(lambda v: float(v), items)]+ except ValueError as e:+ raise ValueError("Invalid value: %s" % entry["@value"])+ scaleColors += [color]+ scaleLabels += [label]+ elif a == 0:+ specialColors += [color]+ specialLabels += [label]+ else:+ classColors += [color]+ classLabels += [label]++ id = os.path.splitext(os.path.basename(input_file))[0]+ data = {}+ if len(scaleColors) > 0:+ data["scale"] = {+ "colors": scaleColors,+ "values": scaleValues,+ "labels": scaleLabels,+ }+ if len(specialColors) > 0:+ data["special"] = {+ "colors": specialColors,+ "labels": specialLabels+ }+ if len(classColors) > 0:+ data["classes"] = {+ "colors": classColors,+ "labels": classLabels,+ }++ data["id"] = id++ json_options = {}+ json_options["indent"] = 4+ json_options["separators"] = (',', ': ')++ output_file = os.path.join(output_dir, id + ".json")+ with open(output_file, "w") as fp:+ json.dump(data, fp, **json_options)++# Main+file_count = 0+error_count = 0++for root, dirs, files in os.walk(input_dir):+ for file in files:+ try:+ file_count += 1+ process_file(file)+ except Exception as e:+ sys.stderr.write("%s: ERROR: [%s] %s\n" % (prog, file, str(e)))+ error_count += 1++print "%s: %d error(s), %d file(s)" % (prog, error_count, file_count)++if error_count > 0:+ sys.exit(1)diff --git a/bin/wv-options-fetch b/bin/wv-options-fetchindex 785a09476..2e76ff093 100755--- a/bin/wv-options-fetch+++ b/bin/wv-options-fetch@@ -39,12 +39,27 @@ os.makedirs(output_dir)with open(config_file) as fp:config = json.load(fp)+def process_remote(entry):+ url = entry["from"]+ print "%s: %s" % (prog, url)+ response = urllib.urlopen(url)+ contents = response.read()+ output_file = os.path.join(output_dir, entry["to"])+ with open(output_file, "w") as fp:+ fp.write(contents)++remote_count = 0+error_count = 0if "wv-options-fetch" in config:for entry in config["wv-options-fetch"]:- url = entry["from"]- print "%s: %s" % (prog, url)- response = urllib.urlopen(url)- contents = response.read()- output_file = os.path.join(output_dir, entry["to"])- with open(output_file, "w") as fp:- fp.write(contents)+ try:+ remote_count += 1+ process_remote(entry)+ except Exception as e:+ error_count += 1+ sys.stderr.write("%s: ERROR: %s\n" % (prog, str(e)))++print "%s: %d error(s), %d remote(s)" % (prog, error_count, remote_count)++if error_count > 0:+ sys.exit(1)diff --git a/bin/wv-options-merge b/bin/wv-options-mergeindex 409076eec..7e8fd9a5b 100755--- a/bin/wv-options-merge+++ b/bin/wv-options-merge@@ -57,9 +57,11 @@ input_dir = args[0]output_file = args[1]conf = {}+file_count = 0for root, dirs, files in os.walk(input_dir):for file in files:try:+ file_count += 1with open(os.path.join(root, file)) as fp:data = json.load(fp)dict_merge(conf, data)@@ -74,3 +76,6 @@ json_options["separators"] = (',', ': ')with open(output_file, "w") as fp:json.dump(conf, fp, **json_options)++print "%s: %s file(s) merged into %s" % (prog, file_count,+ os.path.basename(output_file))diff --git a/bin/wv-options-validate b/bin/wv-options-validatenew file mode 100755index 000000000..683bc3c40--- /dev/null+++ b/bin/wv-options-validate@@ -0,0 +1,75 @@+#!/usr/bin/env python+#+# NASA Worldview+#+# This code was originally developed at NASA/Goddard Space Flight Center for+# the Earth Science Data and Information System (ESDIS) project.+#+# Copyright (C) 2013 - 2014 United States Government as represented by the+# Administrator of the National Aeronautics and Space Administration.+# All Rights Reserved.+#++from datetime import datetime, date, timedelta+import json+from optparse import OptionParser+import os+import sys++prog = os.path.basename(__file__)+base_dir = os.path.join(os.path.dirname(__file__), "..")+version = "1.0.0"+help_description = """\+Validates and corrects the configuration files.+"""++parser = OptionParser(usage="Usage: %s <config_dir>" % prog,+ version="%s version %s" % (prog, version),+ epilog=help_description)+(options, args) = parser.parse_args()++if len(args) != 1:+ parser.error("Invalid number of arguments")++config_dir = args[0]++error_count = 0+warning_count = 0++def error(message):+ global error_count+ sys.stderr.write("%s: ERROR: %s\n" % (prog, message))+ error_count += 1++def warn(message):+ global warning_count+ sys.stderr.write("%s: WARN: %s\n" % (prog, message))+ warning_count += 1+++main_config_file = os.path.join(config_dir, "wv.json")+with open(main_config_file) as fp:+ wv = json.load(fp)++for layer_id in wv["layers"].keys():+ layer = wv["layers"][layer_id]+ if len(layer["projections"]) == 0:+ warn("[%s] No projections defined or not found in GC documents" %+ layer_id)+ if layer_id not in wv["layerOrder"]:+ warn("[%s] Unexpected layer" % layer_id)+ del wv["layers"][layer_id]+ if "palette" in layer:+ palette_id = layer["palette"]["id"]+ if not os.path.exists(os.path.join(config_dir, "palettes",+ palette_id + ".json")):+ error("[%s] Unknown palette: %s" % (layer_id, palette_id))++print "%s: %d error(s), %d warning(s)" % (prog, error_count, warning_count)++json_options = {}+json_options["indent"] = 4+json_options["separators"] = (',', ': ')++with open(main_config_file, "w") as fp:+ json.dump(wv, fp)diff --git a/bin/wv-options-wmts b/bin/wv-options-wmtsindex 58faa7128..219881954 100755--- a/bin/wv-options-wmts+++ b/bin/wv-options-wmts@@ -17,14 +17,6 @@ import osimport sysimport xmltodict-SKIP_LAYERS = [- "Sea_Surface_Temp_Microwave",- "Sea_Surface_Temp_Blended",- "arctic_graticule_3413_reverb",- "blue_marble_arctic",- "OMI_SO2_Planetary_Boundary_Layer",-]-prog = os.path.basename(__file__)base_dir = os.path.join(os.path.dirname(__file__), "..")version = "2.0.0"@@ -58,7 +50,56 @@ skip = []if "skip" in config:skip = config["skip"]-for entry in entries:+total_layer_count = 0+total_warning_count = 0+total_error_count = 0++class SkipException(Exception):+ pass++def process_layer(gc_layer, wv_layers):+ id = gc_layer["ows:Identifier"]+ if id in skip:+ raise SkipException(id)++ wv_layers[id] = {}+ wv_layer = wv_layers[id]++ wv_layer["id"] = id+ wv_layer["type"] = "wmts"+ wv_layer["format"] = gc_layer["Format"]++ # Extract start and end dates+ if "Dimension" in gc_layer:+ dimension = gc_layer["Dimension"]+ if dimension["ows:Identifier"] == "time":+ try:+ wv_layer["period"] = "daily"+ values = dimension["Value"].split("/")++ # Layer is still actively being produced if the end date+ # greater than yesterday+ end_date = datetime.strptime(values[1], "%Y-%m-%d")+ yesterday = datetime.now() - timedelta(days=1)+ wv_layer["startDate"] = values[0]+ if end_date < yesterday:+ wv_layer["endDate"] = values[1]+ except ValueError:+ raise Exception("Invalid time: {0}".format(values))++ # Extract matrix set+ matrixSet = gc_layer["TileMatrixSetLink"]["TileMatrixSet"]+ wv_layer["projections"] = {+ entry["projection"]: {+ "source": entry["source"],+ "matrixSet": matrixSet+ }+ }++def process_entry(entry):+ layer_count = 0+ warning_count = 0+ error_count = 0wv = {"layers": {},"sources": {}@@ -78,42 +119,15 @@ for entry in entries:for gc_layer in gc_contents["Layer"]:id = gc_layer["ows:Identifier"]- if id in skip:- print "%s: Skipping layer: %s" % (prog, id)- continue- wv_layers[id] = {}- wv_layer = wv_layers[id]-- wv_layer["id"] = id- wv_layer["type"] = "wmts"- wv_layer["format"] = gc_layer["Format"]-- # Extract start and end dates- if "Dimension" in gc_layer:- dimension = gc_layer["Dimension"]- if dimension["ows:Identifier"] == "time":- try:- wv_layer["period"] = "daily"- values = dimension["Value"].split("/")-- # Layer is still actively being produced if the end date- # greater than yesterday- end_date = datetime.strptime(values[1], "%Y-%m-%d")- yesterday = datetime.now() - timedelta(days=1)- wv_layer["startDate"] = values[0]- if end_date < yesterday:- wv_layer["endDate"] = values[1]- except ValueError:- raise Exception("Invalid time: {0}".format(values))-- # Extract matrix set- matrixSet = gc_layer["TileMatrixSetLink"]["TileMatrixSet"]- wv_layer["projections"] = {- entry["projection"]: {- "source": entry["source"],- "matrixSet": matrixSet- }- }+ try:+ layer_count += 1+ process_layer(gc_layer, wv_layers)+ except SkipException as se:+ warning_count += 1+ sys.stderr.write("%s: WARNING: [%s] Skipping\n" % (prog, id))+ except Exception as e:+ error_count += 1+ sys.stderr.write("%s: ERROR: [%s] %s\n" % (prog, id, str(e)))for gc_matrix_set in gc_contents["TileMatrixSet"]:id = gc_matrix_set["ows:Identifier"]@@ -139,3 +153,20 @@ for entry in entries:output_file = os.path.join(output_dir, entry["to"])with open(output_file, "w") as fp:json.dump(wv, fp, **json_options)++ print "%s: %d error(s), %d warning(s), %d layers for %s" % (prog,+ error_count, warning_count, layer_count, entry["source"])+ return [error_count, warning_count, layer_count]++# Main+for entry in entries:+ error_count, warning_count, layer_count = process_entry(entry)+ total_error_count += error_count+ total_warning_count += warning_count+ total_layer_count += layer_count++print "%s: %d error(s), %d warning(s), %d layers" % (prog, total_error_count,+ total_warning_count, total_layer_count)++if total_error_count > 0:+ sys.exit(1)diff --git a/package.json b/package.jsonindex 8bba132fc..4d9847959 100644--- a/package.json+++ b/package.json@@ -1,4 +1,6 @@{+ "version": "0.7.0",+ "release": 1,"repository": {"type": "git","url": "https://github.com/nasa-gibs/worldview.git"@@ -18,7 +20,6 @@"grunt-contrib-cssmin": "0.7.x","grunt-contrib-jshint": "0.8.x","grunt-contrib-uglify": "0.2.x",- "grunt-contrib-yuidoc": "0.4.x","grunt-exec": "0.4.x","grunt-git-rev-parse": "0.1.x","grunt-line-remover": "0.0.x",@@ -27,7 +28,6 @@"grunt-text-replace": "0.3.x","phantomjs": "1.9.x","jshint": "2.3.x",- "moment": "2.4.x",- "yuidocjs": "0.3.x"+ "moment": "2.4.x"}}diff --git a/src/conf/.gitignore b/src/brand/.gitignoresimilarity index 100%rename from src/conf/.gitignorerename to src/brand/.gitignorediff --git a/src/conf/.htaccess b/src/brand/.htaccesssimilarity index 100%rename from src/conf/.htaccessrename to src/brand/.htaccessdiff --git a/src/config/.gitignore b/src/config/.gitignorenew file mode 100644index 000000000..e24a60fae--- /dev/null+++ b/src/config/.gitignore@@ -0,0 +1,3 @@+*+!.gitignore+!.htaccessdiff --git a/src/config/.htaccess b/src/config/.htaccessnew file mode 100644index 000000000..aa4902dec--- /dev/null+++ b/src/config/.htaccess@@ -0,0 +1,9 @@+ExpiresActive On+ExpiresDefault A0+Header set Cache-Control "no-cache, must-revalidate, public"+Header set Pragma "no-cache"+++++diff --git a/src/css/wv.main.css b/src/css/wv.main.cssindex 9d9cbabee..b0dbd086f 100644--- a/src/css/wv.main.css+++ b/src/css/wv.main.css@@ -128,7 +128,7 @@ div.horizontalContainer {width:100%; display:block; float:left; position:absolu}#wv-logo {- background: url('../images/brand/wv-logo.png?v=@BUILD_NONCE@') no-repeat center;+ background: url('../brand/images/wv-logo.png?v=@BUILD_NONCE@') no-repeat center;width: 247px;height: 45px;display: inline-block;diff --git a/src/js/layers/wv.layers.add.js b/src/js/layers/wv.layers.add.jsindex a5866c9a8..aedfa12e8 100644--- a/src/js/layers/wv.layers.add.js+++ b/src/js/layers/wv.layers.add.js@@ -112,10 +112,13 @@ wv.layers.add = wv.layers.add || function(models, ui, config) {.addClass("category").addClass("scroll-pane");- $.each(config.layerOrder[group], function(index, layerId) {- renderLayer($element, group, layerId);+ _.each(config.layerOrder, function(layerId) {+ var layer = config.layers[layerId];+ if ( layer.group === group ) {+ renderLayer($element, group, layerId);+ }});-+$container.append($header);$container.append($element);diff --git a/src/js/layers/wv.layers.js b/src/js/layers/wv.layers.jsindex ad13afb37..48b999719 100644--- a/src/js/layers/wv.layers.js+++ b/src/js/layers/wv.layers.js@@ -74,9 +74,7 @@ wv.layers = (function(self) {}});- var orders =- _.cloneDeep(config.layerOrder.baselayers).concat(- _.cloneDeep(config.layerOrder.overlays));+ var orders = _.cloneDeep(config.layerOrder);_.each(orders, function(layerId) {if ( !config.layers[layerId] ) {error(layerId, "No configuration");diff --git a/src/js/map/wv.map.ui.js b/src/js/map/wv.map.ui.jsindex 628cfb655..e7fdf5d32 100644--- a/src/js/map/wv.map.ui.js+++ b/src/js/map/wv.map.ui.js@@ -160,9 +160,14 @@ wv.map.ui = wv.map.ui || function(models, config) {if ( !layer.wvid ) {return;}+ var renderable, key;var def = _.find(models.layers.active, { id: layer.wvid });- var key = layerKey(def);- var renderable = models.layers.isRenderable(def.id);+ if ( !def ) {+ renderable = false;+ } else {+ var key = layerKey(def);+ var renderable = models.layers.isRenderable(def.id);+ }if ( layer.key !== key || !renderable ) {layer.setOpacity(0);layer.div.style.zIndex = 0;@@ -276,8 +281,8 @@ wv.map.ui = wv.map.ui || function(models, config) {var createLayerWMTS = function(def) {var proj = models.proj.selected;- var matrixSet = config.matrixSets[def.projections[proj.id].matrixSet];var source = config.sources[def.projections[proj.id].source];+ var matrixSet = source.matrixSets[def.projections[proj.id].matrixSet];var param = {url: source.url,layer: def.id,diff --git a/src/js/palettes/wv.palettes.js b/src/js/palettes/wv.palettes.jsindex dcc1b4060..f6c9af8c3 100644--- a/src/js/palettes/wv.palettes.js+++ b/src/js/palettes/wv.palettes.js@@ -113,13 +113,13 @@ wv.palettes = (function(self) {};self.loadCustom = function(config) {- return wv.util.load(config.palettes, "custom", "conf/palettes.json");+ return wv.util.load(config.palettes, "custom", "config/palettes.json");};self.loadRendered = function(config, layerId) {var layer = config.layers[layerId];return wv.util.load(config.palettes.rendered, layer.palette.id,- "conf/palettes/" + layer.palette.id + ".json");+ "config/palettes/" + layer.palette.id + ".json");};self.parse = function(state, errors, config) {diff --git a/src/js/palettes/wv.palettes.legend.js b/src/js/palettes/wv.palettes.legend.jsindex 59c26f9c5..0c1eccef8 100644--- a/src/js/palettes/wv.palettes.legend.js+++ b/src/js/palettes/wv.palettes.legend.js@@ -147,4 +147,3 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {init();return self;};-diff --git a/src/js/ui/wv.ui.info.js b/src/js/ui/wv.ui.info.jsindex cb18511e4..f012a06b5 100644--- a/src/js/ui/wv.ui.info.js+++ b/src/js/ui/wv.ui.info.js@@ -49,7 +49,7 @@ wv.ui.info = wv.ui.info || (function(ui) {$about.click(function() {if ( wv.util.browser.small ) {- window.open("pages/brand/about.html?v=@BUILD_NONCE@", "_blank");+ window.open("brand/pages/about.html?v=@BUILD_NONCE@", "_blank");} else {wv.ui.getDialog().dialog({title: "About",@@ -57,13 +57,13 @@ wv.ui.info = wv.ui.info || (function(ui) {height: 525,show: { effect: "fade" },hide: { effect: "fade" }- }).load("pages/brand/about.html?v=@BUILD_NONCE@ #page");+ }).load("brand/pages/about.html?v=@BUILD_NONCE@ #page");}});$new.click(function() {if ( wv.util.browser.small ) {- window.open("pages/brand/new.html?v=@BUILD_NONCE@", "_blank");+ window.open("brand/pages/new.html?v=@BUILD_NONCE@", "_blank");} else {wv.ui.getDialog().dialog({title: "What's New",@@ -71,7 +71,7 @@ wv.ui.info = wv.ui.info || (function(ui) {height: 525,show: { effect: "fade" },hide: { effect: "fade" }- }).load("pages/brand/new.html?v=@BUILD_NONCE@ #page");+ }).load("brand/pages/new.html?v=@BUILD_NONCE@ #page");}});@@ -93,4 +93,3 @@ wv.ui.info = wv.ui.info || (function(ui) {});});-diff --git a/src/js/ui/wv.ui.js b/src/js/ui/wv.ui.jsindex 29b066de4..8c6462354 100644--- a/src/js/ui/wv.ui.js+++ b/src/js/ui/wv.ui.js@@ -188,4 +188,4 @@ wv.ui = (function(self) {return self;-})(wv.ui = wv.ui || {});\ No newline at end of file+})(wv.ui = wv.ui || {});diff --git a/src/js/wv.main.js b/src/js/wv.main.jsindex b8f978811..e476b0a33 100644--- a/src/js/wv.main.js+++ b/src/js/wv.main.js@@ -17,7 +17,7 @@ $(function() {var errors = [];var main = function() {- var configURI = wv.brand.url("conf/wv.json");+ var configURI = wv.brand.url("config/wv.json");var promise = ( parameters.loadDelay ) ?wv.debug.loadDelay(configURI, parameters) :$.getJSON(configURI);