Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Updated scripts to compile v1.2 colormaps correctly

Taylor Gunnoe367aea505ed5
diff --git a/bin/wv-options-colormap b/bin/wv-options-colormap
index 0aafa3383..476e14103 100755
--- a/bin/wv-options-colormap
+++ b/bin/wv-options-colormap
@@ -106,7 +106,6 @@ def process_file(file):
with open(input_file) as fp:
xml = fp.read()
document = xmltodict.parse(xml)
-
colormaps = to_list(document["ColorMaps"]["ColorMap"])
maps = []
for colormap in colormaps:
diff --git a/bin/wv-options-fetch b/bin/wv-options-fetch
index a27b4578f..7970d9af7 100755
--- a/bin/wv-options-fetch
+++ b/bin/wv-options-fetch
@@ -58,29 +58,30 @@ def process_remote(entry):
gc = xmltodict.parse(contents)
try:
- for layer in gc["Capabilities"]["Contents"]["Layer"]:
- ident = layer["ows:Identifier"]
- if "ows:Metadata" in layer:
- if ident in config.get("skipPalettes", []):
- sys.stderr.write("%s: WARN: Skipping palette for %s\n" %
- prog, ident)
- global warning_count
- warning_count += 1
- else:
- for item in layer["ows:Metadata"]:
- #if item != "@xlink:role":
- # continue
-
- #if layer["ows:Metadata"][item] == "http://earthdata.nasa.gov/gibs/metadata-type/colormap":
- if item["@xlink:role"] == "http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.2":
- colormap_link = item["@xlink:href"]
- #colormap_link = layer["ows:Metadata"]["@xlink:href"]
- colormap_file = os.path.basename(colormap_link)
- colormap_id = os.path.splitext(colormap_file)[0]
- colormaps[colormap_id] = colormap_link
+ for layer in gc["Capabilities"]["Contents"]["Layer"]:
+ ident = layer["ows:Identifier"]
+ if "ows:Metadata" in layer:
+ if ident in config.get("skipPalettes", []):
+ sys.stderr.write("%s: WARN: Skipping palette for %s\n" %
+ prog, ident)
+ global warning_count
+ warning_count += 1
+ else:
+ for item in layer["ows:Metadata"]:
+ print item["@xlink:role"]
+ schema_version = item["@xlink:role"]
+ #if item != "@xlink:role":
+ # continue
+ #if layer["ows:Metadata"][item] == "http://earthdata.nasa.gov/gibs/metadata-type/colormap":
+ if schema_version == "http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.2":
+ colormap_link = item["@xlink:href"]
+ #colormap_link = layer["ows:Metadata"]["@xlink:href"]
+ colormap_file = os.path.basename(colormap_link)
+ colormap_id = os.path.splitext(colormap_file)[0]
+ colormaps[colormap_id] = colormap_link
except:
- print(ident)
- print(str(traceback.format_exc()))
+ print(ident)
+ print(str(traceback.format_exc()))
def process_colormaps():
print "%s: Fetching %d colormaps" % (prog, len(colormaps))
@@ -99,7 +100,7 @@ def process_colormaps():
(prog, link, str(e)))
global warning_count
warning_count += 1
- print "%s: Fetching2 %d colormaps" % (prog, len(colormaps))
+ print "%s: Fetching %d colormaps" % (prog, len(colormaps))
tolerant = config.get("tolerant", False)
if "wv-options-fetch" in config:
diff --git a/bin/wv-options-wmts b/bin/wv-options-wmts
index 94b9d5719..35f7a4fbc 100755
--- a/bin/wv-options-wmts
+++ b/bin/wv-options-wmts
@@ -50,6 +50,7 @@ if not os.path.exists(output_dir):
entries = config["wv-options-wmts"]
skip = []
+# Looks like this is for a list of layers needed to be skipped from the GC
if "skip" in config:
skip = config["skip"]
@@ -70,6 +71,7 @@ def to_list(val):
def process_layer(gc_layer, wv_layers, colormaps):
id = gc_layer["ows:Identifier"]
if id in skip:
+ print "%s: skipping" % id
raise SkipException(id)
wv_layers[id] = {}
@@ -119,20 +121,15 @@ def process_layer(gc_layer, wv_layers, colormaps):
total_warning_count += 1
else:
for item in gc_layer["ows:Metadata"]:
-
- if item != "@xlink:role":
- continue
-
- #if item["@xlink:role"] == "http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.2":
- if gc_layer["ows:Metadata"][item] == "http://earthdata.nasa.gov/gibs/metadata-type/colormap":
- #colormap_link = item["@xlink:href"]
- colormap_link = gc_layer["ows:Metadata"]["@xlink:href"]
- colormap_file = os.path.basename(colormap_link)
- colormap_id = os.path.splitext(colormap_file)[0]
-
- wv_layer["palette"] = {
- "id": colormap_id
- }
+ schema_version = item["@xlink:role"]
+
+ if schema_version == "http://earthdata.nasa.gov/gibs/metadata-type/colormap/1.2":
+ colormap_link = item["@xlink:href"]
+ colormap_file = os.path.basename(colormap_link)
+ colormap_id = os.path.splitext(colormap_file)[0]
+ wv_layer["palette"] = {
+ "id": colormap_id
+ }
def process_entry(entry, colormaps):
layer_count = 0