Hi everyone,
I am trying to use the function build_taup_model to create a velocity model using the following .tvel-file:
ak135 - P
ak135 - S
0.0000 5.8000 3.4600 2.7200
10.0000 5.8000 3.4600 2.7201
10.0000 5.8001 3.4602 2.7202
20.0000 5.8000 3.4601 2.7201
20.0000 5.8001 3.4602 2.7202
30.0000 6.5000 3.8501 2.9201
30.0000 6.5001 3.8502 2.9202
35.000 6.5000 3.8500 2.9200
35.000 8.0400 4.4800 3.3198
40.0000 8.0406 4.4812 3.3228
The code in which I call the function is as follows:
CWD = str(os.getcwd())
CWD = CWD[:CWD.index("V")]
CWD = CWD.replace("\\", "/")
CWD = CWD.replace(':/','://') + "Veegeo_ Dropbox/"
file_name = 'test.tvel'
build_taup_model(CWD + "Projecten/Seismisch Monitoring/Data - Tijn/Velocity model/.tvel_files/" + file_name, output_folder = CWD + "Projecten/Seismisch Monitoring/Data - Tijn/Velocity model/taup_models/", verbose = True)
I get the following chain of errors:
runfile('C:/Users/veege/Veegeo_ Dropbox/Projecten/Seismisch monitoring/Python scripts - Tijn/Main program/Epicenter_locator_modules.py', wdir='C:/Users/veege/Veegeo_ Dropbox/Projecten/Seismisch monitoring/Python scripts - Tijn/Main program')
Building obspy.taup model for 'C://Users/veege/Veegeo_ Dropbox/Projecten/Seismisch Monitoring/Data - Tijn/Velocity model/.tvel_files/test.tvel' ...
Traceback (most recent call last):
File ~\Veegeo_ Dropbox\Projecten\Seismisch monitoring\Python scripts - Tijn\Main program\Epicenter_locator_modules.py:26 in <module>
build_taup_model(CWD + "Projecten/Seismisch Monitoring/Data - Tijn/Velocity model/.tvel_files/test.tvel")
File ~\miniconda3\lib\site-packages\obspy\taup\taup_create.py:176 in build_taup_model
mod_create.load_velocity_model()
File ~\miniconda3\lib\site-packages\obspy\taup\taup_create.py:50 in load_velocity_model
self.v_mod = VelocityModel.read_velocity_file(filename)
File ~\miniconda3\lib\site-packages\obspy\taup\velocity_model.py:375 in read_velocity_file
v_mod = cls.read_tvel_file(filename)
File ~\miniconda3\lib\site-packages\obspy\taup\velocity_model.py:414 in read_tvel_file
data = np.genfromtxt(filename, skip_header=2, comments='#')
File ~\miniconda3\lib\site-packages\numpy\lib\npyio.py:1934 in genfromtxt
fid = np.lib._datasource.open(fname, 'rt', encoding=encoding)
File ~\miniconda3\lib\site-packages\numpy\lib\_datasource.py:193 in open
return ds.open(path, mode, encoding=encoding, newline=newline)
File ~\miniconda3\lib\site-packages\numpy\lib\_datasource.py:525 in open
found = self._findfile(path)
File ~\miniconda3\lib\site-packages\numpy\lib\_datasource.py:371 in _findfile
name = self._cache(name)
File ~\miniconda3\lib\site-packages\numpy\lib\_datasource.py:337 in _cache
with urlopen(path) as openedurl:
File ~\miniconda3\lib\urllib\request.py:214 in urlopen
return opener.open(url, data, timeout)
File ~\miniconda3\lib\urllib\request.py:517 in open
response = self._open(req, data)
File ~\miniconda3\lib\urllib\request.py:539 in _open
return self._call_chain(self.handle_open, 'unknown',
File ~\miniconda3\lib\urllib\request.py:494 in _call_chain
result = func(*args)
File ~\miniconda3\lib\urllib\request.py:1417 in unknown_open
raise URLError('unknown url type: %s' % type)
URLError: <urlopen error unknown url type: c>
The error seems to arise in the urllib before the file has been properly read. Does anyone have an idea how to fix this?