GeoscienceAustralia / Wind_multipliers

Wind multipliers
GNU General Public License v3.0
8 stars 6 forks source link

Index error in topographic/topo_mult.py #3

Closed CEKrause closed 7 years ago

CEKrause commented 7 years ago
Traceback (most recent call last):
  File "all_multipliers.py", line 851, in <module>
    run()
  File "all_multipliers.py", line 531, in wrap
    res = f(*args, **kwargs)
  File "all_multipliers.py", line 843, in run
    multiplier.parallelise_on_tiles(tiles)
  File "all_multipliers.py", line 473, in parallelise_on_tiles
    status = self.multipliers_calculate(ww[0], ww[1])
  File "all_multipliers.py", line 396, in multipliers_calculate
    tile_extents_nobuffer)
  File "/short/w85/cek156/Wind_multipliers/topographic/topo_mult.py", line 116, in topomult
    line = data[path]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
CEKrause commented 7 years ago

Clarification of the source of the error.

path = makepath.makepath(nr, nc, idx, direction)
line = data[path]
CEKrause commented 7 years ago

Fixed by changing the fourth last line in topography/make_path.py result.append(int(l))

l was a float, not an integer.

CEKrause commented 7 years ago
Traceback (most recent call last):
  File "all_multipliers.py", line 851, in <module>
    run()
  File "all_multipliers.py", line 531, in wrap
    res = f(*args, **kwargs)
  File "all_multipliers.py", line 843, in run
    multiplier.parallelise_on_tiles(tiles)
  File "all_multipliers.py", line 473, in parallelise_on_tiles
    status = self.multipliers_calculate(ww[0], ww[1])
  File "all_multipliers.py", line 396, in multipliers_calculate
    tile_extents_nobuffer)
  File "/short/w85/cek156/Wind_multipliers/topographic/topo_mult.py", line 118, in topomult
    m = multiplier_calc.multiplier_calc(line, data_spacing)
  File "/short/w85/cek156/Wind_multipliers/topographic/multiplier_calc.py", line 58, in multiplier_calc
    data_spacing)
  File "/short/w85/cek156/Wind_multipliers/topographic/mh.py", line 81, in mh_calc
    escarp_factor = escarpment_factor(profile, ridge, valley, data_spacing)
  File "/short/w85/cek156/Wind_multipliers/topographic/mh.py", line 31, in escarpment_factor
    h_r2beta = profile[ridge] - profile[beta_ind]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Same issue here.

CEKrause commented 7 years ago

Second issue fixed by changing line 31 in /topographic/mh.py to h_r2beta = profile[int(ridge)] - profile[int(beta_ind)]

wcarthur commented 7 years ago

Should probably look at why the indices being returned are not integers.

In the past, numpy has accepted float values as indices, which is probably why this is causing issues now (upgraded numpy on the system)

CEKrause commented 7 years ago

I was running with numpy-1.12.0