You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用ulmo usgs.nwis.get_site_data函数获取USGS数据时遇ValueError

Fixing the "multiple methods for 80155" Error in ulmo USGS Data Fetch

Hey there, I’ve run into this exact issue with USGS parameter 80155 (suspended sediment discharge) before—let’s break down how to fix it.

The Root Cause

USGS uses different statistical methods to calculate suspended sediment discharge (parameter code 80155) for daily data, and ulmo requires you to explicitly specify which method you want. Your initial attempt to use methods='all' didn’t work because you used the wrong parameter name—ulmo expects method_code, not methods.

Step-by-Step Solution

  1. First, check all available methods for your site and parameter
    Run this code to list every valid method code for site 08332010 and parameter 80155:

    import ulmo
    methods = ulmo.usgs.nwis.get_methods('08332010', parameter_code='80155')
    print(methods)
    

    This will return a dictionary with method codes (like 00003) as keys and their descriptions (e.g., "Mean") as values.

  2. Choose either a specific method or fetch all methods

    • Option 1: Use a specific method code
      Pick one of the codes from the output above and pass it to method_code:
      ulmo.usgs.nwis.get_site_data(
          '08332010',
          parameter_code='80155',
          service="daily",
          start='1969-10-01',
          end='2016-09-30',
          method_code='00003'  # Replace with your preferred method code
      )
      
    • Option 2: Fetch all available methods
      Correct the parameter name to method_code='all' (this is what you tried to do earlier, but with the wrong parameter key):
      ulmo.usgs.nwis.get_site_data(
          '08332010',
          parameter_code='80155',
          service="daily",
          start='1969-10-01',
          end='2016-09-30',
          method_code='all'
      )
      

Why This Works

The original error occurred because ulmo couldn’t resolve which calculation method to use for 80155. By either specifying a concrete method code or using method_code='all' (with the correct parameter name), you’re telling ulmo exactly how to handle the multiple available methods for this parameter.

内容的提问来源于stack exchange,提问作者John Yang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:04:20