khaeru/py-gdx

File.extract() fails when multiple dimensions indexed by sub-sets of same set

Closed this issue · 1 comments

Reported by @kmulvaney:

For a GAMS parameter like:

Parameter sectegy_fe(r,fe,g,t) sector energy use by type [mtce] /
…

…where fe is a subset of g, File.extract('sectegy_fe') raises an exception around the line:

                result = result.drop(drop, dim=p).swap_dims({p: c})

This is because both the second and third dimension are interpreted as being indexed by g, and it is not possible to make swap_dims swap only one.

Re-opened: should add a test case for this.