Skip to content

Instantly share code, notes, and snippets.

@BlasBenito
Created August 26, 2022 16:51
Show Gist options
  • Save BlasBenito/cda94ac1970ab3503e0726e02c3326f2 to your computer and use it in GitHub Desktop.
Save BlasBenito/cda94ac1970ab3503e0726e02c3326f2 to your computer and use it in GitHub Desktop.
#!/bin/bash
#reprojects in parallel geotif files in MODIS sinusoidal
#in the "raw" folder
#to geotif files in EPSG 4326 in the current folder
#with the suffix "_wgs_84"
#listing files in raw
for FILEPATH in raw/*; do
#generates output file name
FILENAME=$(basename -- "$FILEPATH")
FILEOUT="${FILENAME%.*}"_wgs_84.tif
#applies gdal warp in parallel
gdalwarp \
-of GTIFF \
--config GDAL_CACHEMAX 1024 \
-multi -wo "NUM_THREADS=ALL_CPUS" \
-s_srs '+proj=sinu +R=6371007.181 +nadgrids=@null +wktext' \
-t_srs '+proj=longlat +datum=WGS84 +no_defs' \
-tr 0.008333333300000 -0.008333333300000\
-r near \
-co "COMPRESS=DEFLATE" \
${FILEPATH} \
${FILEOUT} \
&
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment