ratt-ru / dask-ms

Implementation of a dask/xarray dataset backed by a CASA MS

Home Page:https://dask-ms.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG?: LocalFileSystem object error

miguelcarcamov opened this issue · comments

  • dask-ms version: 0.2.10, 0.2.11, 0.2.12, 0.2.14, 0.2.15
  • Python version: 3.9.7
  • Operating System: manjaro

Hello,

I've been seeing this error since dask-ms version 0.2.10. The error is triggered when reading the ANTENNA table or any subtable. This piece of code:
antennas = xds_from_table(self.ms_name_dask + "ANTENNA", taql_where=taql_query_flag_row)[0]

can be translated to
antennas = xds_from_table("ms_file.ms::ANTENNA", taql_where="!FLAG_ROW")[0]

This is the error per se.

Traceback (most recent call last):
  File "/tmp/ipykernel_271935/1820304262.py", line 2, in <module>
    dataset = x.read(filter_flag_column=False, calculate_psf=True)
  File "/home/miguel/Documents/pyralysis/src/pyralysis/io/daskms.py", line 129, in read
    antennas = xds_from_table(self.ms_name_dask + "ANTENNA", taql_where=taql_query_flag_row)[0]
  File "/home/miguel/.local/lib/python3.9/site-packages/daskms/dask_ms.py", line 284, in xds_from_table
    store = DaskMSStore(table_name, **kwargs.pop("storage_options", {}))
  File "/home/miguel/.local/lib/python3.9/site-packages/daskms/fsspec_store.py", line 46, in __init__
    full_url = self.fs.unstrip_protocol(self.map.root)
AttributeError: 'LocalFileSystem' object has no attribute 'unstrip_protocol'

How can I fix this?

Cheers.

Hi @miguelcarcamov. The following works for me with dask-ms==0.2.15, python==3.9.15 and one of my local MS:

$ virtualenv -p python3.9 dask-ms
$ source dask-ms/bin/activate
(dask-ms) $ pip install dask-ms[complete]==0.2.15
(dask-ms) $ python
Python 3.9.15 (main, Oct 12 2022, 19:14:24)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from daskms import xds_from_table
>>> ants = xds_from_table("~/data/WSRT_polar.MS_p0::ANTENNA")[0]
>>> ants
<xarray.Dataset>
Dimensions:        (row: 14, xyz: 3)
Coordinates:
    ROWID          (row) int64 dask.array<chunksize=(14,), meta=np.ndarray>
Dimensions without coordinates: row, xyz
Data variables:
    OFFSET         (row, xyz) float64 dask.array<chunksize=(14, 3), meta=np.ndarray>
    POSITION       (row, xyz) float64 dask.array<chunksize=(14, 3), meta=np.ndarray>
    FLAG_ROW       (row) bool dask.array<chunksize=(14,), meta=np.ndarray>
    NAME           (row) object dask.array<chunksize=(14,), meta=np.ndarray>
    STATION        (row) object dask.array<chunksize=(14,), meta=np.ndarray>
    TYPE           (row) object dask.array<chunksize=(14,), meta=np.ndarray>
    DISH_DIAMETER  (row) float64 dask.array<chunksize=(14,), meta=np.ndarray>
    MOUNT          (row) object dask.array<chunksize=(14,), meta=np.ndarray>
Attributes:
    __daskms_partition_schema__:  ()
>>>

I've changed the installation to dask-ms[complete] and now it works. Before I had it just with dask-ms[xarray].

I've changed the installation to dask-ms[complete] and now it works. Before I had it just with dask-ms[xarray].

Thanks, thats useful information. I've just tried with a base install and I get the following (note, no xarray Dataset, dask-ms's vendored Dataset is provided instead):

$ virtualenv -p python3.9 dask-ms
$ source dask-ms/bin/activate
(dask-ms) $ pip install dask-ms==0.2.15
(dask-ms) $ python
Python 3.9.15 (main, Oct 12 2022, 19:14:24)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from daskms import xds_from_table
>>> ants = xds_from_table("~/data/WSRT_polar.MS_p0::ANTENNA")[0]
>>> ants
<daskms.dataset.Dataset object at 0x7f0a4de68f10>
>>>

I wonder if there's some strange interaction between xarray and fsspec.

I wonder if there's some strange interaction between xarray and fsspec.

A pip install dask-ms[xarray]==0.2.15 also works for me.

Are you sure your virtual environment might not be misconfigured somehow?

Maybe - I had to uninstall everything and then install everything from zero for dask-ms to work. Maybe there were misconfigurations and inconsistencies in my environment. I will close this issue. Sorry for the inconveniences :).

Maybe - I had to uninstall everything and then install everything from zero for dask-ms to work. Maybe there were misconfigurations and inconsistencies in my environment. I will close this issue. Sorry for the inconveniences :).

No problem. I would guess there was an outdated fsspec version in the environment.