Skip to content

Commit

Permalink
Connect with raster analysis step function
Browse files Browse the repository at this point in the history
  • Loading branch information
jterry64 committed Jul 31, 2024
1 parent 89c4441 commit 4b83ab9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions batch/scripts/cogify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ else

# merge all rasters into one huge raster using COG block size
gdal_translate -of GTiff -co TILED=YES -co BLOCKXSIZE="${BLOCK_SIZE}" -co BLOCKYSIZE="${BLOCK_SIZE}" -co COMPRESS=DEFLATE -co BIGTIFF=IF_SAFER -co NUM_THREADS=ALL_CPUS --config GDAL_CACHEMAX 70% --config GDAL_NUM_THREADS ALL_CPUS "${IMPLEMENTATION}_merged.vrt" "${IMPLEMENTATION}_merged.tif"
aws s3 cp merged.tif "${PREFIX}/${IMPLEMENTATION}_merged.tif"
aws s3 cp "${IMPLEMENTATION}_merged.tif" "${PREFIX}/${IMPLEMENTATION}_merged.tif"
fi

if [[ $(aws s3 ls "${PREFIX}/${IMPLEMENTATION}_merged.tif.ovr") ]]; then
aws s3 cp "${PREFIX}/${IMPLEMENTATION}_merged.tif.ovr" "${IMPLEMENTATION}_merged.tif.ovr"
else
# generate overviews externally
gdaladdo "${IMPLEMENTATION}_merged.tif" -r "${RESAMPLE}" -ro --config GDAL_NUM_THREADS ALL_CPUS --config GDAL_CACHEMAX 70% --config COMPRESS_OVERVIEW DEFLATE
aws s3 cp merged.tif.ovr "${PREFIX}/${IMPLEMENTATION}_merged.tif.ovr"
aws s3 cp "${IMPLEMENTATION}_merged.tif.ovr" "${PREFIX}/${IMPLEMENTATION}_merged.tif.ovr"
fi

# convert to COG using existing overviews, this adds some additional layout optimizations
Expand All @@ -44,8 +44,8 @@ gdal_translate "${IMPLEMENTATION}_merged.tif" "${IMPLEMENTATION}.tif" -of COG -c
aws s3 cp "${IMPLEMENTATION}.tif" "${TARGET}"

# delete intermediate file
aws s3 rm "${PREFIX}/merged.tif"
aws s3 rm "${PREFIX}/merged.tif.ovr"
aws s3 rm "${PREFIX}/${IMPLEMENTATION}_merged.tif"
aws s3 rm "${PREFIX}/${IMPLEMENTATION}_merged.tif.ovr"

if [ -n "$EXPORT_TO_GEE" ]; then
export_to_gee.py --dataset "${DATASET}" --implementation "${IMPLEMENTATION}"
Expand Down

0 comments on commit 4b83ab9

Please sign in to comment.