Skip to content

Commit e74bd49

Browse files
authored
Merge pull request #260 from akrherz/rwis_stations
✨ Add station metadata storage for rwis,other databases
2 parents 067da05 + 9f7c0ce commit e74bd49

File tree

4 files changed

+184
-2
lines changed

4 files changed

+184
-2
lines changed

init/other.sql

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,55 @@
1+
CREATE EXTENSION postgis;
2+
13
-- Boilerplate IEM schema_manager_version, the version gets incremented each
24
-- time we make an upgrade script
35
CREATE TABLE iem_schema_manager_version(
46
version int,
57
updated timestamptz);
6-
INSERT into iem_schema_manager_version values (15, now());
8+
INSERT into iem_schema_manager_version values (16, now());
9+
10+
CREATE TABLE stations(
11+
id varchar(64),
12+
synop int,
13+
name varchar(64),
14+
state char(2),
15+
country char(2),
16+
elevation real,
17+
network varchar(20),
18+
online boolean,
19+
params varchar(300),
20+
county varchar(50),
21+
plot_name varchar(64),
22+
climate_site varchar(6),
23+
remote_id int,
24+
nwn_id int,
25+
spri smallint,
26+
wfo varchar(3),
27+
archive_begin date,
28+
archive_end date,
29+
modified timestamp with time zone,
30+
tzname varchar(32),
31+
iemid SERIAL,
32+
metasite boolean,
33+
sigstage_low real,
34+
sigstage_action real,
35+
sigstage_bankfull real,
36+
sigstage_flood real,
37+
sigstage_moderate real,
38+
sigstage_major real,
39+
sigstage_record real,
40+
ugc_county char(6),
41+
ugc_zone char(6),
42+
ncdc81 varchar(11),
43+
ncei91 varchar(11),
44+
temp24_hour smallint,
45+
precip24_hour smallint,
46+
wigos varchar(64),
47+
geom geometry(POINT, 4326)
48+
);
49+
alter table stations owner to mesonet;
50+
grant select on stations to ldm,nobody;
51+
CREATE UNIQUE index stations_idx on stations(id, network);
52+
create UNIQUE index stations_iemid_idx on stations(iemid);
753

854
-- Purple Air Data
955
create table purpleair(

init/rwis.sql

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,55 @@
1+
CREATE EXTENSION postgis;
12
-- Boilerplate IEM schema_manager_version, the version gets incremented each
23
-- time we make an upgrade script
34
CREATE TABLE iem_schema_manager_version(
45
version int,
56
updated timestamptz);
6-
INSERT into iem_schema_manager_version values (8, now());
7+
INSERT into iem_schema_manager_version values (9, now());
8+
9+
CREATE TABLE stations(
10+
id varchar(64),
11+
synop int,
12+
name varchar(64),
13+
state char(2),
14+
country char(2),
15+
elevation real,
16+
network varchar(20),
17+
online boolean,
18+
params varchar(300),
19+
county varchar(50),
20+
plot_name varchar(64),
21+
climate_site varchar(6),
22+
remote_id int,
23+
nwn_id int,
24+
spri smallint,
25+
wfo varchar(3),
26+
archive_begin date,
27+
archive_end date,
28+
modified timestamp with time zone,
29+
tzname varchar(32),
30+
iemid SERIAL,
31+
metasite boolean,
32+
sigstage_low real,
33+
sigstage_action real,
34+
sigstage_bankfull real,
35+
sigstage_flood real,
36+
sigstage_moderate real,
37+
sigstage_major real,
38+
sigstage_record real,
39+
ugc_county char(6),
40+
ugc_zone char(6),
41+
ncdc81 varchar(11),
42+
ncei91 varchar(11),
43+
temp24_hour smallint,
44+
precip24_hour smallint,
45+
wigos varchar(64),
46+
geom geometry(POINT, 4326)
47+
);
48+
alter table stations owner to mesonet;
49+
grant select on stations to ldm,nobody;
50+
CREATE UNIQUE index stations_idx on stations(id, network);
51+
create UNIQUE index stations_iemid_idx on stations(iemid);
52+
753

854
CREATE TABLE sensors(
955
station varchar(5),

upgrade/other/16.sql

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
CREATE EXTENSION postgis;
2+
-- need stations table
3+
CREATE TABLE stations(
4+
id varchar(64),
5+
synop int,
6+
name varchar(64),
7+
state char(2),
8+
country char(2),
9+
elevation real,
10+
network varchar(20),
11+
online boolean,
12+
params varchar(300),
13+
county varchar(50),
14+
plot_name varchar(64),
15+
climate_site varchar(6),
16+
remote_id int,
17+
nwn_id int,
18+
spri smallint,
19+
wfo varchar(3),
20+
archive_begin date,
21+
archive_end date,
22+
modified timestamp with time zone,
23+
tzname varchar(32),
24+
iemid SERIAL,
25+
metasite boolean,
26+
sigstage_low real,
27+
sigstage_action real,
28+
sigstage_bankfull real,
29+
sigstage_flood real,
30+
sigstage_moderate real,
31+
sigstage_major real,
32+
sigstage_record real,
33+
ugc_county char(6),
34+
ugc_zone char(6),
35+
ncdc81 varchar(11),
36+
ncei91 varchar(11),
37+
temp24_hour smallint,
38+
precip24_hour smallint,
39+
wigos varchar(64),
40+
geom geometry(POINT, 4326)
41+
);
42+
alter table stations owner to mesonet;
43+
grant select on stations to ldm,nobody;
44+
CREATE UNIQUE index stations_idx on stations(id, network);
45+
create UNIQUE index stations_iemid_idx on stations(iemid);

upgrade/rwis/9.sql

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
CREATE EXTENSION postgis;
2+
-- need stations table
3+
CREATE TABLE stations(
4+
id varchar(64),
5+
synop int,
6+
name varchar(64),
7+
state char(2),
8+
country char(2),
9+
elevation real,
10+
network varchar(20),
11+
online boolean,
12+
params varchar(300),
13+
county varchar(50),
14+
plot_name varchar(64),
15+
climate_site varchar(6),
16+
remote_id int,
17+
nwn_id int,
18+
spri smallint,
19+
wfo varchar(3),
20+
archive_begin date,
21+
archive_end date,
22+
modified timestamp with time zone,
23+
tzname varchar(32),
24+
iemid SERIAL,
25+
metasite boolean,
26+
sigstage_low real,
27+
sigstage_action real,
28+
sigstage_bankfull real,
29+
sigstage_flood real,
30+
sigstage_moderate real,
31+
sigstage_major real,
32+
sigstage_record real,
33+
ugc_county char(6),
34+
ugc_zone char(6),
35+
ncdc81 varchar(11),
36+
ncei91 varchar(11),
37+
temp24_hour smallint,
38+
precip24_hour smallint,
39+
wigos varchar(64),
40+
geom geometry(POINT, 4326)
41+
);
42+
alter table stations owner to mesonet;
43+
grant select on stations to ldm,nobody;
44+
CREATE UNIQUE index stations_idx on stations(id, network);
45+
create UNIQUE index stations_iemid_idx on stations(iemid);

0 commit comments

Comments
 (0)