GeoNet / fdsn

FDSN Web Services
MIT License
17 stars 15 forks source link

Problems with FDSN station service in obspy #35

Closed nbalfour closed 7 years ago

nbalfour commented 7 years ago

I have been playing with the station service and queries are broken in obspy, but not in the URL, but they return different things with the URL, but that is not surprising. Anyway, it summary I can't break the URL but obspy is broken. I am happy to come and sit with you to look over things to see if it's anything I can help with.

URL query http://service.geonet.org.nz/fdsnws/station/1/query?station=A*&location=20 returns 12 stations

URL query http://beta-service.geonet.org.nz/fdsnws/station/1/query?station=A*&location=20 returns 109 stations

Python Obspy query inventory = client.get_stations(station="A*",location="20")

with regular client "GeoNet" linked to service.geonet.org.nz returns:

    Created by: IRIS WEB SERVICE: fdsnws-station | version: 1.1.25
            http://service.iris.edu/fdsnws/station/1/query?format=xml&location=...
    Sending institution: IRIS-DMC (IRIS-DMC)
    Contains:
        Networks (4):
            CU
            IU
            TA
            US
        Stations (18):
            CU.ANWB (Willy Bob, Antigua and Barbuda)
            IU.ADK (Adak, Aleutian Islands, Alaska)
            IU.ADK (Adak, Aleutian Islands, Alaska)
            IU.AFI (Afiamalu, Samoa)
            IU.AFI (Afiamalu, Samoa)
            IU.AFI (Afiamalu, Samoa)
            IU.ANMO (Albuquerque, New Mexico, USA)
            IU.ANMO (Albuquerque, New Mexico, USA)
            IU.ANMO (Albuquerque, New Mexico, USA)
            IU.ANMO (Albuquerque, New Mexico, USA)
            IU.ANTO (Ankara, Turkey)
            TA.A21K (Barrow, AK, USA)
            TA.A36M (Sachs Harbour, NT, CAN)
            US.AAM (Ann Arbor, Michigan, USA)
            US.ACSO (Alum Creek State Park, Ohio, USA)
            US.AGMN (Agassiz National Wildlife Refuge, Minnesota, USA)
            US.AHID (Auburn Hatchery, Idaho, USA)
            US.AMTX (Amarillo, Texas, USA)
        Channels (0):

While beta-service.geonet.org.nz returns:

---------------------------------------------------------------------------
FDSNException                             Traceback (most recent call last)
<ipython-input-36-8565ad0a3a25> in <module>()
      9 
     10 #inventory = client.get_stations(starttime=starttime,endtime=endtime,latitude=-42.693,longitude=173.022,maxradius=0.5, level="channel")
---> 11 inventory = client.get_stations(station="A*",location="20")
     12 #inventory = client.get_stations(starttime="2016-11-13 11:00:00.000", endtime="2016-11-14 11:00:00.000",network="NZ", location="20", level="channel")
     13 print(inventory)

C:\Users\natalieb\AppData\Local\Continuum\Anaconda3\lib\site-packages\obspy\clients\fdsn\client.py in get_stations(self, starttime, endtime, startbefore, startafter, endbefore, endafter, network, station, location, channel, minlatitude, maxlatitude, minlongitude, maxlongitude, latitude, longitude, minradius, maxradius, level, includerestricted, includeavailability, updatedafter, matchtimeseries, filename, format, **kwargs)
    611             "station", DEFAULT_PARAMETERS['station'], kwargs)
    612 
--> 613         data_stream = self._download(url)
    614         data_stream.seek(0, 0)
    615         if filename:

C:\Users\natalieb\AppData\Local\Continuum\Anaconda3\lib\site-packages\obspy\clients\fdsn\client.py in _download(self, url, return_string, data, use_gzip)
   1340             msg = ("Bad request. If you think your request was valid "
   1341                    "please contact the developers.")
-> 1342             raise FDSNException(msg, server_info)
   1343         elif code == 401:
   1344             raise FDSNException("Unauthorized, authentication required.",

FDSNException: Bad request. If you think your request was valid please contact the developers.
gclitheroe commented 7 years ago

/fdsnws/station/1/query?location=20&station=A%2A&format=xml

nbalfour commented 7 years ago

Feel free to close this and re-write. It doesn't make much sense.