-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from mit-jp/timeslices-data-upload
Timeslices data upload
- Loading branch information
Showing
31 changed files
with
8,584 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
frontend/public/gridded-world.json filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
"webRoot": "${workspaceFolder}" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,4 +61,4 @@ | |
"cwd": "${workspaceFolder}" | ||
} | ||
] | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
backend/migrations/20230920100538_add_future_data_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
-- setup table for models, as each dataset can have multiple models | ||
CREATE TABLE future_model ( | ||
id SERIAL NOT NULL, | ||
name TEXT NOT NULL, | ||
dataset INT NOT NULL, | ||
source SMALLINT NOT NULL, | ||
domain float8 [] NOT NULL DEFAULT '{}', | ||
PRIMARY KEY(id), | ||
FOREIGN KEY(dataset) REFERENCES dataset(id), | ||
FOREIGN KEY(source) REFERENCES data_source(id) | ||
); | ||
|
||
-- each year will have a different confidence interval, so setup tables to store that information | ||
-- stores upper ci for a county/country | ||
CREATE TABLE ci_above ( | ||
id SERIAL NOT NULL, | ||
model INT NOT NULL, | ||
geo_id SMALLINT NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
-- stores lower ci for a county/country | ||
CREATE TABLE ci_below ( | ||
id SERIAL NOT NULL, | ||
model INT NOT NULL, | ||
geo_id SMALLINT NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
-- setup table for future/predictive data | ||
CREATE TABLE future_data ( | ||
model INT NOT NULL, | ||
ci_above INT, | ||
ci_below INT, | ||
start_date DATE NOT NULL, | ||
end_date DATE NOT NULL, | ||
interval SMALLINT NOT NULL, | ||
id SMALLINT NOT NULL, | ||
geography_type INT NOT NULL, | ||
PRIMARY KEY ( | ||
model, | ||
start_date, | ||
end_date, | ||
id | ||
), | ||
FOREIGN KEY (model) REFERENCES future_model(id), | ||
FOREIGN KEY (ci_above) REFERENCES ci_above(id), | ||
FOREIGN KEY (ci_below) REFERENCES ci_below(id), | ||
CONSTRAINT data_geo_ids_fkey FOREIGN KEY (geography_type, id) REFERENCES geo_id (geography_type, id) | ||
); | ||
|
||
-- add columns for years up to 2200 | ||
DO $$ | ||
DECLARE | ||
cur_year INT := 2024; | ||
BEGIN | ||
WHILE cur_year <2201 LOOP | ||
EXECUTE 'ALTER TABLE future_data ADD value_' || cur_year || ' FLOAT'; | ||
cur_year := cur_year+1; | ||
END LOOP; | ||
END$$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Remove domain from future model table, as future data already has a start and end date | ||
ALTER TABLE | ||
future_model DROP COLUMN domain; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Add column for a description | ||
ALTER TABLE | ||
future_model | ||
ADD | ||
COLUMN description TEXT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- future data visualization is not ready yet, so no need for the tables currently | ||
DROP TABLE IF EXISTS future_data; | ||
DROP TABLE IF EXISTS ci_above; | ||
DROP TABLE IF EXISTS ci_below; | ||
DROP TABLE IF EXISTS future_model; |
65 changes: 65 additions & 0 deletions
65
backend/migrations/20240814143647_add-merra-era-projection-datasets.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
INSERT INTO | ||
dataset ( | ||
short_name, | ||
name, | ||
description, | ||
units, | ||
geography_type | ||
) | ||
VALUES | ||
( | ||
'cmi_MERRA2_ERA5', | ||
'cmi_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'dry_MERRA2_ERA5', | ||
'dry_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'gw_MERRA2_ERA5', | ||
'gw_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'ht_MERRA2_ERA5', | ||
'ht_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'pet_MERRA2_ERA5', | ||
'pet_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'prc_MERRA2_ERA5', | ||
'prc_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'ro_MERRA2_ERA5', | ||
'ro_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
), | ||
( | ||
'wet_MERRA2_ERA5', | ||
'wet_MERRA2_ERA5', | ||
'placeholder', | ||
'', | ||
2 | ||
); |
Oops, something went wrong.