-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPostSandyDatasetPreprocessor.sh
34 lines (31 loc) · 1.08 KB
/
PostSandyDatasetPreprocessor.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
start=`date +%s`
mkdir -p datasets
cd datasets
wget ftp://topex.ucsd.edu/pub/srtm15_plus/topo15_compressed.nc
if [ ! -f GSHHS_f_L1.shp ]; then
if [ ! -f gshhg-shp-2.3.7.zip ]; then
wget ftp://ftp.soest.hawaii.edu/gshhg/gshhg-shp-2.3.7.zip
fi
unzip -p gshhg-shp-2.3.7.zip GSHHS_shp/f/GSHHS_f_L1.shp >GSHHS_f_L1.shp
unzip -p gshhg-shp-2.3.7.zip GSHHS_shp/f/GSHHS_f_L1.dbf >GSHHS_f_L1.dbf
unzip -p gshhg-shp-2.3.7.zip GSHHS_shp/f/GSHHS_f_L1.prj >GSHHS_f_L1.prj
unzip -p gshhg-shp-2.3.7.zip GSHHS_shp/f/GSHHS_f_L1.shx >GSHHS_f_L1.shx
rm -rf gshhg-shp-2.3.7.zip
fi
wget -np -r -nH -L -c --cut-dirs=6 https://www.ngdc.noaa.gov/mgg/inundation/sandy/data/tiles/zip19/
shopt -s nullglob
for i in *.tif; do
TILE="$(basename "$i" .tif)"
if [ ! -f "$TILE".nc ]; then
echo "Processing $TILE"
gdal_translate -of netCDF -co "FORMAT=NC4" "${i}" "$TILE".nc
fi
if [ ! -f coastline_"$TILE".shp ]; then
echo "Generating coastline for $TILE"
gdal_contour -fl 0.0 "$TILE".nc coastline_"$TILE".shp
fi
rm -rf $TILE.tif
done
end=`date +%s`
runtime=$((end-start))
echo $runtime