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

Inconsistently appearing exception with conversion_plus technologies #54

Closed
sjpfenninger opened this issue Jun 15, 2017 · 5 comments
Closed
Labels

Comments

@sjpfenninger
Copy link
Member

Shows up in test_model_conversion.py and in test_model_export.py, but not always. Running tests over and over again will eventually lead to an exception:

calliope/test/test_model_conversion.py:52: in create_and_run_model
    model.run()
calliope/core.py:1416: in run
    self.load_solution()
calliope/core.py:1588: in load_solution
    self.process_solution()
calliope/core.py:1550: in process_solution
    md = self.get_metadata()
calliope/core.py:1774: in get_metadata
    lambda y: self.get_carrier(y, direction='in', all_carriers=True))
../../../../Anaconda/envs/calliope/lib/python3.6/site-packages/pandas/core/indexes/base.py:2780: in map
    names=attributes.get('name'))
../../../../Anaconda/envs/calliope/lib/python3.6/site-packages/pandas/core/indexes/multi.py:1144: in from_tuples
    arrays = list(lib.tuples_to_object_array(tuples).T)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   TypeError: Expected tuple, got str

tuples contains :

(Pdb) p tuples
array([('power', 'heat', 'gas'), 'resource', 'heat', 'low_T', 'resource',
       'resource', 'power', 'resource', 'resource', 'resource', 'V_low_T',
       'power'], dtype=object)
@sjpfenninger
Copy link
Member Author

Appears to be limited to pandas 0.20.

@sjpfenninger
Copy link
Member Author

Downgrading to pandas 0.19 for now in 901dff4

@sjpfenninger
Copy link
Member Author

Related to the random order of technologies set, y.

If a conversion plus tech is first, e.g. test_conversion_plus in the test cases, a tuple is returned for self.get_carrier(y, direction='in', all_carriers=True). This trips up a pandas helper function which then expects more tuples, but gets only strings.

@brynpickering
Copy link
Member

This causes issues with saving to a NetCDF solution file (if using the newest version of Pyomo), as the tuples in the metadata DataArray trip it up. Solution file fails to save, which only comes up as an issue after optimisation (so there is no solution file available after several hours of computational work...)

@brynpickering
Copy link
Member

Temporarily solved by keeping Pandas version below 0.20.0. Long term solution is to avoid mixed dtypes in the input.output xarray Dataset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants