Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix name of profile in field efficiency #118

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,22 @@ field names in the generators-profile resource.
non-valid resources.**


If resources are passed with a key other than "profile" (e.g. marginal_cost or
efficiency), the foreign keys must also be updated with this key. In this case,
the name of the resource is composed of the components name and the key:

.. code-block:: json

"foreignKeys": [
{
"fields": "marginal_cost",
"reference": {
"resource": "generator_marginal_cost_profile"
}
}
]


Scripting
=========================
Currently the only way to construct a model and compute it is by using the
Expand Down
4 changes: 3 additions & 1 deletion src/oemof/tabular/datapackage/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ def infer_metadata(
r.descriptor["schema"]["foreignKeys"].append(
{
"fields": key,
"reference": {"resource": key + "_profile"},
"reference": {
"resource": r.name + "_" + key + "_profile"
},
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
{
"fields": "marginal_cost",
"reference": {
"resource": "marginal_cost_profile"
"resource": "component_marginal_cost_profile"
}
},
{
Expand All @@ -128,9 +128,9 @@
}
},
{
"path": "data/sequences/component_profile.csv",
"path": "data/sequences/component_marginal_cost_profile.csv",
"profile": "tabular-data-resource",
"name": "component_profile",
"name": "component_marginal_cost_profile",
"format": "csv",
"mediatype": "text/csv",
"encoding": "utf-8",
Expand All @@ -142,12 +142,7 @@
"format": "default"
},
{
"name": "electricity-load-profile",
"type": "number",
"format": "default"
},
{
"name": "dispatchable-profile",
"name": "marginal-cost-coal",
"type": "integer",
"format": "default"
}
Expand All @@ -158,9 +153,9 @@
}
},
{
"path": "data/sequences/marginal_cost_profile.csv",
"path": "data/sequences/component_profile.csv",
"profile": "tabular-data-resource",
"name": "marginal_cost_profile",
"name": "component_profile",
"format": "csv",
"mediatype": "text/csv",
"encoding": "utf-8",
Expand All @@ -172,7 +167,12 @@
"format": "default"
},
{
"name": "marginal-cost-coal",
"name": "electricity-load-profile",
"type": "number",
"format": "default"
},
{
"name": "dispatchable-profile",
"type": "integer",
"format": "default"
}
Expand All @@ -183,4 +183,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion src/oemof/tabular/tools/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def component_results(es, results, select="sequences"):
setattr(es, "typemap", facades.TYPEMAP)

for k, v in es.typemap.items():
if type(k) == str:
if isinstance(k, str):
if select == "sequences":
_seq_by_type = [
views.node(results, n, multiindex=True).get("sequences")
Expand Down
Loading