xarray-sentinel icon indicating copy to clipboard operation
xarray-sentinel copied to clipboard

Zip file test fails on Windows as it cannot find groups

Open corrado9999 opened this issue 3 years ago • 0 comments

It is easier to check at the result of open_dataset:

>>> url = "zip://*/manifest.safe::S1B_IW_SLC__1SDV_20210401T052622_20210401T052650_026269_032297_EFA4.zip"
>>> xarray_sentinel.sentinel1.open_dataset(url)
<xarray.Dataset>
Dimensions:  ()
Data variables:
    *empty*
Attributes: (12/15)
    constellation:              sentinel-1
    platform:                   sentinel-1b
    instrument:                 ['c-sar']
    sat:orbit_state:            descending
    sat:absolute_orbit:         26269
    sat:relative_orbit:         168
    ...                         ...
    sar:polarizations:          ['VV', 'VH']
    sar:product_type:           SLC
    xs:instrument_mode_swaths:  ['IW1', 'IW2', 'IW3']
    groups:                     []
    Conventions:                CF-1.7
    history:                    created by xarray_sentinel-999

I tracked down the issue to the use of os.path.normpath in xarray_sentinel.esa_safe.get_ancillary_data_paths, which, on Windows, converts forward slashes in backslashes, perfectly valid for ordinary files but not accepted by fsspec zip protocol.

In deed, @alexamici put a comment indicating the hackiness of such normalization, but it is not clear to me what issue it tries to address.

corrado9999 avatar Apr 27 '21 22:04 corrado9999