Skip to content

ArgumentError when using numpy types for reading files #2

@enolfc

Description

@enolfc

Reading one large netCDF file using xarray results in errors due to wrong arguments to read:

ArgumentError: Python argument types in
    OnedataFileHandle.read(OnedataFileHandle, numpy.int64, int)
did not match C++ signature:
    read(OnedataFileHandle {lvalue}, long, unsigned long)

The self.pos value was updated before by a call to seek() with a numpy.int64.

Code to reproduce:

import numpy as np

from fs.onedatafs import OnedataFS
onedata_provider_host = "plg-cyfronet-01.datahub.egi.eu"
onedata_access_token = "MDA.."

# Create connection to Oneprovider
odfs = OnedataFS(onedata_provider_host, onedata_access_token)
h = np.int64(100)
f = odfs.open('/EGI Foundation/Untitled Folder/tas_1991_2016_NLD.csv', 'rb')
f.seek(h)
f.read(10)

The original code was doing this:

import xarray as xr
f = odfs.open('/EGI Foundation/Untitled Folder/data2/ERA5_rainfall_and_temperature.nc', 'rb')
ds = xr.open_dataset(f)

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