Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Updating scripts to support multiple colormap hrefs

Matthew Cechini8b0e0e901993
diff --git a/bin/wv-options-fetch b/bin/wv-options-fetch
index 89d6cf8bb..d2ae4283f 100755
--- a/bin/wv-options-fetch
+++ b/bin/wv-options-fetch
@@ -66,10 +66,12 @@ def process_remote(entry):
global warning_count
warning_count += 1
else:
- 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 item in layer["ows:Metadata"]:
+ if item["@xlink:role"] == "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]
+ colormaps[colormap_id] = colormap_link
def process_colormaps():
print "%s: Fetching %d colormaps" % (prog, len(colormaps))
@@ -88,6 +90,7 @@ def process_colormaps():
(prog, link, str(e)))
global warning_count
warning_count += 1
+ print "%s: Fetching2 %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 565d68ba3..f35a53953 100755
--- a/bin/wv-options-wmts
+++ b/bin/wv-options-wmts
@@ -118,13 +118,15 @@ def process_layer(gc_layer, wv_layers, colormaps):
global total_warning_count
total_warning_count += 1
else:
- # FIXME: Assumes that there is only one metdata element
- 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
- }
+ for item in gc_layer["ows:Metadata"]:
+ if item["@xlink:role"] == "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