-
Notifications
You must be signed in to change notification settings - Fork 2
/
get_data.sh
51 lines (45 loc) · 1.75 KB
/
get_data.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
DST="$1"
DATA_TYPE="$2"
OS_TYPE="$3"
mkdir -p ./${DST}
mkdir -p ./${DST}/azcopy
cd ./${DST}
AZCOPY_URL=`curl -s -D- "https://aka.ms/downloadazcopy-v10-${OS_TYPE}" | grep Location`
PREFIX='Location: '
AZCOPY_URL=${AZCOPY_URL/#$PREFIX}
AZCOPY_URL=`echo ${AZCOPY_URL} | tr -d '\r'`
echo 'Downloading: '
echo ${AZCOPY_URL}
if [[ "$OS_TYPE" == "mac" ]]; then
curl -o azcopy.zip "${AZCOPY_URL}"
unzip azcopy.zip -d ./azcopy
fi
if [[ "$OS_TYPE" == "linux" ]]; then
curl -o azcopy.tar.gz "${AZCOPY_URL}"
tar -xf azcopy.tar.gz -C ./azcopy
fi
AZCOPY_DIR=`ls ./azcopy`
# get spatial index file
./azcopy/${AZCOPY_DIR}/azcopy copy --recursive "https://lilablobssc.blob.core.windows.net/lcmcvpr2019/cvpr_chesapeake_landcover/spatial_index.geojson" "."
if [[ "$DATA_TYPE" == "train" ]]; then
./azcopy/${AZCOPY_DIR}/azcopy copy --recursive "https://lilablobssc.blob.core.windows.net/lcmcvpr2019/cvpr_chesapeake_landcover/md_1m_2013_extended-debuffered-train_tiles" "."
fi
if [[ "$DATA_TYPE" == "val" ]]; then
./azcopy/${AZCOPY_DIR}/azcopy copy --recursive "https://lilablobssc.blob.core.windows.net/lcmcvpr2019/cvpr_chesapeake_landcover/md_1m_2013_extended-debuffered-val_tiles" "."
fi
if [[ "$DATA_TYPE" == "test" ]]; then
./azcopy/${AZCOPY_DIR}/azcopy copy --recursive "https://lilablobssc.blob.core.windows.net/lcmcvpr2019/cvpr_chesapeake_landcover/md_1m_2013_extended-debuffered-test_tiles" "."
fi
if [[ "$DST" == "data_reorg" ]]; then
cd ./*${DATA_TYPE}*
find . -name '*_naip-old*' -delete
find . -name '*-leaf*' -delete
find . -name '*_nlcd.tif' -delete
mkdir -p dataset lb_building lb_land_cover
mv *_lc.tif lb_land_cover
mv *_buildings* lb_building
mv *-new* dataset
fi