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.
Iris has this nice
callbackfunctionality 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 acallbackfunctionality would be a nice addition topysgrid.@ayan-usgs The way iris does this is by patching the "future cube" metadata. For example:
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.