66from typing import TYPE_CHECKING
77
88import pandas as pd
9- from genno import Computer , Key , Keys , KeySeq , MissingKeyError
9+ from genno import Computer , Key , Keys , MissingKeyError
1010from genno .core .key import single_key
1111from message_ix import Reporter
1212
@@ -133,16 +133,13 @@ def add_iamc_store_write(c: Computer, base_key) -> "Key":
133133
134134 .. todo:: Move upstream, to :mod:`message_ix_models`.
135135 """
136- k = KeySeq (base_key )
136+ k = Key (base_key )
137137
138138 file_keys = []
139139 for suffix in ("csv" , "xlsx" ):
140140 # Create the path
141141 path = c .add (
142- k [f"{ suffix } path" ],
143- "make_output_path" ,
144- "config" ,
145- name = f"{ k .base .name } .{ suffix } " ,
142+ k [f"{ suffix } path" ], "make_output_path" , "config" , name = f"{ k .name } .{ suffix } "
146143 )
147144 # Write `key` to the path
148145 file_keys .append (c .add (k [suffix ], "write_report" , base_key , path ))
@@ -163,12 +160,12 @@ def aggregate(c: "Computer") -> None:
163160
164161 config : Config = c .graph ["config" ]["transport" ]
165162
166- for key in map (lambda s : KeySeq (c .infer_keys (s )), "emi in out" .split ()):
163+ for key in map (lambda s : Key (c .infer_keys (s )), "emi in out" .split ()):
167164 try :
168165 # Reference the function to avoid the genno magic which would treat as sum()
169166 # NB aggregation on the nl dimension *could* come first, but this can use a
170167 # lot of memory when applied to e.g. out:*: for a full global model.
171- c .add (key [0 ], func , key . base , "t::transport agg" , keep = False )
168+ c .add (key [0 ], func , key , "t::transport agg" , keep = False )
172169 c .add (key [1 ], func , key [0 ], "nl::world agg" , keep = False )
173170 c .add (key ["transport" ], "select" , key [1 ], "t::transport modes 1" , sums = True )
174171 except MissingKeyError :
0 commit comments