Пример #1
0
        args = parse_args()
        comm = MPI.COMM_WORLD
        rank = comm.Get_rank()

        profiler = None
        if args.profile:
            import cProfile

            profiler = cProfile.Profile()
            profiler.disable()

        fv3core.set_backend(args.backend)
        fv3core.set_rebuild(False)
        fv3core.set_validate_args(False)

        spec.set_namelist(args.data_dir + "/input.nml")

        experiment_name = os.path.basename(os.path.normpath(args.data_dir))

        # set up of helper structures
        serializer = serialbox.Serializer(
            serialbox.OpenModeKind.Read,
            args.data_dir,
            "Generator_rank" + str(rank),
        )
        if args.disable_halo_exchange:
            mpi_comm = NullComm(MPI.COMM_WORLD.Get_rank(),
                                MPI.COMM_WORLD.Get_size())
        else:
            mpi_comm = MPI.COMM_WORLD
Пример #2
0
                                0]  # take the first column since they should be the same
        quantity_1d = Quantity.from_data_array(
            xr.DataArray(data_1d,
                         attrs=quantity.attrs,
                         dims=[quantity.dims[0]]),
            origin=[quantity.origin[0]],
            extent=[quantity.extent[0]],
        )
        return_state[field] = quantity_1d
    return return_state


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
Пример #3
0
def set_up_namelist(data_directory: str) -> None:
    """
    Reads the namelist at the given directory and sets
    the global fv3core config to it
    """
    spec.set_namelist(data_directory + "/input.nml")