parser.add_argument("--gams_sysdir", dest="gams_sysdir", default=None, type=str) parser.add_argument("--data_repo", dest="data_repo", default=None, type=str) parser.add_argument("--output", dest="output", default=None, type=str) parser.add_argument("--data_dir", dest="data_dir", default=None, type=str) # parser.set_defaults(gams_sysdir="some path here") # parser.set_defaults(data_repo="some path here") # parser.set_defaults(data_dir="some path here") args = parser.parse_args() # # # get network data gdx = gmsxfr.GdxContainer( args.gams_sysdir, os.path.join(args.data_repo, "processed_werewolf_data.gdx") ) gdx.rgdx(["lat", "lng", "map_aggr"]) lat = gdx.to_dict("lat") lng = gdx.to_dict("lng") map_aggr = gdx.to_dataframe("map_aggr") gdx = gmsxfr.GdxContainer( args.gams_sysdir, os.path.join(args.data_repo, "network_arcs.gdx") ) gdx.rgdx("ij") ij = gdx.to_dict("ij") gdx = gmsxfr.GdxContainer(
type=str) parser.add_argument("--data_repo", dest="data_repo", default=None, type=str) parser.add_argument("--output", dest="output", default=None, type=str) # parser.set_defaults(gams_sysdir="some path here") # parser.set_defaults(data_repo="some path here") args = parser.parse_args() # # # get model results gdx = gmsxfr.GdxContainer(args.gams_sysdir, os.path.join(args.data_repo, "solve_mode.gdx")) gdx.rgdx(["x_title"]) x_title = gdx.to_dict("x_title")["text"] gdx = gmsxfr.GdxContainer( args.gams_sysdir, os.path.join(args.data_repo, "final_results.gdx")) gdx.rgdx(["TotalCost", "ExpCost_ir", "ExpCost_r", "frac_r", "cntlreg"]) TotalCost = gdx.to_dict("TotalCost") ExpCost_r = gdx.to_dataframe("ExpCost_r") ExpCost_ir = gdx.to_dataframe("ExpCost_ir") carbon = { i: gdx.to_dict("frac_r")["elements"][i] if gdx.to_dict("frac_r")["elements"][i] > np.finfo(float).tiny else 0 for i in gdx.to_dict("frac_r")["elements"]
parser.add_argument("--gams_sysdir", dest="gams_sysdir", default=None, type=str) parser.add_argument("--data_repo", dest="data_repo", default=None, type=str) # parser.set_defaults(gams_sysdir="some path here") # parser.set_defaults(data_repo="some path here") args = parser.parse_args() gdx = gmsxfr.GdxContainer( args.gams_sysdir, os.path.join(args.data_repo, "processed_werewolf_data.gdx")) gdx.rgdx(["i", "lat", "lng", "map_aggr"]) i = gdx.to_dataframe("i") lat = gdx.to_dataframe("lat") lng = gdx.to_dataframe("lng") map_aggr = gdx.to_dataframe("map_aggr") agg = i["elements"].set_index("regions").copy() agg["lat"] = lat["elements"].set_index("regions") agg["lng"] = lng["elements"].set_index("regions") agg_pts = dict(zip(agg.index, list(zip(agg.lat, agg.lng))))