diff --git a/pyresample/_formatting_html.py b/pyresample/_formatting_html.py index d1a087fe..3a131359 100644 --- a/pyresample/_formatting_html.py +++ b/pyresample/_formatting_html.py @@ -244,25 +244,30 @@ def swath_area_attrs_section(area: 'geom.SwathDefinition') -> str: # noqa F821 - Improve resolution estimation from lat/lon arrays. Maybe use CoordinateDefinition.geocentric_resolution? """ - if isinstance(area.lons, np.ndarray) & isinstance(area.lats, np.ndarray): - # Calculate and estimated resolution from lats/lons in meter - area_name = "Arbitrary Swath" - resolution_y = np.mean(area.lats[0:-1, :] - area.lats[1::, :]) - resolution_x = np.mean(area.lons[:, 1::] - area.lons[:, 0:-1]) - resolution = np.mean(np.array([resolution_x, resolution_y])) - resolution = np.round(40075000 * resolution / 360, 1) - resolution_str = f"{resolution}/{resolution}" + if np.ndim(area.lons) == 1: + area_name = "1D Swath" + resolution_str = "NAxNA" + height, width = "NA", "NA" area_units = "m" else: - lon_attrs = area.lons.attrs - lat_attrs = area.lats.attrs + if isinstance(area.lons, np.ndarray) and isinstance(area.lats, np.ndarray): + # Calculate and estimated resolution from lats/lons in meter + area_name = "Arbitrary Swath" + resolution_y = np.mean(area.lats[0:-1, :] - area.lats[1::, :]) + resolution_x = np.mean(area.lons[:, 1::] - area.lons[:, 0:-1]) + resolution = np.mean(np.array([resolution_x, resolution_y])) + resolution = np.round(40075000 * resolution / 360, 1) + resolution_str = f"{resolution}x{resolution}" + else: + lon_attrs = area.lons.attrs + lat_attrs = area.lats.attrs + + # use resolution from lat/lons dataarray attributes -> are these always set? -> Maybe try/except? + area_name = f"{lon_attrs.get('sensor')} Swath" + resolution_str = "x".join([str(round(x.get("resolution"), 1)) for x in [lat_attrs, lon_attrs]]) - # use resolution from lat/lons dataarray attributes -> are these always set? -> Maybe try/except? - area_name = f"{lon_attrs.get('sensor')} swath" - resolution_str = "/".join([str(round(x.get("resolution"), 1)) for x in [lat_attrs, lon_attrs]]) area_units = "m" - - height, width = area.lons.shape + height, width = area.lons.shape attrs_icon = _icon("icon-file-text2") @@ -270,7 +275,7 @@ def swath_area_attrs_section(area: 'geom.SwathDefinition') -> str: # noqa F821 # f"
Area name
{area_name}
" f"
Description
{area_name}
" f"
Width/Height
{width}/{height} Pixel
" - f"
Resolution x/y (SSP)
{resolution_str} {area_units}
" + f"
Resolution XxY (SSP)
{resolution_str} {area_units}
" "" ) diff --git a/pyresample/static/css/style.css b/pyresample/static/css/style.css index a84a491c..8cfef56b 100644 --- a/pyresample/static/css/style.css +++ b/pyresample/static/css/style.css @@ -29,7 +29,7 @@ body.vscode-dark { .pyresample-wrap { display: block !important; min-width: 700px; - max-width: 900px; + max-width: 1050px; } .pyresample-text-repr-fallback { @@ -90,19 +90,6 @@ body.vscode-dark { margin-right: 0.5em; } -/* und noch der Doppelpunkt */ -.pyresample-area-section-details dt:after { - content: ": "; -} - -/* ein Clearfix für Folge-dd-Elemente */ -.pyresample-area-section-details dd:after { - clear: left; - content: " "; - display: block; -} -/* end attribute list formatting */ - .pyresample-area-sections { display: grid; grid-template-columns: auto;