Skip to content

from_binary produces a confusing error when slc_files is empty #88

@gmarupilla

Description

@gmarupilla

If slc_files is an empty iterable, from_binary silently skips the read loop, slcs stays None, and the eventual ds.assign({vlabel: (("azimuth","range","time"), None)}) surfaces as:

ValueError: Variable 'complex': Could not convert tuple of form
(dims, data[, attrs, encoding]): (('azimuth', 'range', 'time'), None) to Variable.

It took me a while to trace this back to "no files were found". This is easy to hit when the user runs the tutorial notebook before downloading the dataset — path.rglob('*.raw') returns [] and the failure mode is opaque.

An early guard would make the failure obvious:

if len(slc_files) == 0:
    raise ValueError("`slc_files` is empty; no SLC files to read.")

(Filed in the context of JOSS review openjournals/joss-reviews#10492.)

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