Skip to content

BUG - GLOWS L2 bin and flag labels being set as integers and are missing dimensions #2807

@sdhoyt

Description

@sdhoyt

Description of the issue

In the GLOWS L2 CDF product, the bin_label and flag_label coordinates are being set as integers rather than strings. This issue was detected when SKTEditor showed that the label metadata FORMAT field is set to A4 (string with 4 characters) but are an integer type.

Steps to reproduce the issue

I created the file where this issue was found using the following CLI command:

IMAP_API_KEY=<prod api key> imap_cli --instrument glows --data-level l2 --descriptor hist --start-date 20260128 --version v003 --dependency imap_glows_l2_hist-c499397b_20260128-repoint00140_v003.json  --repointing repoint00140

This should be reproducible with any L2 GLOWS file based on how the code is working though.

Expected vs Actual behavior

Example of issue from dataset output:

Coordinates:
  * epoch        (epoch) int64 8B 822866534339320960
  * bins         (bins) uint32 14kB 0 1 2 3 4 5 ... 3595 3596 3597 3598 3599
    bins_label   (record0) int64 8B -1
  * flags        (flags) uint8 17B 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    flags_label  (record0) int64 8B -1
  * ecliptic     (ecliptic) uint8 3B 0 1 2

bins_label and flags_label should be a string type and should have a dimension assigned (I think it should have itself assigned as its dimension).

Additional notes, affected areas, and suggested fixes

In glows_l2.py, these are hardcoded to -1 and no dimension is being set which is where the problem is originating

    bins_label = xr.DataArray(
        -1,
        name="bins_label",
        attrs=attrs.get_variable_attributes("bins_label", check_schema=False),
    )

    flags_label = xr.DataArray(
        -1,
        name="flags_label",
        attrs=attrs.get_variable_attributes("flags_label", check_schema=False),
    )


This code should be updated to look something like the following:

bin_label = xr.DataArray(
        <bins coordinate data>.astype(str),
        name="bins_label",
        dims=["bins_label"],
        attrs=cdf_attrs.get_variable_attributes("bins_label", check_schema=False),
    )

Where bins_label is a string version of the bins coordinate data.

Similar to #2810 and #2811

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ins: GLOWSRelated to the GLOWS instrumentLevel: L2Level 2 processingbugSomething isn't working

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions