Exemplo n.º 1
0
if __name__ == "__main__":

    # read in the namelist
    spec.set_namelist("input.nml")
    dt_atmos = spec.namelist.dt_atmos

    # set backend
    fv3core.set_backend("numpy")

    # get another namelist for the communicator??
    nml2 = yaml.safe_load(
        open("/fv3core/examples/wrapped/config/c12_6ranks_standard.yml",
             "r"))["namelist"]

    sizer = SubtileGridSizer.from_namelist(nml2)
    allocator = QuantityFactory.from_backend(sizer, fv3core.get_backend())

    # MPI stuff
    comm = mpi4py.MPI.COMM_WORLD
    rank = comm.Get_rank()
    cube_comm = CubedSphereCommunicator(
        comm, CubedSpherePartitioner.from_namelist(nml2))

    # Set the names of quantities in State. This is everything coming from
    # wrapper.initialize.
    initial_names = [
        "specific_humidity",
        "cloud_water_mixing_ratio",
        "rain_mixing_ratio",
        "snow_mixing_ratio",
        "cloud_ice_mixing_ratio",
Exemplo n.º 2
0
def test_set_backend():
    start_backend = fv3core.get_backend()
    new_backend = "new_backend"
    assert new_backend != start_backend
    fv3core.set_backend(new_backend)
    assert fv3core.get_backend() == new_backend