Hi,
I may be missing something obvious. But I am trying to read a sentinel-2 project with python arsci (windows). It recognises that it is a file but reads that it has no bands (produces an empty list using getbandnames)? Am I reading it correctly, I used the MTD_MSIL1C.xml file?
I tried getbandnames on the TCI.jp2 project directly to see if that worked, it could see the bands but does not have a name for them - lists as ('', '', '')
runfile('C:/......../Python Scripts/rgdr.py', wdir='C.........../Python Scripts')
Traceback (most recent call last):
File "<ipython-input-4-c0471b0d77f0>", line 1, in <module>
runfile('C:/.........../Python Scripts/rgdr.py', wdir='C:............/Python Scripts')
File "C:\.......\Anaconda3\envs\maskenv\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "C:\......Anaconda3\envs\maskenv\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:............/Python Scripts/rgdr.py", line 18, in <module>
rsgislib.imageutils.selectImageBands(img, tmp_img, 'KEA', rsgislib.TYPE_16UINT, [2,3,4])
error: Not all the image bands are present within the input image file (Note. Bands are numbered from 1).
----------------------------------------------------------------------------------------------------------------------------------------------------
Script
import rsgislib
import rsgislib.imageutils
import rsgislib.rastergis
import rsgislib.imagecalc
import rsgislib.imagecalc.calcindices
img = 'C:................/cloud/S2A_MSIL1C_20180119T033041_N0206_R018_T47NRC_20180119T084949.SAFE/MTD_MSIL1C.xml'
tmp_img = 'C:/............./cloud/bandsub.kea'
rsgislib.imageutils.selectImageBands(img, tmp_img, 'KEA', rsgislib.TYPE_16UINT, [2,3,4])
bn = rsgislib.imageutils.getBandNames(img)
print (bn)
------------------------------------
Any ideas?