def test_get_grid_node_count(self, tmp_path): filename = 'user_parameters.yml' p, f = create_temporary_file(tmp_path, filename) write_parameter_to_file(f, 'model_output__out_dir', tmp_path / 'out_dir') f.close() delta = BmiDelta() delta.initialize(p) _id = delta.get_var_grid('sea_water_surface__elevation') assert delta.get_grid_node_count(_id) == delta.get_grid_size(_id)
def test_get_grid_edge_count(self, tmp_path): filename = 'user_parameters.yml' p, f = create_temporary_file(tmp_path, filename) write_parameter_to_file(f, 'model_output__out_dir', tmp_path / 'out_dir') f.close() delta = BmiDelta() delta.initialize(p) _id = delta.get_var_grid('sea_water_surface__elevation') with pytest.raises(NotImplementedError): assert delta.get_grid_edge_count(_id)
def test_get_var_grid(self, tmp_path): filename = 'user_parameters.yml' p, f = create_temporary_file(tmp_path, filename) write_parameter_to_file(f, 'model_output__out_dir', tmp_path / 'out_dir') f.close() delta = BmiDelta() delta.initialize(p) assert type(delta.get_var_grid('sea_water_surface__elevation')) in [ np.int, np.float ]
def test_get_grid_nodes_per_face(self, tmp_path): filename = 'user_parameters.yml' p, f = create_temporary_file(tmp_path, filename) write_parameter_to_file(f, 'model_output__out_dir', tmp_path / 'out_dir') f.close() delta = BmiDelta() delta.initialize(p) _id = delta.get_var_grid('sea_water_surface__elevation') _arr = np.arange(9).reshape(3, 3) with pytest.raises(NotImplementedError): assert delta.get_grid_nodes_per_face(_id, _arr)
def test_get_grid_y(self, tmp_path): filename = 'user_parameters.yml' p, f = create_temporary_file(tmp_path, filename) write_parameter_to_file(f, 'model_output__out_dir', tmp_path / 'out_dir') f.close() delta = BmiDelta() delta.initialize(p) _id = delta.get_var_grid('sea_water_surface__elevation') assert delta.get_grid_y(_id).shape == (delta._delta.L, delta._delta.W) assert delta.get_grid_y(_id)[0, 0] == 0 assert delta.get_grid_y(_id)[0, 1] == 0 assert delta.get_grid_y(_id)[1, 1] == delta._delta.dx assert delta.get_grid_y(_id)[1, 0] == delta._delta.dx