ratt-ru / dask-ms

Implementation of a dask/xarray dataset backed by a CASA MS
https://dask-ms.readthedocs.io
Other
19 stars 7 forks source link

parsing a malformed tuple with a single entry to xds_from_table #38

Closed SpheMakh closed 5 years ago

SpheMakh commented 5 years ago

Description

When a parse a malformed tuple to xds_from_table does not raise an exception but it ignores the specified entry. In the example below, the columns is parsed a malformed tuple ("DATA")

ds = xds_from_ms("msdir/ESO137-MeerKAT_OT-FULL-01.ms", columns=("DATA"))

No exception is raised but the DATA column is not loaded.

 Dimensions without coordinates: row
 Data variables:
     *empty*

When I use a proper tuple ("DATA",) it works

ds = xds_from_ms("msdir/ESO137-MeerKAT_OT-FULL-01.ms", columns=("DATA",))
bennahugo commented 5 years ago

It should probably just accept strings and tuples

sjperkins commented 5 years ago

Column handling logic is failing in some fashion here:

https://github.com/ska-sa/xarray-ms/blob/d4c52e43f5a7e41e17d8ce821a6d12b60e0691b3/xarrayms/xarray_ms.py#L783-L795

Referencing group_cols instead of index_cols on line 788.

and probably here:

https://github.com/ska-sa/xarray-ms/blob/d4c52e43f5a7e41e17d8ce821a6d12b60e0691b3/xarrayms/xarray_ms.py#L922-L937

The

elif not isinstance(something_cols, list):
    something_cols = [something_cols]

probably needs to be changed to:

if not isinstance(something_cols, list)
    something_cols = [something_cols]
sjperkins commented 5 years ago

Fixed by #40. Workaround till next release is to use lists of strings when supplying column names.