Example #1
0
def gribbability_check(cube):
    "We always need the following things for grib saving."

    # GeogCS exists?
    cs0 = cube.coord(dimensions=[0]).coord_system
    cs1 = cube.coord(dimensions=[1]).coord_system
    if cs0 is None or cs1 is None:
        raise iris.exceptions.TranslationError("CoordSystem not present")
    if cs0 != cs1:
        raise iris.exceptions.TranslationError("Inconsistent CoordSystems")

    # Regular?
    y_coord = cube.coord(dimensions=[0])
    x_coord = cube.coord(dimensions=[1])
    if not is_regular(x_coord) or not is_regular(y_coord):
        raise iris.exceptions.TranslationError(
            "Cannot save irregular grids to grib")

    # Time period exists?
    if not cube.coords("time"):
        raise iris.exceptions.TranslationError("time coord not found")

    # Forecast period exists?
    if not cube.coords("forecast_period"):
        raise iris.exceptions.TranslationError(
            "forecast_period coord not found")
Example #2
0
def gribbability_check(cube):
    "We always need the following things for grib saving."

    # GeogCS exists?
    cs0 = cube.coord(dimensions=[0]).coord_system
    cs1 = cube.coord(dimensions=[1]).coord_system
    if cs0 is None or cs1 is None:
        raise iris.exceptions.TranslationError("CoordSystem not present")
    if cs0 != cs1:
        raise iris.exceptions.TranslationError("Inconsistent CoordSystems")

    # Regular?
    y_coord = cube.coord(dimensions=[0])
    x_coord = cube.coord(dimensions=[1])
    if not is_regular(x_coord) or not is_regular(y_coord):
        raise iris.exceptions.TranslationError(
            "Cannot save irregular grids to grib")

    # Time period exists?
    if not cube.coords("time"):
        raise iris.exceptions.TranslationError("time coord not found")

    # Forecast period exists?
    if not cube.coords("forecast_period"):
        raise iris.exceptions.TranslationError(
            "forecast_period coord not found")
Example #3
0
def gribbability_check(cube):
    "We always need the following things for grib saving."

    # LatLonCS exists?
    cs0 = cube.coord(dimensions=[0]).coord_system
    cs1 = cube.coord(dimensions=[1]).coord_system
    if not (isinstance(cs0, iris.coord_systems.LatLonCS) and isinstance(cs1, iris.coord_systems.LatLonCS)):
        raise iris.exceptions.TranslationError("LatLonCS not present")
    
    # LatLonCS has a datum?
    if not isinstance(cs0.datum, iris.coord_systems.SpheroidDatum):
        raise iris.exceptions.TranslationError("LatLonCS does not have a datum")

    # Regular?
    y_coord = cube.coord(dimensions=[0])
    x_coord = cube.coord(dimensions=[1])
    if not is_regular(x_coord) or not is_regular(y_coord):
        raise iris.exceptions.TranslationError("Cannot save irregular grids to grib")

    # Time period exists?
    if not cube.coords("time"):
        raise iris.exceptions.TranslationError("time coord not found")

    # Forecast period exists?
    if not cube.coords("forecast_period"):
        raise iris.exceptions.TranslationError("forecast_period coord not found")