Skip to content
Snippets Groups Projects
Commit 1536f6fe authored by David Hoese's avatar David Hoese
Browse files

Fix tile generation not re-using existing geotiffs

parent fbd92068
No related branches found
No related tags found
No related merge requests found
FROM tiledb/tiledb-geospatial:latest FROM tiledb/tiledb-geospatial:latest
WORKDIR /work
# TODO may need the unzip command to be installed if not already # TODO may need the unzip command to be installed if not already
RUN apt-get update && apt-get install -y unzip && \ RUN apt-get update && apt-get install -y unzip && \
wget http://ssec.wisc.edu/~rayg/pub/amqpfind.zip && \ wget http://ssec.wisc.edu/~rayg/pub/amqpfind.zip && \
......
...@@ -6,6 +6,7 @@ import warnings ...@@ -6,6 +6,7 @@ import warnings
import logging import logging
import subprocess import subprocess
import shutil import shutil
from glob import glob
import tile_index import tile_index
...@@ -67,7 +68,9 @@ def main(): ...@@ -67,7 +68,9 @@ def main():
help="Product names to group together in each " help="Product names to group together in each "
"'layer'. Product name must be in the filename.") "'layer'. Product name must be in the filename.")
parser.add_argument('--shape-file', default='{product}.shp', parser.add_argument('--shape-file', default='{product}.shp',
help="Shapefile filename pattern to use and placed in the output directory. (default: '{product}.shp')") help="Shapefile filename pattern to use and placed "
"in the output directory. "
"(default: '{product}.shp')")
parser.add_argument('out_dir', parser.add_argument('out_dir',
help="Output path to save tile information to (ex. '/data/tiles/{product}')") help="Output path to save tile information to (ex. '/data/tiles/{product}')")
parser.add_argument('input_files', nargs="+", parser.add_argument('input_files', nargs="+",
...@@ -88,8 +91,13 @@ def main(): ...@@ -88,8 +91,13 @@ def main():
# hardlink if needed # hardlink if needed
prod_files = list(link_or_copy(prod_files, out_dir)) prod_files = list(link_or_copy(prod_files, out_dir))
# get all products in the current directory
ext = os.path.splitext(prod_files[-1])[-1]
all_prod_files = sorted(glob(os.path.join(out_dir, '*' + prod + '*' + ext)))
# create shape file # create shape file
tile_index.index(prod_files, shp_pathname) LOG.info("Rebuilding shapefile index with:\n\t{}".format(", ".join(all_prod_files)))
tile_index.index(all_prod_files, shp_pathname)
......
...@@ -50,6 +50,8 @@ run_tile_gen() { ...@@ -50,6 +50,8 @@ run_tile_gen() {
# generate_tiles.py will make a temporary directory # generate_tiles.py will make a temporary directory
out_dir="${dst_dir}/tiles/${satellite_family}/${satellite_id}/${instrument}" out_dir="${dst_dir}/tiles/${satellite_family}/${satellite_id}/${instrument}"
mkdir -p ${out_dir} mkdir -p ${out_dir}
# add string formatting portion to separate add 'product' sub-directory
out_dir="${out_dir}/{product}"
python3 generate_tiles.py ${TILE_ARGS} -p ${G2G_PRODUCTS} -- ${out_dir} ${path} python3 generate_tiles.py ${TILE_ARGS} -p ${G2G_PRODUCTS} -- ${out_dir} ${path}
# OUT/<product>/<product>.shp # OUT/<product>/<product>.shp
glob_pattern="${out_dir}/*/*.shp" glob_pattern="${out_dir}/*/*.shp"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment