From 16e5d19f881bc551ce41b8c9d782e448ce5ac8a5 Mon Sep 17 00:00:00 2001
From: David Hoese <david.hoese@ssec.wisc.edu>
Date: Tue, 21 Jan 2020 12:04:41 -0600
Subject: [PATCH] Fix consistency in tile generation file naming

---
 mapserver/mapfiles/g16_abi_fldk_l1b.map    | 106 +++++++++++++++++++++
 mapserver/mapfiles/goes16_abi_fldk_l1b.map |  48 ----------
 tile_gen/generate_tiles.py                 |   2 +-
 tile_gen/run.sh                            |  10 +-
 4 files changed, 114 insertions(+), 52 deletions(-)
 create mode 100644 mapserver/mapfiles/g16_abi_fldk_l1b.map
 delete mode 100644 mapserver/mapfiles/goes16_abi_fldk_l1b.map

diff --git a/mapserver/mapfiles/g16_abi_fldk_l1b.map b/mapserver/mapfiles/g16_abi_fldk_l1b.map
new file mode 100644
index 0000000..4a6a141
--- /dev/null
+++ b/mapserver/mapfiles/g16_abi_fldk_l1b.map
@@ -0,0 +1,106 @@
+MAP
+  IMAGETYPE      PNG
+  SIZE           256 256
+  EXTENT         -180 -90 180 90
+  
+  PROJECTION
+    "init=epsg:4326"
+  END
+
+  WEB
+    METADATA
+      "wms_title" "Weather data"
+      "wms_onlineresource" "https://myhost/mapserv"
+      "wms_enable_request" "*"
+    END
+  END
+
+
+  ##############
+  # True Color #
+  ##############
+
+  LAYER
+    NAME "true_color_index"
+    TYPE TILEINDEX
+    DATA "/data/tiles/g16/abi/radf/true_color/true_color"
+  END
+
+  LAYER
+    NAME    "true_color"
+    TYPE    RASTER
+    TILEITEM "location"
+    TILEINDEX "true_color_index"
+    # Comment below to default to transparency
+    # OFFSITE 0 0 0
+    PROJECTION
+      "auto"
+    END
+    METADATA
+      "wms_title" "GOES-16 ABI True Color"
+      "wms_extent" "-180 -90 180 90"
+      "wms_timeextent" "2017-01-01/2020-12-31"
+      "wms_timeformat" "YYYY-MM-DDTHH:MM:SS"
+      "wms_timeitem" "time" # time is a metadata item
+      "wms_timedefault" "2019-12-12T19:20:18"
+      "wms_enable_request" "*"
+    END
+    FILTER (`[time]` = `2019-12-12T19:20:18`)
+  END # goes raster layer ends here
+
+  ######################
+  # True Color Lat/Lon #
+  ######################
+
+  LAYER
+    NAME "true_color_index_ll"
+    TYPE TILEINDEX
+    DATA "/data/tiles/g16/abi/radf_ll/true_color/true_color_LL"
+  END
+
+  LAYER
+    NAME    "true_color_ll"
+    TYPE    RASTER
+    TILEITEM "location"
+    TILEINDEX "true_color_index_ll"
+    # Comment below to default to transparency
+    # OFFSITE 0 0 0
+    PROJECTION
+      "init=epsg:4326"
+    END
+    METADATA
+      "wms_title" "GOES-16 ABI True Color"
+      "wms_extent" "-180 -90 180 90"
+      "wms_timeextent" "2017-01-01/2020-12-31"
+      "wms_timeformat" "YYYY-MM-DDTHH:MM:SS"
+      "wms_timeitem" "time" # time is a metadata item
+      "wms_timedefault" "2019-12-12T19:20:18"
+      "wms_enable_request" "*"
+    END
+    FILTER (`[time]` = `2019-12-12T19:20:18`)
+  END # goes raster layer ends here
+
+  ###################
+  # True Color Fake #
+  ###################
+
+  LAYER
+    NAME    "true_color_test"
+    TYPE    RASTER
+    TILEITEM "location"
+    TILEINDEX "true_color_index"
+    # Comment below to default to transparency
+    # OFFSITE 0 0 0
+    METADATA
+      "wms_title" "GOES-16 ABI True Color"
+      "wms_extent" "-180 -90 180 90"
+      "wms_timeextent" "2017-01-01/2020-12-31"
+      "wms_timeformat" "YYYY-MM-DDTHH:MM:SS"
+      "wms_timeitem" "time" # time is a metadata item
+      "wms_timedefault" "2019-12-12T19:20:18"
+      "wms_enable_request" "*"
+    END
+    FILTER (`[time]` = `2019-12-12T19:20:18`)
+  END # goes raster layer ends here
+
+END # end of map file
diff --git a/mapserver/mapfiles/goes16_abi_fldk_l1b.map b/mapserver/mapfiles/goes16_abi_fldk_l1b.map
deleted file mode 100644
index 690dfce..0000000
--- a/mapserver/mapfiles/goes16_abi_fldk_l1b.map
+++ /dev/null
@@ -1,48 +0,0 @@
-MAP
-  IMAGETYPE      PNG
-  SIZE           256 256
-  EXTENT         -180 -90 180 90
-  
-  PROJECTION
-    "init=epsg:4326"
-  END
-
-  WEB
-    METADATA
-      "wms_title" "Weather data"
-      "wms_onlineresource" "https://myhost/mapserv"
-      "wms_enable_request" "*"
-    END
-  END
-
-
-  ##############
-  # True Color #
-  ##############
-
-  LAYER
-    NAME "true_color_index"
-    TYPE TILEINDEX
-    DATA "/data/tiles/goes/g16/abi/true_color/true_color"
-  END
-
-  LAYER
-    NAME    "true_color"
-    TYPE    RASTER
-    TILEITEM "location"
-    TILEINDEX "true_color_index"
-    # Comment below to default to transparency
-    # OFFSITE 0 0 0
-    METADATA
-      "wms_title" "GOES-16 ABI True Color"
-      "wms_extent" "-180 -90 180 90"
-      "wms_timeextent" "2017-01-01/2020-12-31"
-      "wms_timeformat" "YYYY-MM-DDTHH:MM:SS"
-      "wms_timeitem" "time" # time is a metadata item
-      "wms_timedefault" "2019-12-12T19:20:18"
-      "wms_enable_request" "*"
-    END
-    FILTER (`[time]` = `2019-12-12T19:20:18`)
-  END # goes raster layer ends here
-
-END # end of map file
diff --git a/tile_gen/generate_tiles.py b/tile_gen/generate_tiles.py
index f444e31..2312f6b 100644
--- a/tile_gen/generate_tiles.py
+++ b/tile_gen/generate_tiles.py
@@ -62,7 +62,7 @@ def main():
     parser = argparse.ArgumentParser(description="Take input geotiffs and generate mapserver compatible tiles.")
     parser.add_argument('--remap', action='store_true',
                         help="Remap input geotiffs to EPSG:4326")
