How to use the metview.read function in metview

To help you get started, we’ve selected a few metview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esowc / ecPoint-Calibrate / core / loaders / fieldset.py View on Github external
def from_path(cls, path: Union[Path, str]):
        if isinstance(path, Path):
            path = str(path)

        if not os.path.exists(path):
            raise IOError(f"File does not exist: {path}")

        obj = metview.read(path)
        obj.__class__ = cls
        return obj
github esowc / ecPoint-Calibrate / core / loaders / fieldset.py View on Github external
def from_path(cls, path: Union[Path, str]):
        if isinstance(path, Path):
            path = str(path)

        mv_instance = metview.read(path)

        dataset = mv_instance.to_dataset()
        data_vars = list(dataset.data_vars)
        coords = list(
            {"lat", "lon", "latitude", "longitude", "latitudes", "longitudes"}
            & set(dataset.coords)
        )

        df = dataset.to_dataframe().reset_index()

        df = df[coords + data_vars]

        for coord in coords:
            df[coord] = df[coord].apply(str)

        return cls(df)
github esowc / ecPoint-Calibrate / core / loaders / geopoints.py View on Github external
def read_geopoints(path: Union[Path, str]):
    if isinstance(path, Path):
        path = str(path)

    if not os.path.exists(path):
        raise IOError(f"File does not exist: {path}")

    return metview.read(path)