From a24bfcf9a1b4fd9b8801b4e8798a0b33423d0d54 Mon Sep 17 00:00:00 2001 From: FelixMau Date: Tue, 16 Jul 2024 15:45:56 +0200 Subject: [PATCH 01/10] Drop na columns in subprocess artifacts --- data_adapter/preprocessing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data_adapter/preprocessing.py b/data_adapter/preprocessing.py index 7cc6733..bacd4d4 100644 --- a/data_adapter/preprocessing.py +++ b/data_adapter/preprocessing.py @@ -205,6 +205,7 @@ def __get_df_from_artifact(self, artifact: collection.Artifact, process: str, *p df = self.__filter_parameters(df, parameters, artifact.datatype) df = self.__convert_units(df, artifact.metadata) + # Unpack regions: if artifact.datatype == collection.DataType.Scalar: df = df.explode("region") @@ -287,6 +288,7 @@ def __unpack_bandwidths(self, df: pd.DataFrame) -> pd.DataFrame: @staticmethod def __filter_subprocess(df: pd.DataFrame, subprocess: str) -> pd.DataFrame: df = df[df["type"] == subprocess] + df = df.dropna(axis=1) return df.drop("type", axis=1) @staticmethod From 40fc47b89171e30baec3f7e5f475b00d6b136d37 Mon Sep 17 00:00:00 2001 From: FelixMau Date: Tue, 16 Jul 2024 15:46:00 +0200 Subject: [PATCH 02/10] Drop na columns in subprocess artifacts --- tests/test_preprocessing.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py index e568e4f..4cb904c 100644 --- a/tests/test_preprocessing.py +++ b/tests/test_preprocessing.py @@ -26,13 +26,13 @@ def test_process_of_artifact_with_multiple_subprocesses(): assert hasattr(onshore, "scalars") assert hasattr(onshore, "timeseries") - assert len(onshore.scalars.columns) == 12 + assert len(onshore.scalars.columns) == 7 assert len(onshore.scalars) == 50 assert onshore.timeseries["wind_speed", ("HE",)][0] == 1003 assert hasattr(offshore, "scalars") assert hasattr(offshore, "timeseries") - assert len(offshore.scalars.columns) == 12 + assert len(offshore.scalars.columns) == 7 assert len(offshore.scalars) == 50 assert offshore.timeseries["wind_speed", ("HE",)][0] == 10003 @@ -218,3 +218,25 @@ def test_bandwidth_unpacking(): pandas.Series([None, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]), check_names=False, ) + + +def test_return_only_relevant_columns(): + adapter = preprocessing.Adapter("test_return_only_relevant_columns") + + assert list(adapter.get_process("ind_other_boiler_hot_water_bio_1").scalars.columns.values) == [ + "region", + "year", + "availability_constant", + "conversion_factor_pri_biomass_stemwood", + "conversion_factor_iip_hot_water", + "cost_fix_p", + "cost_inv_p", + "lifetime", + "ef_pri_biomass_stemwood_emi_co2_f_ind", + "ef_pri_biomass_stemwood_emi_ch4_f_ind", + "ef_pri_biomass_stemwood_emi_n2o_f_ind", + "bandwidth_type", + "method", + "source", + "comment", + ] From 4a3ebaf007bcaa9c8d3fd293f2c2a144304def48 Mon Sep 17 00:00:00 2001 From: FelixMau Date: Tue, 16 Jul 2024 15:46:13 +0200 Subject: [PATCH 03/10] Drop na columns in subprocess artifacts --- data_adapter/preprocessing.py | 1 - 1 file changed, 1 deletion(-) diff --git a/data_adapter/preprocessing.py b/data_adapter/preprocessing.py index bacd4d4..969fa3f 100644 --- a/data_adapter/preprocessing.py +++ b/data_adapter/preprocessing.py @@ -205,7 +205,6 @@ def __get_df_from_artifact(self, artifact: collection.Artifact, process: str, *p df = self.__filter_parameters(df, parameters, artifact.datatype) df = self.__convert_units(df, artifact.metadata) - # Unpack regions: if artifact.datatype == collection.DataType.Scalar: df = df.explode("region") From 0f030d33ef68d499bdf31966618c1ab1cf21ecb9 Mon Sep 17 00:00:00 2001 From: FelixMau Date: Tue, 16 Jul 2024 15:46:25 +0200 Subject: [PATCH 04/10] Add Test for drop of na columns --- .../x2x_delivery_hydrogen_pipeline_new_1.json | 264 +++++++++++++++- ...delivery_hydrogen_pipeline_retrofit_1.json | 286 +++++++++++++++++- .../test_bandwidth/collection.json | 31 +- 3 files changed, 578 insertions(+), 3 deletions(-) diff --git a/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_new_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_new_1.json b/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_new_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_new_1.json index db428d8..afcc13b 100644 --- a/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_new_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_new_1.json +++ b/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_new_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_new_1.json @@ -1 +1,263 @@ -{"id": null, "@id": null, "name": "x2x_delivery_hydrogen_pipeline_new_1", "title": "sedos_x2x_delivery_hydrogen_pipeline_new_1", "review": null, "context": {"contact": "g.mueller@fz-juelich.de", "grantNo": "03EI1040D", "homepage": "https://sedos-project.github.io/.github/", "sourceCode": "https://github.com/sedos-project", "documentation": "https://sedos-project.github.io/.github/", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz (BMWK)", "fundingAgencyLogo": "https://en.wikipedia.org/wiki/Federal_Ministry_for_Economic_Affairs_and_Climate_Action#/media/File:BMWi_Logo_2021.svg"}, "sources": [{"path": "https://linkinghub.elsevier.com/retrieve/pii/S0360319906001765", "title": "Determining the lowest-cost hydrogen delivery mode", "licenses": [{"name": null, "path": null, "title": null, "attribution": "Copyright \u00a9 2006 International Association for Hydrogen Energy. Published by Elsevier Ltd. All rights reserved.", "instruction": null}], "description": null}, {"path": "https://www.frontier-economics.com/media/ovdnwcyx/frontier-ptx-business-cases-studie_teil-2-pipelinetransport.pdf", "title": "Teil 2: Pipeline Studie Kosten von gr\u00fcnem Wasserstoff Import via Pipelines", "licenses": [{"name": null, "path": null, "title": null, "attribution": "Copyright. Frontier Economics, 2021.", "instruction": null}], "description": null}], "spatial": {"extent": null, "location": "global", "resolution": null}, "subject": [{"name": "hydrogen", "path": "http://openenergy-platform.org/ontology/oeo/OEO_00000220"}, {"name": "pipeline", "path": ""}], "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", "_comment": {"null": "If not applicable use: null", "todo": "If a value is not yet available, use: todo", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)"}, "keywords": ["SEDOS", "AP5", "X2X", "oedatamodel-parameter", "input_data"], "language": ["en-GB"], "licenses": [{"name": "CC0-1.0", "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", "title": "Creative Commons Zero v1.0 Universal", "attribution": null, "instruction": "You are free: To Share, To Create, To Adapt"}], "temporal": {"timeseries": [{"end": null, "start": null, "alignment": null, "resolution": null, "aggregationType": null}], "referenceDate": null}, "resources": [{"name": "model_draft.x2x_delivery_hydrogen_pipeline_new_1", "path": null, "format": "PostgreSQL", "schema": {"fields": [{"name": "id", "type": "bigint", "unit": null, "isAbout": [], "description": "Unique identifier", "valueReference": []}, {"name": "region", "type": "text", "unit": null, "isAbout": [], "description": "Country or region", "valueReference": []}, {"name": "year", "type": "integer", "unit": "a", "isAbout": [], "description": "Year", "valueReference": []}, {"name": "conversion_factor_sec_hydrogen_orig", "type": "float array", "unit": "MWh/MWh", "isAbout": [], "description": "Commodity conversion factor of hydrogen before being transported", "valueReference": []}, {"name": "conversion_factor_sec_elec", "type": "float array", "unit": "MWh/MWh", "isAbout": [], "description": "Commodity conversion factor of electricity demand for pipeline transport.", "valueReference": []}, {"name": "conversion_factor_sec_hydrogen", "type": "float array", "unit": "MWh/MWh", "isAbout": [], "description": "Commodity conversion factor of hydrogen after being transported", "valueReference": []}, {"name": "cost_inv_p", "type": "float array", "unit": "\u20ac/MW", "isAbout": [], "description": "Investment costs per unit capacity", "valueReference": []}, {"name": "cost_fix_p", "type": "float array", "unit": "\u20ac/MW*a", "isAbout": [], "description": "Fixed operational costs per unit capacity", "valueReference": []}, {"name": "lifetime", "type": "float array", "unit": "a", "isAbout": [], "description": "Lifetime in operation.", "valueReference": []}, {"name": "wacc", "type": "text", "unit": "%", "isAbout": [], "description": "Percentage of costs for capital after taxes. Used to calculate annuity factor for investment costs.", "valueReference": []}, {"name": "bandwidth_type", "type": "json", "unit": null, "isAbout": [], "description": "Bandwidth Type", "valueReference": []}, {"name": "version", "type": "text", "unit": null, "isAbout": [], "description": "Version", "valueReference": []}, {"name": "method", "type": "json", "unit": null, "isAbout": [], "description": "Method", "valueReference": []}, {"name": "source", "type": "json", "unit": null, "isAbout": [], "description": "Source", "valueReference": []}, {"name": "comment", "type": "text", "unit": null, "isAbout": [], "description": "Comment", "valueReference": []}], "primaryKey": ["id"], "foreignKeys": []}, "dialect": {"delimiter": ";", "decimalSeparator": "."}, "profile": "tabular-data-resource", "encoding": "UTF-8"}], "description": "Techno-economic parameter for newly built hydrogen pipelines in Germany.", "contributors": [{"date": "2024-04-08", "email": "g.mueller@fz-juelich.de", "title": "Gian M\u00fcller, FZJ", "object": "data and metadata", "comment": "Data for transport process of hydrogen by newly built pipeline in Germany."}], "metaMetadata": {"metadataLicense": {"name": "CC0-1.0", "path": "https://creativecommons.org/publicdomain/zero/1.0/", "title": "Creative Commons Zero v1.0 Universal"}, "metadataVersion": "OEP-1.5.2"}, "publicationDate": "2024-04-29"} \ No newline at end of file +{ + "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", + "@id": null, + "_comment": { + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "null": "If not applicable use: null", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "todo": "If a value is not yet available, use: todo", + "units": "Use a space between numbers and units (100 m)" + }, + "context": { + "contact": "g.mueller@fz-juelich.de", + "documentation": "https://sedos-project.github.io/.github/", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz (BMWK)", + "fundingAgencyLogo": "https://en.wikipedia.org/wiki/Federal_Ministry_for_Economic_Affairs_and_Climate_Action#/media/File:BMWi_Logo_2021.svg", + "grantNo": "03EI1040D", + "homepage": "https://sedos-project.github.io/.github/", + "sourceCode": "https://github.com/sedos-project" + }, + "contributors": [ + { + "comment": "Data for transport process of hydrogen by newly built pipeline in Germany.", + "date": "2024-04-08", + "email": "g.mueller@fz-juelich.de", + "object": "data and metadata", + "title": "Gian M\u00fcller, FZJ" + } + ], + "description": "Techno-economic parameter for newly built hydrogen pipelines in Germany.", + "id": null, + "keywords": [ + "SEDOS", + "AP5", + "X2X", + "oedatamodel-parameter", + "input_data" + ], + "language": [ + "en-GB" + ], + "licenses": [ + { + "attribution": null, + "instruction": "You are free: To Share, To Create, To Adapt", + "name": "CC0-1.0", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "title": "Creative Commons Zero v1.0 Universal" + } + ], + "metaMetadata": { + "metadataLicense": { + "name": "CC0-1.0", + "path": "https://creativecommons.org/publicdomain/zero/1.0/", + "title": "Creative Commons Zero v1.0 Universal" + }, + "metadataVersion": "OEP-1.5.2" + }, + "name": "x2x_delivery_hydrogen_pipeline_new_1", + "publicationDate": "2024-04-29", + "resources": [ + { + "dialect": { + "decimalSeparator": ".", + "delimiter": ";" + }, + "encoding": "UTF-8", + "format": "PostgreSQL", + "name": "model_draft.x2x_delivery_hydrogen_pipeline_new_1", + "path": null, + "profile": "tabular-data-resource", + "schema": { + "fields": [ + { + "description": "Unique identifier", + "isAbout": [], + "name": "id", + "type": "bigint", + "unit": null, + "valueReference": [] + }, + { + "description": "Country or region", + "isAbout": [], + "name": "region", + "type": "text", + "unit": null, + "valueReference": [] + }, + { + "description": "Year", + "isAbout": [], + "name": "year", + "type": "integer", + "unit": "a", + "valueReference": [] + }, + { + "description": "Commodity conversion factor of hydrogen before being transported", + "isAbout": [], + "name": "conversion_factor_sec_hydrogen_orig", + "type": "float array", + "unit": "MWh/MWh", + "valueReference": [] + }, + { + "description": "Commodity conversion factor of electricity demand for pipeline transport.", + "isAbout": [], + "name": "conversion_factor_sec_elec", + "type": "float array", + "unit": "MWh/MWh", + "valueReference": [] + }, + { + "description": "Commodity conversion factor of hydrogen after being transported", + "isAbout": [], + "name": "conversion_factor_sec_hydrogen", + "type": "float array", + "unit": "MWh/MWh", + "valueReference": [] + }, + { + "description": "Investment costs per unit capacity", + "isAbout": [], + "name": "cost_inv_p", + "type": "float array", + "unit": "\u20ac/MW", + "valueReference": [] + }, + { + "description": "Fixed operational costs per unit capacity", + "isAbout": [], + "name": "cost_fix_p", + "type": "float array", + "unit": "\u20ac/MW*a", + "valueReference": [] + }, + { + "description": "Lifetime in operation.", + "isAbout": [], + "name": "lifetime", + "type": "float array", + "unit": "a", + "valueReference": [] + }, + { + "description": "Percentage of costs for capital after taxes. Used to calculate annuity factor for investment costs.", + "isAbout": [], + "name": "wacc", + "type": "text", + "unit": "%", + "valueReference": [] + }, + { + "description": "Bandwidth Type", + "isAbout": [], + "name": "bandwidth_type", + "type": "json", + "unit": null, + "valueReference": [] + }, + { + "description": "Version", + "isAbout": [], + "name": "version", + "type": "text", + "unit": null, + "valueReference": [] + }, + { + "description": "Method", + "isAbout": [], + "name": "method", + "type": "json", + "unit": null, + "valueReference": [] + }, + { + "description": "Source", + "isAbout": [], + "name": "source", + "type": "json", + "unit": null, + "valueReference": [] + }, + { + "description": "Comment", + "isAbout": [], + "name": "comment", + "type": "text", + "unit": null, + "valueReference": [] + } + ], + "foreignKeys": [], + "primaryKey": [ + "id" + ] + } + } + ], + "review": null, + "sources": [ + { + "description": null, + "licenses": [ + { + "attribution": "Copyright \u00a9 2006 International Association for Hydrogen Energy. Published by Elsevier Ltd. All rights reserved.", + "instruction": null, + "name": null, + "path": null, + "title": null + } + ], + "path": "https://linkinghub.elsevier.com/retrieve/pii/S0360319906001765", + "title": "Determining the lowest-cost hydrogen delivery mode" + }, + { + "description": null, + "licenses": [ + { + "attribution": "Copyright. Frontier Economics, 2021.", + "instruction": null, + "name": null, + "path": null, + "title": null + } + ], + "path": "https://www.frontier-economics.com/media/ovdnwcyx/frontier-ptx-business-cases-studie_teil-2-pipelinetransport.pdf", + "title": "Teil 2: Pipeline Studie Kosten von gr\u00fcnem Wasserstoff Import via Pipelines" + } + ], + "spatial": { + "extent": null, + "location": "global", + "resolution": null + }, + "subject": [ + { + "name": "hydrogen", + "path": "http://openenergy-platform.org/ontology/oeo/OEO_00000220" + }, + { + "name": "pipeline", + "path": "" + } + ], + "temporal": { + "referenceDate": null, + "timeseries": [ + { + "aggregationType": null, + "alignment": null, + "end": null, + "resolution": null, + "start": null + } + ] + }, + "title": "sedos_x2x_delivery_hydrogen_pipeline_new_1" +} diff --git a/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_retrofit_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_retrofit_1.json b/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_retrofit_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_retrofit_1.json index 77c1efa..4d193d0 100644 --- a/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_retrofit_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_retrofit_1.json +++ b/tests/test_data/test_collections/test_bandwidth/SEDOS_x2x_sector/x2x_delivery_hydrogen_pipeline_retrofit_1/srd_range_draft/x2x_delivery_hydrogen_pipeline_retrofit_1.json @@ -1 +1,285 @@ -{"id": null, "@id": null, "name": "x2x_delivery_hydrogen_pipeline_retrofit_1", "title": "sedos_x2x_delivery_hydrogen_pipeline_retrofit_1", "review": null, "context": {"contact": "g.mueller@fz-juelich.de", "grantNo": "03EI1040D", "homepage": "https://sedos-project.github.io/.github/", "sourceCode": "https://github.com/sedos-project", "documentation": "https://sedos-project.github.io/.github/", "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz (BMWK)", "fundingAgencyLogo": "https://en.wikipedia.org/wiki/Federal_Ministry_for_Economic_Affairs_and_Climate_Action#/media/File:BMWi_Logo_2021.svg"}, "sources": [{"path": "https://linkinghub.elsevier.com/retrieve/pii/S0360319906001765", "title": "Determining the lowest-cost hydrogen delivery mode", "licenses": [{"name": null, "path": null, "title": null, "attribution": "Copyright \u00a9 2006 International Association for Hydrogen Energy. Published by Elsevier Ltd. All rights reserved.", "instruction": null}], "description": null}, {"path": "https://www.frontier-economics.com/media/ovdnwcyx/frontier-ptx-business-cases-studie_teil-2-pipelinetransport.pdf", "title": "Teil 2: Pipeline Studie Kosten von gr\u00fcnem Wasserstoff Import via Pipelines", "licenses": [{"name": null, "path": null, "title": null, "attribution": "Copyright. Frontier Economics, 2021.", "instruction": null}], "description": null}, {"path": "https://www.dvgw.de/medien/dvgw/leistungen/publikationen/gasnetz-rueckgrat-h2-welt.pdf", "title": "Das Gasnetz - R\u00fcckgrat der Wasserstoffwelt", "licenses": [{"name": null, "path": null, "title": null, "attribution": "Copyright. DVGW Bonn, 2023.", "instruction": null}], "description": null}], "spatial": {"extent": null, "location": "global", "resolution": null}, "subject": [{"name": "hydrogen", "path": "http://openenergy-platform.org/ontology/oeo/OEO_00000220"}, {"name": "pipeline", "path": ""}], "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", "_comment": {"null": "If not applicable use: null", "todo": "If a value is not yet available, use: todo", "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", "units": "Use a space between numbers and units (100 m)", "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)"}, "keywords": ["SEDOS", "AP5", "X2X", "oedatamodel-parameter", "input_data"], "language": ["en-GB"], "licenses": [{"name": "CC0-1.0", "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", "title": "Creative Commons Zero v1.0 Universal", "attribution": null, "instruction": "You are free: To Share, To Create, To Adapt"}], "temporal": {"timeseries": [{"end": null, "start": null, "alignment": null, "resolution": null, "aggregationType": null}], "referenceDate": null}, "resources": [{"name": "model_draft.x2x_delivery_hydrogen_pipeline_retrofit_1", "path": null, "format": "PostgreSQL", "schema": {"fields": [{"name": "id", "type": "bigint", "unit": null, "isAbout": [], "description": "Unique identifier", "valueReference": []}, {"name": "region", "type": "text", "unit": null, "isAbout": [], "description": "Country or region", "valueReference": []}, {"name": "year", "type": "integer", "unit": "a", "isAbout": [], "description": "Year", "valueReference": []}, {"name": "capacity_p_max", "type": "float array", "unit": "MW", "isAbout": [], "description": "Maximum allowed throughput power output capacity per process.", "valueReference": []}, {"name": "conversion_factor_sec_hydrogen_orig", "type": "float array", "unit": "MWh/MWh", "isAbout": [], "description": "Commodity conversion factor of hydrogen before being transported", "valueReference": []}, {"name": "conversion_factor_sec_elec", "type": "float array", "unit": "MWh/MWh", "isAbout": [], "description": "Commodity conversion factor of electricity demand for pipeline transport.", "valueReference": []}, {"name": "conversion_factor_sec_hydrogen", "type": "float array", "unit": "MWh/MWh", "isAbout": [], "description": "Commodity conversion factor of hydrogen after being transported", "valueReference": []}, {"name": "cost_inv_p", "type": "float array", "unit": "\u20ac/MW", "isAbout": [], "description": "Investment costs per unit capacity", "valueReference": []}, {"name": "cost_fix_p", "type": "float array", "unit": "\u20ac/MW*a", "isAbout": [], "description": "Fixed operational costs per unit capacity", "valueReference": []}, {"name": "lifetime", "type": "float array", "unit": "a", "isAbout": [], "description": "Lifetime in operation.", "valueReference": []}, {"name": "wacc", "type": "text", "unit": "%", "isAbout": [], "description": "Percentage of costs for capital after taxes. Used to calculate annuity factor for investment costs.", "valueReference": []}, {"name": "bandwidth_type", "type": "json", "unit": null, "isAbout": [], "description": "Bandwidth Type", "valueReference": []}, {"name": "version", "type": "text", "unit": null, "isAbout": [], "description": "Version", "valueReference": []}, {"name": "method", "type": "json", "unit": null, "isAbout": [], "description": "Method", "valueReference": []}, {"name": "source", "type": "json", "unit": null, "isAbout": [], "description": "Source", "valueReference": []}, {"name": "comment", "type": "text", "unit": null, "isAbout": [], "description": "Comment", "valueReference": []}], "primaryKey": ["id"], "foreignKeys": []}, "dialect": {"delimiter": ";", "decimalSeparator": "."}, "profile": "tabular-data-resource", "encoding": "UTF-8"}], "description": "Techno-economic parameter for hydrogen pipelines that were retrofitted from natural gas pipelines in Germany.", "contributors": [{"date": "2024-04-29", "email": "g.mueller@fz-juelich.de", "title": "Gian M\u00fcller, FZJ", "object": "data and metadata", "comment": "Data for transport process of hydrogen by retrofitted pipeline in Germany."}], "metaMetadata": {"metadataLicense": {"name": "CC0-1.0", "path": "https://creativecommons.org/publicdomain/zero/1.0/", "title": "Creative Commons Zero v1.0 Universal"}, "metadataVersion": "OEP-1.5.2"}, "publicationDate": "2024-04-08"} \ No newline at end of file +{ + "@context": "https://raw.githubusercontent.com/OpenEnergyPlatform/oemetadata/develop/metadata/latest/context.json", + "@id": null, + "_comment": { + "dates": "Dates and time must follow the ISO8601 including time zone (YYYY-MM-DD or YYYY-MM-DDThh:mm:ss\u00b1hh)", + "languages": "Languages must follow the IETF (BCP47) format (en-GB, en-US, de-DE)", + "licenses": "License name must follow the SPDX License List (https://spdx.org/licenses/)", + "metadata": "Metadata documentation and explanation (https://github.com/OpenEnergyPlatform/oemetadata)", + "null": "If not applicable use: null", + "review": "Following the OEP Data Review (https://github.com/OpenEnergyPlatform/data-preprocessing/blob/master/data-review/manual/review_manual.md)", + "todo": "If a value is not yet available, use: todo", + "units": "Use a space between numbers and units (100 m)" + }, + "context": { + "contact": "g.mueller@fz-juelich.de", + "documentation": "https://sedos-project.github.io/.github/", + "fundingAgency": "Bundesministerium f\u00fcr Wirtschaft und Klimaschutz (BMWK)", + "fundingAgencyLogo": "https://en.wikipedia.org/wiki/Federal_Ministry_for_Economic_Affairs_and_Climate_Action#/media/File:BMWi_Logo_2021.svg", + "grantNo": "03EI1040D", + "homepage": "https://sedos-project.github.io/.github/", + "sourceCode": "https://github.com/sedos-project" + }, + "contributors": [ + { + "comment": "Data for transport process of hydrogen by retrofitted pipeline in Germany.", + "date": "2024-04-29", + "email": "g.mueller@fz-juelich.de", + "object": "data and metadata", + "title": "Gian M\u00fcller, FZJ" + } + ], + "description": "Techno-economic parameter for hydrogen pipelines that were retrofitted from natural gas pipelines in Germany.", + "id": null, + "keywords": [ + "SEDOS", + "AP5", + "X2X", + "oedatamodel-parameter", + "input_data" + ], + "language": [ + "en-GB" + ], + "licenses": [ + { + "attribution": null, + "instruction": "You are free: To Share, To Create, To Adapt", + "name": "CC0-1.0", + "path": "https://creativecommons.org/publicdomain/zero/1.0/legalcode", + "title": "Creative Commons Zero v1.0 Universal" + } + ], + "metaMetadata": { + "metadataLicense": { + "name": "CC0-1.0", + "path": "https://creativecommons.org/publicdomain/zero/1.0/", + "title": "Creative Commons Zero v1.0 Universal" + }, + "metadataVersion": "OEP-1.5.2" + }, + "name": "x2x_delivery_hydrogen_pipeline_retrofit_1", + "publicationDate": "2024-04-08", + "resources": [ + { + "dialect": { + "decimalSeparator": ".", + "delimiter": ";" + }, + "encoding": "UTF-8", + "format": "PostgreSQL", + "name": "model_draft.x2x_delivery_hydrogen_pipeline_retrofit_1", + "path": null, + "profile": "tabular-data-resource", + "schema": { + "fields": [ + { + "description": "Unique identifier", + "isAbout": [], + "name": "id", + "type": "bigint", + "unit": null, + "valueReference": [] + }, + { + "description": "Country or region", + "isAbout": [], + "name": "region", + "type": "text", + "unit": null, + "valueReference": [] + }, + { + "description": "Year", + "isAbout": [], + "name": "year", + "type": "integer", + "unit": "a", + "valueReference": [] + }, + { + "description": "Maximum allowed throughput power output capacity per process.", + "isAbout": [], + "name": "capacity_p_max", + "type": "float array", + "unit": "MW", + "valueReference": [] + }, + { + "description": "Commodity conversion factor of hydrogen before being transported", + "isAbout": [], + "name": "conversion_factor_sec_hydrogen_orig", + "type": "float array", + "unit": "MWh/MWh", + "valueReference": [] + }, + { + "description": "Commodity conversion factor of electricity demand for pipeline transport.", + "isAbout": [], + "name": "conversion_factor_sec_elec", + "type": "float array", + "unit": "MWh/MWh", + "valueReference": [] + }, + { + "description": "Commodity conversion factor of hydrogen after being transported", + "isAbout": [], + "name": "conversion_factor_sec_hydrogen", + "type": "float array", + "unit": "MWh/MWh", + "valueReference": [] + }, + { + "description": "Investment costs per unit capacity", + "isAbout": [], + "name": "cost_inv_p", + "type": "float array", + "unit": "\u20ac/MW", + "valueReference": [] + }, + { + "description": "Fixed operational costs per unit capacity", + "isAbout": [], + "name": "cost_fix_p", + "type": "float array", + "unit": "\u20ac/MW*a", + "valueReference": [] + }, + { + "description": "Lifetime in operation.", + "isAbout": [], + "name": "lifetime", + "type": "float array", + "unit": "a", + "valueReference": [] + }, + { + "description": "Percentage of costs for capital after taxes. Used to calculate annuity factor for investment costs.", + "isAbout": [], + "name": "wacc", + "type": "text", + "unit": "%", + "valueReference": [] + }, + { + "description": "Bandwidth Type", + "isAbout": [], + "name": "bandwidth_type", + "type": "json", + "unit": null, + "valueReference": [] + }, + { + "description": "Version", + "isAbout": [], + "name": "version", + "type": "text", + "unit": null, + "valueReference": [] + }, + { + "description": "Method", + "isAbout": [], + "name": "method", + "type": "json", + "unit": null, + "valueReference": [] + }, + { + "description": "Source", + "isAbout": [], + "name": "source", + "type": "json", + "unit": null, + "valueReference": [] + }, + { + "description": "Comment", + "isAbout": [], + "name": "comment", + "type": "text", + "unit": null, + "valueReference": [] + } + ], + "foreignKeys": [], + "primaryKey": [ + "id" + ] + } + } + ], + "review": null, + "sources": [ + { + "description": null, + "licenses": [ + { + "attribution": "Copyright \u00a9 2006 International Association for Hydrogen Energy. Published by Elsevier Ltd. All rights reserved.", + "instruction": null, + "name": null, + "path": null, + "title": null + } + ], + "path": "https://linkinghub.elsevier.com/retrieve/pii/S0360319906001765", + "title": "Determining the lowest-cost hydrogen delivery mode" + }, + { + "description": null, + "licenses": [ + { + "attribution": "Copyright. Frontier Economics, 2021.", + "instruction": null, + "name": null, + "path": null, + "title": null + } + ], + "path": "https://www.frontier-economics.com/media/ovdnwcyx/frontier-ptx-business-cases-studie_teil-2-pipelinetransport.pdf", + "title": "Teil 2: Pipeline Studie Kosten von gr\u00fcnem Wasserstoff Import via Pipelines" + }, + { + "description": null, + "licenses": [ + { + "attribution": "Copyright. DVGW Bonn, 2023.", + "instruction": null, + "name": null, + "path": null, + "title": null + } + ], + "path": "https://www.dvgw.de/medien/dvgw/leistungen/publikationen/gasnetz-rueckgrat-h2-welt.pdf", + "title": "Das Gasnetz - R\u00fcckgrat der Wasserstoffwelt" + } + ], + "spatial": { + "extent": null, + "location": "global", + "resolution": null + }, + "subject": [ + { + "name": "hydrogen", + "path": "http://openenergy-platform.org/ontology/oeo/OEO_00000220" + }, + { + "name": "pipeline", + "path": "" + } + ], + "temporal": { + "referenceDate": null, + "timeseries": [ + { + "aggregationType": null, + "alignment": null, + "end": null, + "resolution": null, + "start": null + } + ] + }, + "title": "sedos_x2x_delivery_hydrogen_pipeline_retrofit_1" +} diff --git a/tests/test_data/test_collections/test_bandwidth/collection.json b/tests/test_data/test_collections/test_bandwidth/collection.json index 9cdb00d..8220b3b 100644 --- a/tests/test_data/test_collections/test_bandwidth/collection.json +++ b/tests/test_data/test_collections/test_bandwidth/collection.json @@ -1 +1,30 @@ -{"name": "https://databus.openenergyplatform.org/felixmaur/collections/test_bandwidth", "version": "v3", "artifacts": {"SEDOS_x2x_sector": {"x2x_delivery_hydrogen_pipeline_new_1": {"latest_version": "srd_range_draft", "multiple_types": false, "names": ["x2x_delivery_hydrogen_pipeline_new_1"], "subjects": ["hydrogen_pipeline"], "datatype": 0}, "x2x_delivery_hydrogen_pipeline_retrofit_1": {"latest_version": "srd_range_draft", "multiple_types": false, "names": ["x2x_delivery_hydrogen_pipeline_retrofit_1"], "subjects": ["hydrogen_pipeline"], "datatype": 0}}}} \ No newline at end of file +{ + "artifacts": { + "SEDOS_x2x_sector": { + "x2x_delivery_hydrogen_pipeline_new_1": { + "datatype": 0, + "latest_version": "srd_range_draft", + "multiple_types": false, + "names": [ + "x2x_delivery_hydrogen_pipeline_new_1" + ], + "subjects": [ + "hydrogen_pipeline" + ] + }, + "x2x_delivery_hydrogen_pipeline_retrofit_1": { + "datatype": 0, + "latest_version": "srd_range_draft", + "multiple_types": false, + "names": [ + "x2x_delivery_hydrogen_pipeline_retrofit_1" + ], + "subjects": [ + "hydrogen_pipeline" + ] + } + } + }, + "name": "https://databus.openenergyplatform.org/felixmaur/collections/test_bandwidth", + "version": "v3" +} From a7cb8ef6886684cddbd6daeb1fe561457bdbb9d4 Mon Sep 17 00:00:00 2001 From: FelixMau Date: Wed, 17 Jul 2024 11:10:15 +0200 Subject: [PATCH 05/10] Only "full nan" --- data_adapter/preprocessing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_adapter/preprocessing.py b/data_adapter/preprocessing.py index 969fa3f..d7b2ee2 100644 --- a/data_adapter/preprocessing.py +++ b/data_adapter/preprocessing.py @@ -287,7 +287,7 @@ def __unpack_bandwidths(self, df: pd.DataFrame) -> pd.DataFrame: @staticmethod def __filter_subprocess(df: pd.DataFrame, subprocess: str) -> pd.DataFrame: df = df[df["type"] == subprocess] - df = df.dropna(axis=1) + df = df.dropna(axis=1, how="all") return df.drop("type", axis=1) @staticmethod From 5b8cf7def42216b15f5d2ac7c78a60589d9d0a8c Mon Sep 17 00:00:00 2001 From: yechenyan Date: Mon, 9 Sep 2024 01:20:03 +0800 Subject: [PATCH 06/10] feat: add emission_constraint --- data_adapter/structure.py | 24 ++++ .../emission_constraint_example.csv | 13 +++ .../emission_constraint_example.json | 108 ++++++++++++++++++ .../emission_constraint_example.xlsx | Bin 0 -> 11747 bytes tests/test_structure.py | 7 ++ 5 files changed, 152 insertions(+) create mode 100644 tests/test_data/test_structures/emission_constraint_example.csv create mode 100644 tests/test_data/test_structures/emission_constraint_example.json create mode 100644 tests/test_data/test_structures/emission_constraint_example.xlsx diff --git a/data_adapter/structure.py b/data_adapter/structure.py index 4c6375c..2ae273d 100644 --- a/data_adapter/structure.py +++ b/data_adapter/structure.py @@ -179,11 +179,33 @@ def get_nodes(nodes_raw): nodes += [node for node in nodes_raw_stripped.split(",") if node != ""] return nodes + def process_emission_constraint_inputs(processes_raw): + emi_outputs = [] + for output in processes_raw["output"]: + parts = output.split(",") + for part in parts: + part = part.strip() + if part.startswith("emi_"): + emi_outputs.append(part) + + emi_outputs = list(set(emi_outputs)) + emi_output_str = ",".join(emi_outputs) + + if (len(emi_outputs) == 0): + return processes_raw + + new_row = pd.DataFrame( + {"process": "emmission_constraint", "input": emi_output_str, "output": "co2_limit"}, index=[0] + ) + processes_raw = pd.concat([processes_raw, new_row], ignore_index=True) + return processes_raw + processes_raw = pd.read_excel( io=self.structure_file, sheet_name=process_sheet, usecols=("process", "input", "output"), ) + wb = load_workbook(self.structure_file, read_only=True) if helper_sheet in wb.sheetnames: helpers_raw = pd.read_excel( @@ -193,8 +215,10 @@ def get_nodes(nodes_raw): ) processes_raw = pd.concat([processes_raw, helpers_raw]) processes_raw = processes_raw.fillna("") + processes_raw = process_emission_constraint_inputs(processes_raw) check_character_convention(processes_raw, ["process"]) processes = processes_raw.to_dict(orient="records") + return { process["process"]: {"inputs": get_nodes(process["input"]), "outputs": get_nodes(process["output"])} for process in processes diff --git a/tests/test_data/test_structures/emission_constraint_example.csv b/tests/test_data/test_structures/emission_constraint_example.csv new file mode 100644 index 0000000..baec012 --- /dev/null +++ b/tests/test_data/test_structures/emission_constraint_example.csv @@ -0,0 +1,13 @@ +id;process;parameter;inputs;outputs +1;battery storage;e2p_ratio;electricity;electricity +2;battery storage;expansion_limit;electricity;electricity +3;battery storage;input_ratio;electricity;electricity +3;battery storage;output_ratio;electricity;electricity +4;battery storage;installed_capacity;electricity;electricity +5;energy transformation unit;emission_factor;ch4;co2 +6;energy transformation unit;expansion_limit;ch4;electricity, heat +7;energy transformation unit;input_ratio;ch4;electricity, heat +8;energy transformation unit;installed_capacity;ch4;electricity, heat +9;energy transformation unit;output_ratio;ch4;electricity, heat +10;onshore wind farm;expansion_limit;onshore;electricity +11;onshore wind farm;installed_capacity;onshore;electricity diff --git a/tests/test_data/test_structures/emission_constraint_example.json b/tests/test_data/test_structures/emission_constraint_example.json new file mode 100644 index 0000000..5e997e0 --- /dev/null +++ b/tests/test_data/test_structures/emission_constraint_example.json @@ -0,0 +1,108 @@ +{ + "battery storage": { + "e2p_ratio": { + "inputs": [ + "electricity" + ], + "outputs": [ + "electricity" + ] + }, + "expansion_limit": { + "inputs": [ + "electricity" + ], + "outputs": [ + "electricity" + ] + }, + "input_ratio": { + "inputs": [ + "electricity" + ], + "outputs": [ + "electricity" + ] + }, + "installed_capacity": { + "inputs": [ + "electricity" + ], + "outputs": [ + "electricity" + ] + }, + "output_ratio": { + "inputs": [ + "electricity" + ], + "outputs": [ + "electricity" + ] + } + }, + "energy transformation unit": { + "emission_factor": { + "inputs": [ + "ch4" + ], + "outputs": [ + "co2" + ] + }, + "expansion_limit": { + "inputs": [ + "ch4" + ], + "outputs": [ + "electricity", + "heat" + ] + }, + "input_ratio": { + "inputs": [ + "ch4" + ], + "outputs": [ + "electricity", + "heat" + ] + }, + "installed_capacity": { + "inputs": [ + "ch4" + ], + "outputs": [ + "electricity", + "heat" + ] + }, + "output_ratio": { + "inputs": [ + "ch4" + ], + "outputs": [ + "electricity", + "heat" + ] + } + }, + "onshore wind farm": { + "expansion_limit": { + "inputs": [ + "onshore" + ], + "outputs": [ + "electricity" + ] + }, + "installed_capacity": { + "inputs": [ + "onshore" + ], + "outputs": [ + "electricity" + ] + } + } +} diff --git a/tests/test_data/test_structures/emission_constraint_example.xlsx b/tests/test_data/test_structures/emission_constraint_example.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..84ff5466efed056ee81c326a2ac94b791f14e5e1 GIT binary patch literal 11747 zcmeHtgLhrq`gUwvjcwbu)7Z9cCvDW&w%xF??Z$4B#*O{$o^$Wlb9>JH3x0R)G1eSw zuJt~9tTkUg^Hr1q1w#XZ0D=Mn0wMzPu}Q_S1O@`i1qT8`1%d+67O}T;F|~8iSM_u- zb=IZ#u(ct~2LqwZ1p)y)|G(q^@D~_Q+_dUtL>oMZ^bU_-oe_N(#Z;+xGPO@W&L_B- zxnhtWl6iQ2>WN)-kBwYgSn$-Q=dojmxwc4UWfJC=-FMVp zGfYW~EV@ClmW>cMmYyMOt_gCybj7IWJJw4UlE&h+v|>yB|LwDj-#7$KK5z$ zaIaY;!yQI7{Ilc(_ahh((Ayg*km7$>XpU3$RdqCsP||2Kt}p|5@h$ zVRQV;t5?R$DfBVIg`G=2hY#N^tj8e<%eV_kwiBuP1xT$SHbobZ;;wg5;328v1cOTW zclte#uCDV&e;+2g-C?c#h=RsL((GOpmh$N63Q0}wlq~L8x!sTKws5m>ns5L03xnXo)4ZI+%a#|Hu`A%>#~_iUpTttx>iUH?gO_iB0#FXhs+6iw~WA z=CCp`E6P3dl*ABO?v1}zBkSc@mS;Z)bYI2r#YoUcg3=8@u==}^Y(T$If&lK!g8~8J z06_tJ*f9KQC+_x6)<*XB);|N;zikE>5X}J3{@*@25~i#GIx~14+!;LM>lklmn#kQ5 z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zYfhBRxr9d_-K7gtY)B;7jlTNT>eJ%c*>sQV9U4{}v$3BL7wWjqROG|EK=| z#sAmgqdX%I=!5g+xFksaV!zHU{Eb;We>j1Z+=%td!Y#-`mGw&R*7+$n7E-i*=UrxY zrt>*n@lzX&TW++)9vGQY6i8g zRP6g66fT~2js_&)Lr=^GfRez?ThW_?>bnn0ywgq(Fd0`rhxY=@f;L5;1?D*bLH0E& zF4~qt*5KG7qO-Yezi&qAK1U=YqoTSv_xsEY&ofiihUYn`$ldP8-3hxDIF@lY$3v+L-uf Date: Mon, 9 Sep 2024 12:41:29 +0800 Subject: [PATCH 07/10] =?UTF-8?q?test=EF=BC=9A=20add=20test=20for=20proces?= =?UTF-8?q?s=5Femission=5Fconstraint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_adapter/structure.py | 3 +++ tests/test_structure.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data_adapter/structure.py b/data_adapter/structure.py index 2ae273d..e5f62e6 100644 --- a/data_adapter/structure.py +++ b/data_adapter/structure.py @@ -180,6 +180,9 @@ def get_nodes(nodes_raw): return nodes def process_emission_constraint_inputs(processes_raw): + """Adds a new row where the "process" is "emmission_constraint" + and "input" consists of the emi_XXXX values from other rows. + """ emi_outputs = [] for output in processes_raw["output"]: parts = output.split(",") diff --git a/tests/test_structure.py b/tests/test_structure.py index eb14433..023f1ed 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -24,5 +24,6 @@ def test_processes(): def test_emission_constraint(): st = structure.Structure("emission_constraint_example") assert len(st.processes) == 8 - print('hi, ', st.processes["emmission_constraint"]) - # assert are_json_equal(st.processes["emmission_constraint"], {"inputs": ["emi_co2_neg_air_dacc", "emi_ch4_f_ind", "emi_n2o_f_ind", "emi_co2_f_ind"], "outputs": ["co2_limit"]}) + expected_input = {'emi_n2o_f_ind', 'emi_co2_neg_air_dacc', 'emi_co2_f_ind', 'emi_ch4_f_ind'} + assert set(st.processes["emmission_constraint"]['inputs']) == expected_input + From a66e8ea09c3af014a50bcd3fa29ed2815c229549 Mon Sep 17 00:00:00 2001 From: yechenyan Date: Mon, 9 Sep 2024 14:07:08 +0800 Subject: [PATCH 08/10] chore: delete unused code --- .../emission_constraint_example.csv | 13 --- .../emission_constraint_example.json | 108 ------------------ 2 files changed, 121 deletions(-) delete mode 100644 tests/test_data/test_structures/emission_constraint_example.csv delete mode 100644 tests/test_data/test_structures/emission_constraint_example.json diff --git a/tests/test_data/test_structures/emission_constraint_example.csv b/tests/test_data/test_structures/emission_constraint_example.csv deleted file mode 100644 index baec012..0000000 --- a/tests/test_data/test_structures/emission_constraint_example.csv +++ /dev/null @@ -1,13 +0,0 @@ -id;process;parameter;inputs;outputs -1;battery storage;e2p_ratio;electricity;electricity -2;battery storage;expansion_limit;electricity;electricity -3;battery storage;input_ratio;electricity;electricity -3;battery storage;output_ratio;electricity;electricity -4;battery storage;installed_capacity;electricity;electricity -5;energy transformation unit;emission_factor;ch4;co2 -6;energy transformation unit;expansion_limit;ch4;electricity, heat -7;energy transformation unit;input_ratio;ch4;electricity, heat -8;energy transformation unit;installed_capacity;ch4;electricity, heat -9;energy transformation unit;output_ratio;ch4;electricity, heat -10;onshore wind farm;expansion_limit;onshore;electricity -11;onshore wind farm;installed_capacity;onshore;electricity diff --git a/tests/test_data/test_structures/emission_constraint_example.json b/tests/test_data/test_structures/emission_constraint_example.json deleted file mode 100644 index 5e997e0..0000000 --- a/tests/test_data/test_structures/emission_constraint_example.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "battery storage": { - "e2p_ratio": { - "inputs": [ - "electricity" - ], - "outputs": [ - "electricity" - ] - }, - "expansion_limit": { - "inputs": [ - "electricity" - ], - "outputs": [ - "electricity" - ] - }, - "input_ratio": { - "inputs": [ - "electricity" - ], - "outputs": [ - "electricity" - ] - }, - "installed_capacity": { - "inputs": [ - "electricity" - ], - "outputs": [ - "electricity" - ] - }, - "output_ratio": { - "inputs": [ - "electricity" - ], - "outputs": [ - "electricity" - ] - } - }, - "energy transformation unit": { - "emission_factor": { - "inputs": [ - "ch4" - ], - "outputs": [ - "co2" - ] - }, - "expansion_limit": { - "inputs": [ - "ch4" - ], - "outputs": [ - "electricity", - "heat" - ] - }, - "input_ratio": { - "inputs": [ - "ch4" - ], - "outputs": [ - "electricity", - "heat" - ] - }, - "installed_capacity": { - "inputs": [ - "ch4" - ], - "outputs": [ - "electricity", - "heat" - ] - }, - "output_ratio": { - "inputs": [ - "ch4" - ], - "outputs": [ - "electricity", - "heat" - ] - } - }, - "onshore wind farm": { - "expansion_limit": { - "inputs": [ - "onshore" - ], - "outputs": [ - "electricity" - ] - }, - "installed_capacity": { - "inputs": [ - "onshore" - ], - "outputs": [ - "electricity" - ] - } - } -} From 68ad49553d58c2e8c0e9c28f40abcffad338ca1a Mon Sep 17 00:00:00 2001 From: yechenyan Date: Mon, 9 Sep 2024 14:11:47 +0800 Subject: [PATCH 09/10] fix: emmission -> emission --- data_adapter/structure.py | 8 +++++--- tests/test_structure.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/data_adapter/structure.py b/data_adapter/structure.py index e5f62e6..106e6d8 100644 --- a/data_adapter/structure.py +++ b/data_adapter/structure.py @@ -180,8 +180,10 @@ def get_nodes(nodes_raw): return nodes def process_emission_constraint_inputs(processes_raw): - """Adds a new row where the "process" is "emmission_constraint" + """Adds a new row where the "process" is "emission_constraint" and "input" consists of the emi_XXXX values from other rows. + + refer: https://github.com/sedos-project/data_adapter/pull/39 """ emi_outputs = [] for output in processes_raw["output"]: @@ -194,11 +196,11 @@ def process_emission_constraint_inputs(processes_raw): emi_outputs = list(set(emi_outputs)) emi_output_str = ",".join(emi_outputs) - if (len(emi_outputs) == 0): + if len(emi_outputs) == 0: return processes_raw new_row = pd.DataFrame( - {"process": "emmission_constraint", "input": emi_output_str, "output": "co2_limit"}, index=[0] + {"process": "emission_constraint", "input": emi_output_str, "output": "co2_limit"}, index=[0] ) processes_raw = pd.concat([processes_raw, new_row], ignore_index=True) return processes_raw diff --git a/tests/test_structure.py b/tests/test_structure.py index 023f1ed..230bc7c 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -25,5 +25,5 @@ def test_emission_constraint(): st = structure.Structure("emission_constraint_example") assert len(st.processes) == 8 expected_input = {'emi_n2o_f_ind', 'emi_co2_neg_air_dacc', 'emi_co2_f_ind', 'emi_ch4_f_ind'} - assert set(st.processes["emmission_constraint"]['inputs']) == expected_input + assert set(st.processes["emission_constraint"]['inputs']) == expected_input From e0fa88246ccb58ebd09f9dd9aacc9a8923bbe6db Mon Sep 17 00:00:00 2001 From: yechenyan Date: Wed, 11 Sep 2024 22:53:49 +0800 Subject: [PATCH 10/10] feat: add emi to ind_constraint_co2eq row --- data_adapter/structure.py | 16 ++++++++++------ .../emission_constraint_example.xlsx | Bin 11747 -> 11854 bytes tests/test_structure.py | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/data_adapter/structure.py b/data_adapter/structure.py index 106e6d8..85e175e 100644 --- a/data_adapter/structure.py +++ b/data_adapter/structure.py @@ -180,11 +180,18 @@ def get_nodes(nodes_raw): return nodes def process_emission_constraint_inputs(processes_raw): - """Adds a new row where the "process" is "emission_constraint" - and "input" consists of the emi_XXXX values from other rows. + """If there's a row in the table where the process is `ind_constraint_co2eq`, + take all unique values in the `output` column that start with `emi` and + place them into the `input` field of that row. refer: https://github.com/sedos-project/data_adapter/pull/39 """ + + ind_constraint_row = processes_raw[processes_raw["process"] == "ind_constraint_co2eq"] + + if ind_constraint_row.empty: + return processes_raw + emi_outputs = [] for output in processes_raw["output"]: parts = output.split(",") @@ -199,10 +206,7 @@ def process_emission_constraint_inputs(processes_raw): if len(emi_outputs) == 0: return processes_raw - new_row = pd.DataFrame( - {"process": "emission_constraint", "input": emi_output_str, "output": "co2_limit"}, index=[0] - ) - processes_raw = pd.concat([processes_raw, new_row], ignore_index=True) + processes_raw.loc[processes_raw["process"] == "ind_constraint_co2eq", "input"] = emi_output_str return processes_raw processes_raw = pd.read_excel( diff --git a/tests/test_data/test_structures/emission_constraint_example.xlsx b/tests/test_data/test_structures/emission_constraint_example.xlsx index 84ff5466efed056ee81c326a2ac94b791f14e5e1..3ce317eca405a868fd49e915c98a1cc1f4a0e087 100644 GIT binary patch delta 3493 zcmZ8kX*d)N*B+B??8Y{B3Mpd=Ws)V4-N+h^t?c_Ywls#x5-BkfV~-gU9>$g}>tKeg zk!1{}BFU1hS>E2~yRPqf-}n4DKh8PVb$*=t+~+<^h+&5s0T76Rk7LX93;+;~l>kA| za{(plyeRGQqccCRU6uivS$vaKQ%(2yYW>4O>>N|xy~$~jIn`GcC%xJrC%`u?7@s%CfAUb<{G% zf4g&i_L?$FxKIq}$cWyI`WL;Gr^#g7D5d;KJHU&Yt~FSwm;DS2UK{q^)GC#nLa!ya zYHHMslf{X~9Cl=3Nb-r$li2z;TT5A*_{%38)O*O#_K%q3l~UnR!hx}GlNFEwBh)I} z?CzeZ@X^A5h8!D^>pjRYl;L%qxm%6t>cVP~oA4~lZ}xae2DDc;8SHf4=%VZp>)4XBy02{ja*) z&$BV^DOWakN;e>Hn#=+ae#P{CO>%0qdBN9n-HkOIS{W*ud&7auIR0v52<1I~eE#%~ z@_=DkyH{Wp$70OYQ#RoU^FkM49q1R@7n3IQhtHu%V_QWjoHRB{i+$+<8j>U>F7pwY zW!^pb+CoH;utbt-xu4*M%-~OHY@C(r)$#OV4uRz!-iSD6OCHa95vc0)@|dsX?^89R+>A+<1#T-h5KX^MBLlHrKVc*RBh|dEU6xdQ#}&3 z41dFR0INwmms89Wvi%h8z;Sy8#}l&uC|^4^4!?2cn_1{%4`k$g`xCX`2<;ArB9Gd_lDuECmwDz2m@oktK-m zUF1?ZC>!yRZrRk1CE-rIu0Ut_Ze8u$g=kAz$hB+!^v=FhqJt;K6Y-rEA}sfFddYry zy>~SvA3l3VlFj2tEKzd)e30$%?rYuaBR=Yih1KNK5Ju-&cLmHTv9)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Pnl@eS-o7FvBqp}A9nmbutU6ZJ1_>b=s$LJ7LO!Z2j2lN?DmeP9_k6nxM%G_Uv_S9igIunXrRnwKhF56Q6-&7(TICn5gH zGDt}%&gXCqq1qT;_#+#R{u_8etc1kGf4v;E@COt@SX20INvfk{tF;$K6L;9 diff --git a/tests/test_structure.py b/tests/test_structure.py index 230bc7c..9af63d1 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -23,7 +23,8 @@ def test_processes(): def test_emission_constraint(): st = structure.Structure("emission_constraint_example") + processes_raw = st.processes assert len(st.processes) == 8 expected_input = {'emi_n2o_f_ind', 'emi_co2_neg_air_dacc', 'emi_co2_f_ind', 'emi_ch4_f_ind'} - assert set(st.processes["emission_constraint"]['inputs']) == expected_input + assert set(processes_raw['ind_constraint_co2eq']['inputs']) == expected_input