You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to add regions, the function add_region() is used. The respective region name, hierarchy and parent can be defined. If a synonym should be added for a given region, then this must be done using add_region_synonym(). The key is though that the definition of the synonym must be done prior to adding the region.
This can be replicated by carrying out the following code snippet:
import message_ix
import ixmp
mp = ixmp.Platform(name="<database_a>")
mp2 = ixmp.Platform(name="<database_b>")
# Copy units
for u in mp.units():
mp2.add_unit(u)
df = mp.regions()
for i in df.index:
mp2.add_region(region=df.iloc[i].region,
hierarchy=df.iloc[i].hierarchy,
parent=df.iloc[i].parent)
if df.iloc[i].mapped_to is not None:
mp2.add_region_synonym(region=df.iloc[i].region,
mapped_to=df.iloc[i].mapped_to)
The correct way of doing this:
import message_ix
import ixmp
mp = ixmp.Platform(name="<database_a>")
mp2 = ixmp.Platform(name="<database_b>")
# Copy units
for u in mp.units():
mp2.add_unit(u)
df = mp.regions()
for i in df.index:
if df.iloc[i].mapped_to is not None:
mp2.add_region_synonym(region=df.iloc[i].region,
mapped_to=df.iloc[i].mapped_to)
mp2.add_region(region=df.iloc[i].region,
hierarchy=df.iloc[i].hierarchy,
parent=df.iloc[i].parent)
Note, there is not way of modifying and existing entry using the python api.
The text was updated successfully, but these errors were encountered:
In order to add regions, the function
add_region()
is used. The respectiveregion
name,hierarchy
andparent
can be defined. If a synonym should be added for a given region, then this must be done usingadd_region_synonym()
. The key is though that the definition of the synonym must be done prior to adding the region.This can be replicated by carrying out the following code snippet:
The correct way of doing this:
Note, there is not way of modifying and existing entry using the python api.
The text was updated successfully, but these errors were encountered: