Skip to content

BUG: Fillval does not allow string inputs for string variables #995

Open
@jklenzing

Description

@jklenzing

Describe the bug
Some datasets include strings in the data. An example is the channel, hemisphere, and scan information in the GOLD dataset. A numeric FillVal does not make sense here, but pysat requires the FillVal to be numeric.

To Reproduce

Load a GOLD NMAX file with xarray, inspect the variable "channel":

<xarray.DataArray 'channel' (nscans: 24)>
array([b'CHB', b'CHB', b'CHB', b'CHB', b'CHB', b'CHB', b'CHB', b'CHB',
       b'CHB', b'CHB', b'CHB', b'CHB', b'CHB', b'CHA', b'CHB', b'CHA',
       b'CHA', b'CHB', b'CHA', b'CHB', b'CHA', b'CHB', b'CHB', b'CHA'],
      dtype='|S50')
Dimensions without coordinates: nscans
Attributes:
    FORMAT:    A1
    FILLVAL:   *
    FIELDNAM:  Channel
    DEPEND_0:  nscans
    CATDESC:   Channel identifier ("A" or "B")
    VAR_TYPE:  metadata

Load the same file with pysat. The FILLVAL is dropped.

Expected behavior
pysat should check that the fillval type matches the format.

Additional context
discovered while working on pysat/pysatNASA#110

Seeing both in develop and in #983.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions