IndexError: list index out of range from hourly.py

16 views
Skip to first unread message

Reiner Buehl

unread,
Jan 3, 2021, 7:20:13 AM1/3/21
to py...@googlegroups.com
Hi all,

I get errors like these currently in hourly.log:

Traceback (most recent call last):
  File "/usr/local/bin/pywws-hourly", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pywws/hourly.py", line 97, in main
    return hourly(args[0])
  File "/usr/local/lib/python2.7/dist-packages/pywws/hourly.py", line 66, in hourly
    pywws.process.process_data(context)
  File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line 761, in process_data
    start = generate_hourly(context.calib_data, context.hourly_data, start)
  File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line 621, in generate_hourly
    hourly_data.update(hourlygen(calib_data, prev))
  File "/usr/local/lib/python2.7/dist-packages/pywws/filedata.py", line 433, in update
    for k in E:
  File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line 602, in hourlygen
    acc.add_raw(data)
  File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line 255, in add_raw
    self.wind_fil.add(data)
  File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line 218, in add
    self.Ve -= speed * sin_LUT[direction]
IndexError: list index out of range

The raw data looks fine at a first glance but since I am ecperimenting with a new data input, Iit might be some inconsistent data. Is there a way to output which line of raw data causes this?

Best regards,
Reiner

Jim Easterbrook

unread,
Jan 4, 2021, 4:49:19 AM1/4/21
to py...@googlegroups.com
On 03/01/2021 12:19, Reiner Buehl wrote:
> Hi all,
>
> I get errors like these currently in hourly.log:
>
> Traceback (most recent call last):


>   File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line
> 255, in add_raw
>     self.wind_fil.add(data)
>   File "/usr/local/lib/python2.7/dist-packages/pywws/process.py", line
> 218, in add
>     self.Ve -= speed * sin_LUT[direction]
> IndexError: list index out of range

The problem is in the wind direction averaging - one of your wind
direction raw values is outside the range 0..15.

> The raw data looks fine at a first glance but since I am ecperimenting
> with a new data input, Iit might be some inconsistent data. Is there a
> way to output which line of raw data causes this?

If you run pywws.process at high verbosity (with no other pywws software
running) it should print out each day as it processes it, so when it
crashes you should know roughly where it had got to.

--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Reiner Buehl

unread,
Jan 4, 2021, 2:34:01 PM1/4/21
to py...@googlegroups.com
I added a logger statement before the line 218 in process.py to print speed and direction. The values seem inconspicious, e.g. Speed 2.3, Direction 135.0

Jim Easterbrook

unread,
Jan 4, 2021, 2:47:48 PM1/4/21
to py...@googlegroups.com
On 04/01/2021 19:33, Reiner Buehl wrote:
> I added a logger statement before the line 218 in process.py to print
> speed and direction. The values seem inconspicious, e.g. Speed 2.3,
> Direction 135.0

pywws wind direction is in the range 0..15 (integer values in raw data,
float values after averaging/smoothing). Your value of 135 is out of range.
Reply all
Reply to author
Forward
0 new messages