Thanks to visit codestin.com
Credit goes to github.com

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

    issue introduced since last releaseA bug that was introduced during development but is not part of a released version of the software.

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions