Ariel505 / aChor

Task oriented data classification for choropleth maps
2 stars 3 forks source link

ValueError: min() arg is an empty sequence #7

Closed kannes closed 4 years ago

kannes commented 5 years ago

https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-0-countries/

python class_achor.py 5 50000000000 POP_EST ne_10m_admin_0_countries.shp

ends with an error:

...
Starting sweep and generate breaks...
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.7/cProfile.py", line 173, in <module>
    main()
  File "/usr/lib/python3.7/cProfile.py", line 166, in main
    runctx(code, globs, None, options.outfile, options.sort)
  File "/usr/lib/python3.7/cProfile.py", line 20, in runctx
    filename, sort)
  File "/usr/lib/python3.7/profile.py", line 62, in runctx
    prof.runctx(statement, globals, locals)
  File "/usr/lib/python3.7/cProfile.py", line 100, in runctx
    exec(cmd, globals, locals)
  File "class_achor.py", line 753, in <module>
    aChor(cls, swp, field, shp, 1 if not method else method, 0 if output else 0)
  File "class_achor.py", line 55, in __init__
    self.generate_output()
  File "class_achor.py", line 25, in wrapper
    method(self, fout)
  File "class_achor.py", line 75, in generate_output
    brk_val, no_segment_left = self.breaks()
  File "class_achor.py", line 650, in breaks
    VALUES (?, ?, ?);""", self.linesweep())
  File "class_achor.py", line 592, in linesweep
    minval = min(vals)
ValueError: min() arg is an empty sequence
Ariel505 commented 4 years ago

Hello kannes, Sorry for the late reply, just saw this post. You should use -m parameter to define methods, for example, 1 means local extremes. So this is the command: python class_achor.py 5 500000 POP_EST ne_10m_admin_0_countries.shp -m 1

Just one suggestions, please use smaller sweep interval to better examine values between center and neighbors.

These are breaks I generated: Class: 2, Breakvalue: 10001000.0 Class: 3, Breakvalue: 40038244.0 Class: 4, Breakvalue: 5038244.0 Class: 5, Breakvalue: 66290913.0 Class: 6, Breakvalue: 23790913.0 Class: 7, Breakvalue: 167084719.0 Class: 8, Breakvalue: 1329584719.0 Class: 9, Breakvalue: 74584719.0 Class: 10, Breakvalue: 14288032.5 9 breaks/10 classes generated.

Hope this reply helps, cheers. Ariel