1
|
#!/bin/bash -e
|
2
|
# exports the geoscrub table
|
3
|
. "$(dirname "${BASH_SOURCE[0]}")"/../../../lib/runscripts/import.run
|
4
|
.rel ../../../lib/sh/local.sh
|
5
|
|
6
|
if self_not_included; then
|
7
|
|
8
|
export_() # usage: rm=1 .../self.run export_
|
9
|
{
|
10
|
begin_target
|
11
|
local_export database=geoscrub table=geoscrub \
|
12
|
cols='decimallatitude,decimallongitude,country,stateprovince,county,countrystd'\
|
13
|
',stateprovincestd,countystd,latlonvalidity,countryvalidity,'\
|
14
|
'stateprovincevalidity,countyvalidity' # str b/c env vars don't support arrays
|
15
|
to_top_file pg_export # runtime: 25 s ("0m24.464s")
|
16
|
}
|
17
|
|
18
|
make() # usage: rm=1 .../self.run make
|
19
|
# **WARNING**: this will truncate the geoscrub database tables!
|
20
|
{
|
21
|
begin_target
|
22
|
local input_path="$(canon_rel_path "$root_dir/exports/geoscrub_input.csv")"
|
23
|
DATAFILE="$(basename "$input_path")" command \
|
24
|
"$root_dir/derived/biengeo/geoscrub.sh" \
|
25
|
--geoscrub-input="$(dirname "$input_path")"
|
26
|
# runtime: 2.5 h ("21:24:02" - "19:04:58")
|
27
|
with_rm export_
|
28
|
}
|
29
|
|
30
|
# upload time: 30 s ("0:00:29")
|
31
|
|
32
|
all() # usage: rm=1 .../self.run
|
33
|
{
|
34
|
begin_target
|
35
|
with_rm make
|
36
|
}
|
37
|
|
38
|
fi
|