Hi All,
I am creating an FDSN client to use the get_stations function to get the stations.
To do this, I am calling get_stations as follows:
inventory = client.get_stations(latitude = latitude , longitude = longitude,
maxradius = maxradius , starttime = starttime,
endtime = endtime, location ="2*", channel="H*", level="response")
This runs fine locally and on windows. After deploying it to a Python Azure Function running on Linux, I am getting the following error:
in get_relevant_stations inventory = client.get_stations(latitude = site_latitude,
longitude = site_longitude,
File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/clients/fdsn/client.py",
line 732,
in get_stations inventory = read_inventory(data_stream) File "<decorator-gen-49>",
line 2,
in read_inventory File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/core/util/decorator.py",
line 300,
in _map_example_filename return func(*args,
**kwargs) File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/core/inventory/inventory.py",
line 88,
in read_inventory return _generic_reader(path_or_file_object,
_read,
format=format,
File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/core/util/base.py",
line 677,
in _generic_reader generic = callback_func(fh.name,
**kwargs) File "<decorator-gen-50>",
line 2,
in _read File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/core/util/decorator.py",
line 210,
in uncompress_file result = func(filename,
*args,
**kwargs) File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/core/inventory/inventory.py",
line 97,
in _read inventory,
format = _read_from_plugin('inventory',
filename,
format=format,
File "/home/site/wwwroot/.python_packages/lib/site-packages/obspy/core/util/base.py",
line 450,
in _read_from_plugin raise TypeError('Unknown format for file %s' % filename)Result: Failure Exception: TypeError: Unknown format for file /tmp/obspy-0yop00ed.tmp
How can I make sure that get_stations works in my Python Azure function running on Linux? I’ve tried saving the API response in a file by specifying a filename and type. I can save this file successfully. I can also read this file manually using Python, but using ObsPy’s read_inventory function still raises the error. It’s really weird since it works properly on my local windows environment.