def test_fill_undefined_data_parallel(comm): np.random.seed(comm.rank) local_data = np.random.uniform(size=(3, 1)) local_data[local_data > 0.9] = np.nan if comm.rank == 0: # make sure we always have undefined data local_data[0, 0] = np.nan topography = Topography(local_data, (1., 1.), info=dict(test=1), communicator=comm, decomposition="subdomain", nb_grid_pts=(3, comm.size), subdomain_locations=(0, comm.rank)) filled_topography = topography.fill_undefined_data(fill_value=-np.infty) assert topography.has_undefined_data assert not filled_topography.has_undefined_data mask = np.ma.getmask(topography.heights()) nmask = np.logical_not(mask) reduction = Reduction(comm) assert reduction.all(filled_topography[nmask] == topography[nmask]) assert reduction.all(filled_topography[mask] == -np.infty) assert not filled_topography.has_undefined_data
def test_a_clean_way(comm): pnp = Reduction(comm) pnp.all(True)