12
12
from timezonefinder import TimezoneFinder
13
13
from dweather_client import gridded_datasets
14
14
from dweather_client .storms_datasets import IbtracsDataset , AtcfDataset , SimulatedStormsDataset
15
- from dweather_client .ipfs_queries import StationDataset , ScoYieldDataset , AemoPowerDataset , AemoGasDataset
15
+ from dweather_client .ipfs_queries import StationDataset , YieldDatasets , AemoPowerDataset , AemoGasDataset
16
16
from dweather_client .ipfs_errors import *
17
17
import ipfshttpclient
18
18
@@ -216,7 +216,7 @@ def get_station_history(
216
216
217
217
return history
218
218
219
- def get_yield_history (commodity , state , county , ipfs_timeout = None ):
219
+ def get_yield_history (commodity , state , county , dataset = "sco-yearly" , ipfs_timeout = None ):
220
220
"""
221
221
return:
222
222
string containing yield data in csv format
@@ -228,8 +228,10 @@ def get_yield_history(commodity, state, county, ipfs_timeout=None):
228
228
You can look up code values at:
229
229
https://webapp.rma.usda.gov/apps/RIRS/AreaPlanHistoricalYields.aspx
230
230
"""
231
+ if "imputed" in dataset and commodity != "0081" :
232
+ raise ValueError ("Imputed currently only available for soybeans (commodity code 0081)" )
231
233
try :
232
- return ScoYieldDataset ( ipfs_timeout = ipfs_timeout ).get_data (commodity , state , county )
234
+ return YieldDatasets ( dataset , ipfs_timeout = ipfs_timeout ).get_data (commodity , state , county )
233
235
except ipfshttpclient .exceptions .ErrorResponse :
234
236
raise ValueError ("Invalid commodity/state/county code combination" )
235
237
0 commit comments