rl-institut / oemof-B3

An open-source energy system model for Brandenburg/Berlin.
https://oemof-b3.readthedocs.io/
GNU Affero General Public License v3.0
9 stars 5 forks source link

Features/set delimiter in config #277

Closed MaGering closed 1 year ago

MaGering commented 1 year ago

Resolves #252

With this PR

The second bulletpoint is to ensure that the input data and results of oemof-B3 have the same separator.

MaGering commented 1 year ago

@jnnr: I have a problem in my commit https://github.com/rl-institut/oemof-B3/pull/277/commits/39f7e3940a769d1fa367c02c225e3412b1a04912. I wanted to set oemoflexconfig.config.settings.SEPARATOR (general separator in oemoflex) to config.settings.general.separator (general separator in oemof-B3). But as soon as I do this I get the following error:

    raise BoxKeyError(str(E)) from _A
dynaconf.vendor.box.exceptions.BoxKeyError: "'DynaBox' object has no attribute 'SEPARATOR'"

Somehow the two configs processed by dynaconf must conflict with each other. You can test this locally by changing

SEP = ";"

to

 SEP = get_separator()

I've tried to use the same name for the attribute (SEPARATOR) in both configs and repos but the error somehow persists with DynaBox remembering the old attribute.

Do you know how we can solve this?

MaGering commented 1 year ago

@jnnr: I have a problem in my commit 39f7e39. I wanted to set oemoflexconfig.config.settings.SEPARATOR (general separator in oemoflex) to config.settings.general.separator (general separator in oemof-B3). But as soon as I do this I get the following error:

    raise BoxKeyError(str(E)) from _A
dynaconf.vendor.box.exceptions.BoxKeyError: "'DynaBox' object has no attribute 'SEPARATOR'"

Somehow the two configs processed by dynaconf must conflict with each other. You can test this locally by changing

SEP = ";"

to

 SEP = get_separator()

I've tried to use the same name for the attribute (SEPARATOR) in both configs and repos but the error somehow persists with DynaBox remembering the old attribute.

Do you know how we can solve this?

I found a way to solve this. It unfortunately deviates from our usual way of handling the values in settings.yaml, but works: https://github.com/rl-institut/oemof-B3/pull/277/commits/c3eb020b22236bc30cc9d9566e71a33fb6c151d9 and https://github.com/rl-institut/oemof-B3/pull/277/commits/aa86f9985aeb00df7fabe581adb5fe49d2a2f99c.

MaGering commented 1 year ago

I no longer encountered the error from this comment. So I reverted commits https://github.com/rl-institut/oemof-B3/pull/277/commits/c3eb020b22236bc30cc9d9566e71a33fb6c151d9 and https://github.com/rl-institut/oemof-B3/pull/277/commits/aa86f9985aeb00df7fabe581adb5fe49d2a2f99c and set the oemoflex separator to the one from the oemof B3 settings. @jnnr could you test if this works for you too?