Skip to content

KeyError: 'valid_range' when loading AIRS-2-0 data #3152

Description

@schlunma

The fix for hur of AIRS-2-0 expects the valid_range attribute:

class Hur(Fix):
"""Fixes for hur."""
def fix_metadata(self, cubes):
"""Fix metadata.
Convert units from `1` to `%` and remove `valid_range` attribute.
Parameters
----------
cubes: iris.cube.CubeList
Input cubes.
Returns
-------
iris.cube.CubeList
Fixed cubes.
"""
for cube in cubes:
# Put information from valid_range into mask and remove the
# attribute (otherwise this will cause problems after reloading the
# data with different units)
valid_range = cube.attributes["valid_range"]
cube.data = da.ma.masked_outside(cube.core_data(), *valid_range)
cube.attributes.pop("valid_range", None)
cube.convert_units("%")
return cubes

This has been removed in #3072.

This bug has not been published in any release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfix for datasetRelated to dataset-specific fix files

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions