Python 使用ulmo usgs.nwis.get_site_data函数时出现错误
我试图使用ulmo库从美国地质调查局检索泥沙流量数据时出错Python 使用ulmo usgs.nwis.get_site_data函数时出现错误,python,Python,我试图使用ulmo库从美国地质调查局检索泥沙流量数据时出错 ulmo.usgs.nwis.get_site_data('08332010', parameter_code='80155', \ service="daily", start='1969-10-01', end='2016-09-30') 它回来了 processing data from request: https://waterservices.usgs.gov/nwis/dv/? format=waterml
ulmo.usgs.nwis.get_site_data('08332010', parameter_code='80155', \
service="daily", start='1969-10-01', end='2016-09-30')
它回来了
processing data from request: https://waterservices.usgs.gov/nwis/dv/?
format=waterml&site=08332010¶meterCd=80155&startDT=1969-10-
01&endDT=2016-09-30
------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-184-3ae1371577c1> in <module>()
----> 1 df = ulmo.usgs.nwis.get_site_data('08332010',
parameter_code='80155', service="daily", start='1969-10-01', end='2016-
09-30')
/usr/local/lib/python3.6/dist-packages/ulmo/usgs/nwis/core.py in
get_site_data(site_code, service, parameter_code, statistic_code, start,
end, period, modified_since, input_file, methods, **kwargs)
259 url_params.update(kwargs)
260 values = _get_site_values(service, url_params,
input_file=input_file,
--> 261 methods=methods)
262 else:
263 kw = dict(parameter_code=parameter_code,
statistic_code=statistic_code,
/usr/local/lib/python3.6/dist-packages/ulmo/usgs/nwis/core.py in
_get_site_values(service, url_params, input_file, methods)
336 with _open_input_file(input_file) as content_io:
337 data_dict = wml.parse_site_values(content_io, query_isodate,
--> 338 methods=methods)
339
340 for variable_dict in list(data_dict.values()):
/usr/local/lib/python3.6/dist-packages/ulmo/waterml/v1_1.py in parse_site_values(content_io, query_isodate, methods)
14 return common.parse_site_values(
15 content_io, WATERML_V1_1_NAMESPACE, query_isodate=query_isodate,
---> 16 methods=methods)
17
18
/usr/local/lib/python3.6/dist-packages/ulmo/waterml/common.py in parse_site_values(content_io, namespace, query_isodate, methods)
41 raise ValueError(
42 'found more than one method for %s. need to specify'
---> 43 'specify code or "all".' % variable['code'])
44 values_element = values_elements[0]
45 values = _parse_values(values_element, namespace)
ValueError: found more than one method for 80155. need to specifyspecify code or "all".
处理来自请求的数据:https://waterservices.usgs.gov/nwis/dv/?
格式=waterml&site=08332010¶meterCd=80155&startDT=1969-10-
01&endDT=2016-09-30
------------------------------------------------------------------------
ValueError回溯(最近一次调用上次)
在()
---->1 df=ulmo.usgs.nwis.get_site_数据('08332010',
参数_code='80155',service='daily',start='1969-10-01',end='2016-
09-30')
/中的usr/local/lib/python3.6/dist-packages/ulmo/usgs/nwis/core.py
获取站点数据(站点代码、服务、参数代码、统计代码、开始、,
结束、期间、修改的\u自、输入\u文件、方法、**kwargs)
259 url_参数更新(kwargs)
260个值=_get_site_值(服务、url参数、,
输入文件=输入文件,
-->261方法=方法)
262其他:
263 kw=dict(参数代码=参数代码,
统计编码=统计编码,
/中的usr/local/lib/python3.6/dist-packages/ulmo/usgs/nwis/core.py
_获取站点值(服务、url参数、输入文件、方法)
336将_open _input _file(输入_file)作为内容_io:
337数据dict=wml.解析站点值(内容io、查询isodate、,
-->338方法=方法)
339
340对于列表中的变量_dict(数据_dict.values()):
/解析站点值中的usr/local/lib/python3.6/dist-packages/ulmo/waterml/v1.py(内容io、查询日期、方法)
14返回common.parse_site_值(
15 content\u io,WATERML\u V1\u 1\u名称空间,query\u isodate=query\u isodate,
--->16方法=方法)
17
18
/解析站点值(内容、名称空间、查询日期、方法)中的usr/local/lib/python3.6/dist-packages/ulmo/waterml/common.py
41升值错误(
42'找到%s的多个方法。需要指定'
--->43'指定代码或“全部”。'%variable['code'])
44值\元素=值\元素[0]
45值=\解析\值(值\元素,命名空间)
ValueError:为80155找到多个方法。需要指定指定代码或“全部”。
我将方法指定为all,但仍然得到相同的错误。关于如何修复它,有什么想法吗?请参阅Ulmo的文档: 方法:“”None“”、str或Python dict如果没有(默认),则假定每个参数都有一个方法。这会引发错误 如果遇到多个方法ID。如果是str,则为 请求参数的方法id,如果方法为“all”,则可以使用“all” ID事先不知道。如果是dict,请向 方法id映射。参数的方法id特定于站点 因此,添加
methods=“all”