Skip to content

Provide a callback mechanism for non-compliant dataset #63

@ocefpaf

Description

@ocefpaf

Iris has this nice callback functionality that allow users to "patch" the metadata and force compliance at loading time. Since there are virtually no sgrid compliant data yet I guess that a callback functionality would be a nice addition to pysgrid.

@ayan-usgs The way iris does this is by patching the "future cube" metadata. For example:

def hycom_callback(cube, field, filename):
    """
    Fix non-CF metadata.

    """
    if cube.name() == "Water Surface Elevation"
        cube.standard_name = "sea_surface_elevation"
        return cube

I think that pysgrid can do this at the raw netCDF4-python level by patching the attributes instead. If a non-netCDF sgrid dataset ever exist it will be easier to load it into a netCDF-like object than creating a new object just for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions