Skip to content

Commit

Permalink
make script runable #311
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludee committed Aug 15, 2018
1 parent da7b8c8 commit eebdb00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 39 deletions.
14 changes: 8 additions & 6 deletions dataprocessing/sql_snippets/rea/reaosm/ego_dp_reaosm_m1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ __url__ = "https://github.com/openego/data_processing/blob/master/LICENS
__author__ = "Ludee, Christian-rli"
*/

-- check
SELECT generation_type, generation_subtype, count(*)
FROM sandbox.ego_reaosm_m1_1_a_mview
GROUP BY generation_type, generation_subtype
ORDER BY generation_type, generation_subtype;

-- MView M1-1
DROP MATERIALIZED VIEW IF EXISTS sandbox.ego_reaosm_m1_1_a_mview CASCADE;
Expand Down Expand Up @@ -43,6 +38,12 @@ ALTER TABLE sandbox.ego_reaosm_m1_1_a_mview OWNER TO oeuser;
SELECT scenario_log('eGo_PP_REAOSM','v0.1','input','sandbox','ego_dp_res_powerplant_reaosm','ego_dp_reaosm_m1.sql',' ');
SELECT scenario_log('eGo_REAOSM','v0.1','temp','sandbox','ego_reaosm_m1_1_a_mview','ego_dp_reaosm_m1.sql',' ');

-- check
SELECT generation_type, generation_subtype, count(*)
FROM sandbox.ego_reaosm_m1_1_a_mview
GROUP BY generation_type, generation_subtype
ORDER BY generation_type, generation_subtype;


-- reaosm_flag M1-1
UPDATE sandbox.ego_dp_res_powerplant_reaosm AS dea
Expand Down Expand Up @@ -224,7 +225,7 @@ DROP TABLE IF EXISTS sandbox.ego_reaosm_m1_1_jnt_temp CASCADE;
Move "solar roof mounted" with "4" to OSM agricultural areas.
The rest could not be allocated, consider in M4.
*/

/*
-- MView M1-2
DROP MATERIALIZED VIEW IF EXISTS model_draft.ego_supply_rea_m1_2_a_mview CASCADE;
CREATE MATERIALIZED VIEW model_draft.ego_supply_rea_m1_2_a_mview AS
Expand Down Expand Up @@ -427,3 +428,4 @@ DROP TABLE IF EXISTS model_draft.ego_supply_rea_m1_2_jnt_temp CASCADE;
--DROP MATERIALIZED VIEW IF EXISTS model_draft.ego_reaosm_m1_1_a_mview CASCADE;
DROP MATERIALIZED VIEW IF EXISTS model_draft.ego_supply_rea_m1_2_a_mview CASCADE;
*/
45 changes: 12 additions & 33 deletions dataprocessing/sql_snippets/rea/reaosm/ego_dp_reaosm_setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,10 @@ __author__ = "Christian-rli; Ludee"


-- Imported from GeoJSON with QGIS
-- metadata (Invalid, please correct!)
-- metadata
COMMENT ON TABLE sandbox.ego_pp_osm_deu_power_point IS '{
"title": "Openstreetmap generator=source",
"description": "extracted from Openstreetmap via overpass-turbo",
"language": [ "en" ],
"spatial":
{"location": "germany",
"extent": "europe",
},
"temporal":
{"reference_date": "2018-08-13",
},
"sources": [
{"name": "OpenStreetMap", "description": "A collaborative project to create a free editable map of the world", "url": "https://www.openstreetmap.org/", "license": "ODbL-1.0", "copyright": "© OpenStreetMap contributors"} ],
"license":
{"id": "ODbL-1.0",
"name": "Open Data Commons Open Database License 1.0",
"version": "1.0",
"url": "https://opendatacommons.org/licenses/odbl/1.0/",
"instruction": "You are free: To Share, To Create, To Adapt; As long as you: Attribute, Share-Alike, Keep open!",
"copyright": "© Reiner Lemoine Institut"},
"contributors": [
{"name": "OpenStreetMap Contributors", date": "2018-08-13"},
],
"metadata_version": "1.3"}';
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;


-- Filter OSM powerplants
Expand Down Expand Up @@ -61,7 +40,7 @@ ALTER TABLE sandbox.ego_pp_osm_deu_power_point_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW sandbox.ego_pp_osm_deu_power_point_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
Expand Down Expand Up @@ -91,7 +70,7 @@ ALTER TABLE sandbox.ego_pp_osm_deu_power_point_reaosm OWNER TO oeuser;

-- metadata
COMMENT ON TABLE sandbox.ego_pp_osm_deu_power_point_reaosm IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
Expand Down Expand Up @@ -157,7 +136,7 @@ ALTER TABLE grid.ego_dp_mv_griddistrict_v0_4_3_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW grid.ego_dp_mv_griddistrict_v0_4_3_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
Expand Down Expand Up @@ -209,7 +188,7 @@ ALTER TABLE demand.ego_dp_loadarea_v0_4_3_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW demand.ego_dp_loadarea_v0_4_3_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
Expand Down Expand Up @@ -280,7 +259,7 @@ ALTER TABLE sandbox.ego_dp_res_powerplant_reaosm OWNER TO oeuser;

-- metadata
COMMENT ON TABLE sandbox.ego_dp_res_powerplant_reaosm IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
Expand Down Expand Up @@ -311,7 +290,7 @@ ALTER TABLE sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview OWNER T

-- metadata
COMMENT ON MATERIALIZED VIEW sandbox.ego_osm_sector_per_griddistrict_4_agricultural_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

-- scenario log (project,version,io,schema_name,table_name,script_name,comment)
Expand Down Expand Up @@ -342,7 +321,7 @@ ALTER TABLE openstreetmap.osm_deu_point_wind_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_wind_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;


Expand All @@ -367,7 +346,7 @@ ALTER TABLE openstreetmap.osm_deu_point_biogas_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_biogas_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;


Expand All @@ -391,5 +370,5 @@ ALTER TABLE openstreetmap.osm_deu_point_solar_mview OWNER TO oeuser;

-- metadata
COMMENT ON MATERIALIZED VIEW openstreetmap.osm_deu_point_solar_mview IS '{
"comment": "eGoPP - REA OSM - Temporary Table",
"comment": "eGo - REAOSM - Temporary Table",
"version": "v0.1" }' ;

0 comments on commit eebdb00

Please sign in to comment.