HinetPy
HinetPy copied to clipboard
Issue with HTMLParser
Description of the problem
I did not use HinetPy in a couple of months but it worked perfectly fine before. I did not change the conda environment, but after restarting some downloads I encountered the following issue. The problem seems to be with parser.tabledata[i + 5]
, maybe the structure of the tabledata (from HTMLParser) might have changed?parser.tabledata[i + 5]
gives me '1'
instead of an elevation value, e.g. '175m'
Full code that generated the error
Here is my minimum example where the error occurs.
client = Client("your_username", "your_password")
sdate = datetime(2015,5,1, 0,0 ,0)
edate = datetime(2015,5,15, 0,0 ,0)
all_times = pd.date_range(sdate, edate-timedelta(minutes=30),freq="30min")
for downloadspan in all_times:
date_string = '{}{:02d}{:02d}{:02d}{:02d}'.format(all_times[0].year, all_times[0].month, all_times[0].day, all_times[0].hour, all_times[0].minute)
data, ctable = client.get_continuous_waveform("0101", date_string, 60*30)
Full error message
Traceback (most recent call last):
File "download_hinet.py", line 21, in <module>
data, ctable = client.get_continuous_waveform("0101", date_string, 60*30)
File "/home/maria/Codes/NIED_Hi-net/HinetPy/HinetPy/client.py", line 467, in get_continuous_waveform
self._max_span = self._get_allowed_span(code)
File "/home/maria/Codes/NIED_Hi-net/HinetPy/HinetPy/client.py", line 1233, in _get_allowed_span
stations = len(self.get_selected_stations(code))
File "/home/maria/Codes/NIED_Hi-net/HinetPy/HinetPy/client.py", line 1051, in get_selected_stations
elevation=float(parser.tabledata[i + 5].strip("m")),
ValueError: could not convert string to float: ''
Expected behavior
I expect the download to start as it did before.
System information
- OS: Linux
- Python version: 3.8.16
- HinetPy version: v0.9.0