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

xds_from_storage functions should ignore unsupported kwargs #175

Closed JSKenyon closed 2 years ago

JSKenyon commented 2 years ago

Description

When attempting to switch to xds_from_storage_table and xds_from_storage_ms I was blocked by the fact that the kwargs are not accepted across all the backends. The errors are typically something like:

TypeError: xds_from_zarr() got an unexpected keyword argument 'index_cols'

What I Did

xds_from_storage_ms(
        "path/to/ms",
        columns=("TIME", "INTERVAL"),
        index_cols=("TIME",),
        group_cols=("FIELD_ID", "DATA_DESC_ID", "SCAN_NUMBER"),
        chunks={"row": -1}
    )

Desired behaviour

In my opinion, all the backends should support the kwargs they can and raise warnings/ignore those they cannot. It would be even better if they were all fully compatible, but I realise that that may not be possible.

sjperkins commented 2 years ago

In general xds_{from,to}_ should be modified to take **kwargs instead of keywords and manually pop off the keywords required for the context.

Then, at the end of the chain, warnings can be emitted for the remaining kwargs.