-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coops Get Observations as Collections #31
Comments
@DanielJMaher i get round this by making a separate get request, and parsing the xml, the following creates a url=(sos_urls[0].split("?")[0]+'?'
'service=SOS&request=GetObservation&version=1.0.0&'
'observedProperty=%s&offering=urn:ioos:network:NOAA.NOS.CO-OPS:WaterLevelActive&'
'featureOfInterest=BBOX:%s&responseFormat=text/tab-separated-values&eventTime=%s') % (sos_name,box_str,iso_end)
r = requests.get(url)
data = r.text
#get the headers for the cols
data = data.split("\n")
headers = data[0]
station_list_dict = dict()
#parse the headers so i can create a dict
c = 0
for h in headers.split("\t"):
field = h.split(":")[0].split(" ")[0]
station_list_dict[field] = {"id":c}
c+=1
#create dict of stations
station_list = []
for i in range(1,len(data)):
station_info = data[i].split("\t")
station = dict()
for field in station_list_dict.keys():
col = station_list_dict[field]["id"]
if col < len(station_info):
station[field] = station_info[col]
station_list.append(station) |
@birdage I don't think you are using pyoos at all in your work around. I think you are on the right track here though. Once we grab the data we don't need to use etree to parse the xml. instead we can parse the data how we want. |
Let's bring Mohammed into the conversation. I think they implemented collection support and it may be a syntax issue. @mchaouchi can you clarify? |
CO-OPS implemented collection support for CSV, TSV, and KML. In the next release (in 2 to 3 months from now), the SWE common implementation will have collection support for XML. Date: Tue, 20 May 2014 13:19:05 -0700 Let's bring Mohammed into the conversation. I think they implemented collection support and it may be a syntax issue. @mchaouchi can you clarify? — |
When attempting to Get Coop Observations, pyoos encounters an issue:
Because Coops does not support xml generation for a collection of observations, the collector can not properly collect the data. The solution would either be to allow the parsing and collecting of CSV/TSV files, or to get observations from Coop as several single observation.
The text was updated successfully, but these errors were encountered: