Skip to content

Error in SwathDefinition html representation if lon/lat arrays are dask arrays #609

Closed
@BENR0

Description

@BENR0

Code Sample, a minimal, complete, and verifiable piece of code

This was discovered while using the li_l2_nc reader but affects all SwathDefinitions where the lat/lon DataArrays don't have a resolution set in the attributes.

Problem description

If lon/lat data in the SwathDefinition are dask arrays the html representation throws a type error due to None Type not having a round method because no resolution can be found in the attributes.

Especially in the Li point data case this problem might not be easily solveable.

Expected Output

A html represetation of the SwathDefinition.

Actual Result, Traceback if applicable

    260     # use resolution from lat/lons dataarray attributes -> are these always set? -> Maybe try/except?
    261     area_name = f"{lon_attrs.get('sensor')} swath"
--> 262     resolution_str = "/".join([str(round(x.get("resolution"), 1)) for x in [lat_attrs, lon_attrs]])
    263     area_units = "m"
    265 height, width = area.lons.shape

TypeError: type NoneType doesn't define __round__ method

Versions of Python, package at hand and relevant dependencies

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