Closed lvhengani closed 4 years ago
Does it help if you change the line:
wave_hyper = linspace(wave_range[0],wave_range[1],((wave_range[1]-wave_range[0])/wave_step)+2)
to:
wave_hyper = linspace(wave_range[0],wave_range[1],ceil(((wave_range[1]-wave_range[0])/wave_step)+2))
You'll also need to import ceil from numpy.
Quinten
It seems this occurs in the most recent Python/numpy distribution. This commit should help: https://github.com/acolite/acolite/commit/650331e634940fe7c9a0d8c6ff0d72855d5ae593
Same issue here, despite the updates in that commit. I now have:
Running ACOLITE
Launching ACOLITE Python!
Started ACOLITE Python processing
Wrote run settings file to OUTDIR/acolite_run_20200304_100611_settings.txt
Processing 1 scene...
Processing scene 1 of 1...
Traceback (most recent call last):
File "CONDADIR/lib/python3.6/site-packages/numpy/core/function_base.py", line 117, in linspace
num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "launch_acolite.py", line 30, in <module>
launch_acolite()
File "launch_acolite.py", line 25, in launch_acolite
ac.acolite.acolite_cli(sys.argv)
File "ACOLITEDIR/acolite/acolite/acolite/acolite_cli.py", line 85, in acolite_cli
acolite_run(settings=acolite_settings)
File "ACOLITEDIR/acolite/acolite/acolite/acolite_run.py", line 254, in acolite_run
nc_write_rhorc=nc_write_rhorc
File "ACOLITEDIR/acolite/acolite/acolite/acolite_ac.py", line 289, in acolite_ac
metadata,bdata= pp.sentinel.scene_meta(metafile)
File "ACOLITEDIR/acolite/acolite/sentinel/scene_meta.py", line 75, in scene_meta
wave = linspace(banddata['Wavelength'][band]['MIN'],banddata['Wavelength'][band]['MAX'], ((banddata['Wavelength'][band]['MAX']-banddata['Wavelength'][band]['MIN'])/step)+1)
File "<__array_function__ internals>", line 6, in linspace
File "CONDADIR/lib/python3.6/site-packages/numpy/core/function_base.py", line 121, in linspace
.format(type(num)))
TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.
Hi Quinten,
The 3rd parameter in linespace should be casted as the int type. It seems that the ceil did not work in my macOS because it still generates the float64 number.
I tried this command as follows and it worked.
wave_hyper = linspace(wave_range[0],wave_range[1],int(ceil((wave_range[1]-wave_range[0])/wave_step)+2))
Regards, Zhigang
Thanks Zhigang,
Will update shortly, it seems ceil still returns a float!
Quinten
I have updated the code to pass integers to linspace - my apologies for the long wait!
Hi,
When trying to process Sentinel-2 data, I am getting error:
I am using Python3.6