diff --git a/tile_gen/README.md b/tile_gen/README.md index 53d434fcadf46786ce05b04c5d4b2643d0759e73..28a1a05b1ebf00bcfe66fe3ef94cd24a99fe4a5d 100644 --- a/tile_gen/README.md +++ b/tile_gen/README.md @@ -10,9 +10,5 @@ docker push gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/tile_gen:late ## Usage ```bash -docker run -p 8888:80 -d gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/mapserver:latest +docker run -d ---rm --network cspp-geo-rabbit --cpus 2 --name cspp-geo-tilegen-g16-radf -e AMQPFIND_TOPIC="data.goes.g16.abi.radf.l1b.geotiff.complete" -v cspp-geo-abi-l1b-geotiffs:/data gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-web-viewer/tile_gen:latest ``` - -Then the main mapserv CGI script can be accessed with: - -http://localhost:8888/cgi-bin/mapserv diff --git a/tile_gen/run.sh b/tile_gen/run.sh index f59a5384ad59937e92044c54c4549844ab000079..380b81d35cbac6abe8f7c9a53dc79fec9b75afe3 100644 --- a/tile_gen/run.sh +++ b/tile_gen/run.sh @@ -15,9 +15,6 @@ # Verify that the data mount is available test -d "/data" -# Change to /data volume to write our output -test -d "/dst" - export AMQPFIND_ARGS=${AMQPFIND_ARGS:-"-H cspp-geo-rabbit -X satellite -u guest -p guest"} export AMQPSEND_ARGS=${AMQPSEND_ARGS:-"-H cspp-geo-rabbit -X satellite -u guest -p guest"} export AMQPFIND_TOPIC=${AMQPFIND_TOPIC:-'data.goes.*.abi.*.l1b.geotiff.complete'} @@ -26,7 +23,7 @@ export TILE_ARGS=${TILE_ARGS:-""} export TMPDIR=${TMPDIR:-"/dst/tmp"} run_tile_gen() { - if [ $# -ne 5 ]; then + if [[ $# -ne 5 ]]; then echo "Unexpected number of arguments (expected 5): $#" return 1 fi @@ -40,15 +37,24 @@ run_tile_gen() { # convert path from a relative path to an absolute path path="/data/${path}" + # if /dst isn't defined then use /data + if [[ -d "/dst" ]]; then + dst_dir="/dst" + else + dst_dir="/data" + fi + # update shapefile in a temporary directory # and resample geotiff if necessary # FUTURE: TileDB will be updated in-place # generate_tiles.py will make a temporary directory - out_dir="/dst/tiles/${satellite_family}/${satellite_id}/${instrument}" + out_dir="${dst_dir}/tiles/${satellite_family}/${satellite_id}/${instrument}" mkdir -p ${out_dir} python3 generate_tiles.py ${TILE_ARGS} -p ${G2G_PRODUCTS} -- ${out_dir} ${path} # OUT/<product>/<product>.shp glob_pattern="${out_dir}/*/*.shp" + # Remove the /data prefix + glob_pattern="${glob_pattern/${dst_dir}\//}" amqpsend_topic="data.${satellite_family}.${satellite_id}.${instrument}.${data_type}.l1b.tiledb.complete" json_info="{path: ${glob_pattern}, satellite_family: ${satellite_family}, satellite_ID: ${satellite_id}, instrument: ${instrument}, data_type: ${data_type}}"