Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Chemical data may be imported #83

Merged
merged 2 commits into from Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions _albion.sql
Expand Up @@ -180,6 +180,22 @@ create index facies_hole_id_idx on _albion.facies(hole_id)
alter table _albion.facies alter column id set default _albion.unique_id()::varchar
;

create table _albion.chemical(
hole_id varchar not null references _albion.hole(id) on delete cascade on update cascade,
from_ real,
to_ real,
num_sample varchar,
element varchar,
thickness real,
gt real, -- thickness * grade
grade real,
equi real,
comments varchar)
;

create index chemical_hole_id_idx on _albion.chemical(hole_id)
;

create table _albion.mineralization(
id varchar primary key,
hole_id varchar not null references _albion.hole(id) on delete cascade on update cascade,
Expand Down
2 changes: 2 additions & 0 deletions albion.sql
Expand Up @@ -179,6 +179,8 @@ create view albion.lithology as select id, hole_id, from_, to_, code, comments,
create view albion.facies as select id, hole_id, from_, to_, code, comments, geom::geometry('LINESTRINGZ', $SRID) from _albion.facies
;

create view albion.chemical as select hole_id, from_, to_, num_sample, element, thickness, gt, grade, equi, comments from _albion.chemical
;

create view albion.mineralization as select id, hole_id, level_, from_, to_, oc, accu, grade, geom::geometry('LINESTRINGZ', $SRID) from _albion.mineralization
;
Expand Down
Binary file modified data/nt.zip
Binary file not shown.
10 changes: 10 additions & 0 deletions project.py
Expand Up @@ -300,6 +300,16 @@ def import_data(self, dir_, progress=None):

cur.execute("update albion.mineralization set geom=albion.hole_piece(from_, to_, hole_id)")

progress.setPercent(80)

if find_in_dir(dir_, 'chemical'):
cur.execute("""
copy _albion.chemical(hole_id, from_, to_, num_sample,
element, thickness, gt, grade, equi, comments
)
from '{}' delimiter ';' csv header
""".format(find_in_dir(dir_, 'chemical')))

progress.setPercent(100)

con.commit()
Expand Down