netcdf4-python
netcdf4-python copied to clipboard
How can I use a dataset with pyfilesystem2
Hi all
where have I to look at for accessing netCDF files by the pyfilesystem2 approach http://pyfilesystem2.readthedocs.io/en/latest/
By this idea I could access files over many protocols on various storage platforms by just defining an open_fs string.
e.g.
>>> from fs import open_fs
>>> storage_fs = open_fs(u'~/')
>>> # storage_fs = open_fs(u"ssh://[user[:password]@]host[:port]/[directory]")
>>> # storage_fs = open_fs(u"ftp://ftp.example.org/pub")
>>> fid = storage_fs.open(u'data.nc', 'r')
>>> with storage_fs.open(u'data.nc', 'r') as fid:
How can I open a netCDF file by passing in the fid ?
regards Reimar
I don't think you can. netCDF4-python is just wrapping the netCDF-C library. This requires either a filename or a buffer containing the contents of the file in memory.