def test_computable_mvars(self): # for debugging we draw the sparse_powerset_graph of the actually present computers and mvars spsg = sparse_powerset_graph(bgc_md2_computers()) f = plt.figure() ax = f.add_subplot(1, 1, 1) draw_ComputerSetMultiDiGraph_matplotlib(ax, spsg, bgc_md2_mvar_aliases(), bgc_md2_computer_aliases(), targetNode=frozenset( {SmoothModelRun})) f.savefig("spgs.pdf") fig = plt.figure() draw_update_sequence(bgc_md2_computers(), max_it=8, fig=fig) fig.savefig("c1.pdf") # https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests for mn in [ "Potter1993GlobalBiogeochemicalCycles", "testVectorFree", "Williams2005GCB", # just uncomment the one model you are working on and comment the others ]: with self.subTest(mn=mn): mvs = MVarSet.from_model_name(mn) mvars = mvs.computable_mvar_types() list_str = "\n".join( ["<li> " + str(var.__name__) + " </li>" for var in mvars]) print(list_str) for var in mvars: print("########################################") print(str(var.__name__)) print(mvs._get_single_mvar_value(var))
def test_update_generator_bgc_md2(self): fig = plt.figure() draw_update_sequence( bgc_md2_computers(), 8, fig, bgc_md2_mvar_aliases(), bgc_md2_computer_aliases(), ) fig.savefig("c1.pdf")
def test_ComputerSetMultiGraph_matplotlib_bgc_md2(self): # The direct visualization of networkx (using matplotlib) # is very rudimentary. spsg = sparse_powerset_graph(bgc_md2_computers()) fig = plt.figure(figsize=(20, 20)) ax = fig.add_subplot(1, 1, 1) draw_ComputerSetMultiDiGraph_matplotlib( ax, spsg, bgc_md2_mvar_aliases(), bgc_md2_computer_aliases(), ) fig.savefig("SetMultiGraph.pdf")
def test_computable_mvars(self): spsg=sparse_powerset_graph(bgc_md2_computers()) f = plt.figure() ax = f.add_subplot(1,1,1) draw_ComputerSetMultiDiGraph_matplotlib( ax, spsg, bgc_md2_mvar_aliases(), bgc_md2_computer_aliases(), targetNode=frozenset({SmoothModelRun}) ) f.savefig("spgs.pdf") fig = plt.figure() draw_update_sequence(bgc_md2_computers(), max_it=8, fig=fig) fig.savefig("c1.pdf") mvs=self.mvs mvars = mvs.computable_mvar_types() list_str = "\n".join(["<li> " + str(var.__name__) + " </li>" for var in mvars]) print(list_str) for var in mvars: print("########################################") print(str(var.__name__)) print(mvs._get_single_mvar_value(var))