Cannot read data from Windows data server
RodrigoC-A opened this issue · comments
Avoid duplicates
- I searched existing issues
Bug Summary
Sorry if this is repeated, I checked previous issues but I might have missed it.
I am a Linux user and when I'm trying to read data from a mounted folder (Windows data server) nothing is loaded, but the read function recognises the files. Obviously everything works fine when the files are locally stored.
I've tried using a wildcard in the read() argument and using glob. None of them worked. However, when I removed the loop and write the full name of the file directly, it loads with no problem. I need to load multiple files, though.
Ubuntu 22.04, Spyder 5.4.3, Python 3.10, Obspy 1.4.0 installed with Anaconda and conda-forge repository
What can I do?
The error:
Traceback (most recent call last):
Cell In[15], line 24
st += read(str(ima))
File ~/Software/miniconda3/envs/seismology/lib/python3.10/site-packages/decorator.py:232 in fun
return caller(func, *(extras + args), **kw)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/site-packages/obspy/core/util/decorator.py:297 in _map_example_filename
return func(*args, **kwargs)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/site-packages/obspy/core/stream.py:208 in read
st = _generic_reader(pathname_or_url, _read, **kwargs)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/site-packages/obspy/core/util/base.py:658 in _generic_reader
generic = callback_func(pathnames[0], **kwargs)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/site-packages/decorator.py:232 in fun
return caller(func, *(extras + args), **kw)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/site-packages/obspy/core/util/decorator.py:148 in uncompress_file
if tarfile.is_tarfile(filename):
File ~/Software/miniconda3/envs/seismology/lib/python3.10/tarfile.py:2489 in is_tarfile
t = open(name)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/tarfile.py:1613 in open
return func(name, "r", fileobj, **kwargs)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/tarfile.py:1679 in gzopen
fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
File ~/Software/miniconda3/envs/seismology/lib/python3.10/gzip.py:174 in init
fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'TR.SFAN.02.HHZ.2021.022.00.00.mseed'
BUT this works fine (with no loop)
st += read('TR.SFAN.02.HHZ.2021.022.00.00.mseed')
Code to Reproduce
for sta in estaciones:
for mo in months:
os.chdir("/media/matuki/DATA1/SRC-New/DATA-ECSN/seisan/WAV/CONT_/MSEED/"+str(year)+"/" + mo + "/")
names = glob.glob("TR."+ sta + "." + str(year) + ".*")
for ima in names:
st += read(str(ima))
Error Traceback
No response
ObsPy Version?
1.4.0
Operating System?
Ubuntu 22.04
Python Version?
Pytho 3.10
Installation Method?
conda
This was a problem with the mounting command. Nothing to do with Obspy itself.