-    parser.add_argument('--remap-suffix', default='_LL.tif',
+    parser.add_argument('--remap-suffix', default='_ll.tif',
                         help="Replace 'tif' with provided suffix when geotiffs are remapped.")
     parser.add_argument('-p', '--products', nargs="*",
                         help="Product names to group together in each "
diff --git a/tile_gen/run.sh b/tile_gen/run.sh
index a0f987a..a7b4933 100755
--- a/tile_gen/run.sh
+++ b/tile_gen/run.sh
@@ -53,10 +53,14 @@ run_tile_gen() {
     if [[ ${TILE_ARGS} == *"--remap"* ]]; then
         echo "Adding '_ll' prefix to tile output directory because of remapping"
         out_dir="${out_dir}_ll"
+        mkdir -p ${out_dir}
+        # add string formatting portion to separate add 'product' sub-directory
+        out_dir="${out_dir}/{product}_ll"
+    else
+        mkdir -p ${out_dir}
+        # add string formatting portion to separate add 'product' sub-directory
+        out_dir="${out_dir}/{product}"
     fi
-    mkdir -p ${out_dir}
-    # add string formatting portion to separate add 'product' sub-directory
-    out_dir="${out_dir}/{product}"
     echo "Generating tiles in directory: ${out_dir}"
     python3 generate_tiles.py ${TILE_ARGS} -p ${G2G_PRODUCTS} -- ${out_dir} ${path}
     # OUT/<product>/<product>.shp
-- 
GitLab