Revision 9483
Added by Aaron Marcuse-Kubitza over 11 years ago
inputs/GBIF/raw_occurrence_record/run | ||
---|---|---|
12 | 12 |
to_target pg_export |
13 | 13 |
} |
14 | 14 |
|
15 |
plant_fraction.table/make() |
|
16 |
{ |
|
17 |
echo_func; set_make_vars; mk_table_esc |
|
18 |
|
|
19 |
use_local_remote |
|
20 |
if remaking; then table=plant_fraction table_esc= mk_drop|mysql_ANSI; fi |
|
21 |
mysql_ANSI <<EOF |
|
22 |
CREATE TABLE IF NOT EXISTS "plant_fraction" AS |
|
23 |
SELECT |
|
24 |
institution_code |
|
25 |
, COUNT(family LIKE '%aceae%' OR family IN ('Compositae','Gramineae','Palmae','Guttiferae','Cruciferae','Labiatae','Umbelliferae','Leguminosae'))/COUNT(*) |
|
26 |
AS plant_fraction |
|
27 |
FROM ${limit:+(SELECT * FROM }$table_esc ${limit:+$(prefix= limit)) s} |
|
28 |
GROUP BY institution_code |
|
29 |
ORDER BY institution_code |
|
30 |
EOF |
|
31 |
} |
|
32 |
|
|
15 | 33 |
herbaria_filter.table/make() |
16 | 34 |
{ |
17 | 35 |
echo_func; set_make_vars |
Also available in: Unified diff
inputs/GBIF/raw_occurrence_record/run: added plant_fraction.table/make(), which contains the plant fraction for each herbarium