EnMAP-Box / enmap-box

EnMAP-Box source code repository. See https://enmap-box.readthedocs.io for documentation
GNU General Public License v3.0
36 stars 16 forks source link

use direct assignment between band number and detector in EnMAP L2A product specified in the METADATA.XML #415

Closed danschef closed 1 year ago

danschef commented 1 year ago

The EnMAP L2A Import dialog crashes with the following error when I try to import an L2A BSQ image produced by EnPT:

QGIS version: 3.30.0-'s-Hertogenbosch
Qt version: 5.15.8
Python version: 3.10.9
GDAL version: 3.6.2
GEOS version: 3.11.1-CAPI-1.17.1
PROJ version: Rel. 9.1.1, December 1st, 2022
PDAL version: 2.5.2 (git-version: b0e477)
Algorithm started at: 2023-03-24T20:44:00
Algorithm 'Import EnMAP L2A product' starting…
Input parameters:
{ 'detectorOverlap' : 3, 'file' : '/home/gfz-fe/scheffler/temp/EnPT/vnir_swir_coreg/coreg_test_output/ENMAP01-____L2A-DT000400126_20170218T110115Z_002_V000204_20200206T182719Z/ENMAP01-____L2A-DT000400126_20170218T110115Z_002_V000204_20200206T182719Z-METADATA.XML', 'outputEnmapL2ARaster' : 'TEMPORARY_OUTPUT' }

Traceback (most recent call last):
File "/home/gfz-fe/mambaforge/envs/enpt_full_dev/lib/python3.10/site-packages/typeguard/__init__.py", line 1033, in wrapper
retval = func(*args, **kwargs)
File "/home/gfz-fe/.local/share/QGIS/QGIS3/profiles/default/python/plugins/enmapboxplugin/enmapboxprocessing/algorithm/importenmapl2aalgorithm.py", line 120, in processAlgorithm
if np.min(np.abs(np.subtract(vnirWavelength, w))) < 0.01:
File "<__array_function__ internals>", line 180, in amin
File "/home/gfz-fe/mambaforge/envs/enpt_full_dev/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 2918, in amin
return _wrapreduction(a, np.minimum, 'min', axis, None, out,
File "/home/gfz-fe/mambaforge/envs/enpt_full_dev/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation minimum which has no identity

Execution failed after 0.67 seconds

Loading resulting layers
Algorithm 'Import EnMAP L2A product' finished

Looks like it is related to typeguard (v2.13.3 is installed) but let me know if you can´t reproduce it, then I can provide you the input dataset.

Here is the environment. ```bash (enpt_full_dev) gfz-fe@geoms:~$ conda list # packages in environment at /home/gfz-fe/mambaforge/envs/enpt_full_dev: # # Name Version Build Channel _libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_kmp_llvm conda-forge _py-xgboost-mutex 2.0 cpu_0 conda-forge acwater 0.3.0 pyhd8ed1ab_1 conda-forge alabaster 0.7.13 pypi_0 pypi alsa-lib 1.2.8 h166bdaf_0 conda-forge ansi2html 1.8.0 pypi_0 pypi aom 3.5.0 h27087fc_0 conda-forge arosics 1.8.1 py310hff52083_0 conda-forge astroid 2.15.0 pypi_0 pypi astropy 5.2.1 py310h0a54255_0 conda-forge atk-1.0 2.38.0 hd4edc92_1 conda-forge attr 2.5.1 h166bdaf_1 conda-forge attrs 22.2.0 pyh71513ae_0 conda-forge babel 2.12.1 pypi_0 pypi beautifulsoup4 4.12.0 pyha770c72_0 conda-forge bleach 6.0.0 pyhd8ed1ab_0 conda-forge blosc 1.21.3 hafa529b_0 conda-forge bokeh 2.4.3 pyhd8ed1ab_3 conda-forge boost-cpp 1.78.0 h75c5d50_1 conda-forge branca 0.6.0 pyhd8ed1ab_0 conda-forge brotli 1.0.9 h166bdaf_8 conda-forge brotli-bin 1.0.9 h166bdaf_8 conda-forge brotlipy 0.7.0 py310h5764c6d_1005 conda-forge brunsli 0.1 h9c3ff4c_0 conda-forge bzip2 1.0.8 h7f98852_4 conda-forge c-ares 1.18.1 h7f98852_0 conda-forge c-blosc2 2.7.1 hf91038e_0 conda-forge ca-certificates 2022.12.7 ha878542_0 conda-forge cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cachetools 5.3.0 pyhd8ed1ab_0 conda-forge cairo 1.16.0 ha61ee94_1014 conda-forge cartopy 0.21.1 py310hcb7e713_0 conda-forge catboost 1.1.1 py310hff52083_2 conda-forge cdsapi 0.6.1 pyhd8ed1ab_0 conda-forge cerberus 1.3.4 pyhd8ed1ab_0 conda-forge ceres-solver 2.1.0 hf302a74_1 conda-forge certifi 2022.12.7 pyhd8ed1ab_0 conda-forge cffi 1.15.1 py310h255011f_3 conda-forge cfitsio 4.2.0 hd9d235c_0 conda-forge cftime 1.6.2 py310hde88566_1 conda-forge charls 2.4.1 hcb278e6_0 conda-forge charset-normalizer 2.1.1 pyhd8ed1ab_0 conda-forge click 8.1.3 unix_pyhd8ed1ab_2 conda-forge click-plugins 1.1.1 py_0 conda-forge cligj 0.7.2 pyhd8ed1ab_1 conda-forge cloudpickle 2.2.1 pyhd8ed1ab_0 conda-forge cmocean 3.0.3 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge colorcet 3.0.1 pyhd8ed1ab_0 conda-forge colorspacious 1.1.2 pyh24bf2e0_0 conda-forge configobj 5.0.8 pyhd8ed1ab_0 conda-forge contourpy 1.0.7 py310hdf3cbec_0 conda-forge coverage 7.2.2 py310h1fa729e_0 conda-forge cryptography 39.0.2 py310h34c0648_0 conda-forge curl 7.88.1 hdc1c0ab_1 conda-forge cycler 0.11.0 pyhd8ed1ab_0 conda-forge cython 0.29.33 py310heca2aa9_0 conda-forge cytoolz 0.12.0 py310h5764c6d_1 conda-forge dask-core 2023.3.1 pyhd8ed1ab_0 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge dav1d 1.0.0 h166bdaf_1 conda-forge dbus 1.13.6 h5008d03_3 conda-forge dicttoxml 1.7.16 pyhd8ed1ab_0 conda-forge dill 0.3.6 pyhd8ed1ab_1 conda-forge docutils 0.18.1 pypi_0 pypi draco 1.5.6 hf52228f_0 conda-forge eccodes 2.29.0 h54fcba4_0 conda-forge ecmwf-api-client 1.6.3 pyhd8ed1ab_0 conda-forge eigen 3.4.0 h4bd325d_0 conda-forge enpt 0.19.2 pyhd8ed1ab_0 conda-forge enpt_enmapboxapp 0.7.6 pyhd8ed1ab_0 conda-forge et_xmlfile 1.1.0 pyhd8ed1ab_0 conda-forge exceptiongroup 1.1.1 pypi_0 pypi exiv2 0.27.6 hb9a316c_1 conda-forge expat 2.5.0 h27087fc_0 conda-forge fake-useragent 1.1.3 pypi_0 pypi fftw 3.3.10 nompi_hf0379b8_106 conda-forge filelock 3.10.4 pyhd8ed1ab_0 conda-forge fiona 1.9.1 py310ha325b7b_0 conda-forge flake8 6.0.0 pypi_0 pypi folium 0.14.0 pyhd8ed1ab_0 conda-forge font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge font-ttf-inconsolata 3.000 h77eed37_0 conda-forge font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge font-ttf-ubuntu 0.83 hab24e00_0 conda-forge fontconfig 2.14.2 h14ed4e7_0 conda-forge fonts-conda-ecosystem 1 0 conda-forge fonts-conda-forge 1 0 conda-forge fonttools 4.39.2 py310h1fa729e_0 conda-forge freeglut 3.2.2 h9c3ff4c_1 conda-forge freetype 2.12.1 hca18f0e_1 conda-forge freexl 1.0.6 h166bdaf_1 conda-forge fribidi 1.0.10 h36c2ea0_0 conda-forge fsspec 2023.3.0 pyhd8ed1ab_1 conda-forge future 0.18.3 pyhd8ed1ab_0 conda-forge gdal 3.6.2 py310hc1b7723_9 conda-forge gdk-pixbuf 2.42.10 h05c8ddd_0 conda-forge gdown 4.6.6 pyhd8ed1ab_0 conda-forge geoarray 0.16.1 py310hff52083_0 conda-forge geojson 3.0.1 pyhd8ed1ab_0 conda-forge geopandas 0.12.2 pyhd8ed1ab_0 conda-forge geopandas-base 0.12.2 pyha770c72_0 conda-forge geos 3.11.1 h27087fc_0 conda-forge geotiff 1.7.1 h7a142b4_6 conda-forge gettext 0.21.1 h27087fc_0 conda-forge gflags 2.2.2 he1b5a44_1004 conda-forge giflib 5.2.1 h0b41bf4_3 conda-forge glib 2.74.1 h6239696_1 conda-forge glib-tools 2.74.1 h6239696_1 conda-forge glog 0.6.0 h6f12383_0 conda-forge glymur 0.12.2 pyhd8ed1ab_0 conda-forge gmp 6.2.1 h58526e2_0 conda-forge gmpy2 2.1.2 py310h3ec546c_1 conda-forge graphite2 1.3.13 h58526e2_1001 conda-forge graphviz 7.1.0 h2e5815a_0 conda-forge gsl 2.7 he838d99_0 conda-forge gst-plugins-base 1.22.0 h4243ec0_2 conda-forge gstreamer 1.22.0 h25f0c4b_2 conda-forge gstreamer-orc 0.4.33 h166bdaf_0 conda-forge gtk2 2.24.33 h90689f9_2 conda-forge gts 0.7.6 h64030ff_2 conda-forge h5py 3.8.0 nompi_py310h0311031_100 conda-forge harfbuzz 6.0.0 h8e241bc_0 conda-forge hdf4 4.2.15 h9772cbc_5 conda-forge hdf5 1.12.2 nompi_h4df4325_101 conda-forge holoviews 1.15.4 pyhd8ed1ab_0 conda-forge htmlmin 0.1.12 pypi_0 pypi httplib2 0.22.0 pyhd8ed1ab_0 conda-forge icu 70.1 h27087fc_0 conda-forge idna 3.4 pyhd8ed1ab_0 conda-forge imagecodecs 2023.1.23 py310ha3ed6a1_0 conda-forge imageio 2.26.1 pyh24c5eb1_0 conda-forge imagesize 1.4.1 pypi_0 pypi importlib-metadata 6.1.0 pyha770c72_0 conda-forge iniconfig 2.0.0 pypi_0 pypi iso8601 1.1.0 pyhd8ed1ab_0 conda-forge isort 5.12.0 pypi_0 pypi jack 1.9.22 h11f4161_0 conda-forge jasper 2.0.33 h0ff4b12_1 conda-forge jinja2 3.1.2 pyhd8ed1ab_1 conda-forge joblib 1.2.0 pyhd8ed1ab_0 conda-forge jpeg 9e h0b41bf4_3 conda-forge jsmin 3.0.1 pyhd8ed1ab_0 conda-forge json-c 0.16 hc379101_0 conda-forge jxrlib 1.1 h7f98852_2 conda-forge kealib 1.5.0 ha7026e8_0 conda-forge keyutils 1.6.1 h166bdaf_0 conda-forge kiwisolver 1.4.4 py310hbf28c38_1 conda-forge krb5 1.20.1 h81ceb04_0 conda-forge lame 3.100 h166bdaf_1003 conda-forge laz-perf 3.3.0 hf52228f_0 conda-forge lazy-object-proxy 1.9.0 pypi_0 pypi lcms2 2.15 hfd0df8a_0 conda-forge ld_impl_linux-64 2.40 h41732ed_0 conda-forge lerc 4.0.0 h27087fc_0 conda-forge libaec 1.0.6 hcb278e6_1 conda-forge libavif 0.11.1 h5cdd6b5_0 conda-forge libblas 3.9.0 16_linux64_openblas conda-forge libbrotlicommon 1.0.9 h166bdaf_8 conda-forge libbrotlidec 1.0.9 h166bdaf_8 conda-forge libbrotlienc 1.0.9 h166bdaf_8 conda-forge libcap 2.67 he9d0100_0 conda-forge libcblas 3.9.0 16_linux64_openblas conda-forge libclang 15.0.7 default_had23c3d_1 conda-forge libclang13 15.0.7 default_h3e3d535_1 conda-forge libcups 2.3.3 h36d4200_3 conda-forge libcurl 7.88.1 hdc1c0ab_1 conda-forge libdb 6.2.32 h9c3ff4c_0 conda-forge libdeflate 1.17 h0b41bf4_0 conda-forge libedit 3.1.20191231 he28a2e2_2 conda-forge libev 4.33 h516909a_1 conda-forge libevent 2.1.10 h28343ad_4 conda-forge libffi 3.4.2 h7f98852_5 conda-forge libflac 1.4.2 h27087fc_0 conda-forge libgcc-ng 12.2.0 h65d4601_19 conda-forge libgcrypt 1.10.1 h166bdaf_0 conda-forge libgd 2.3.3 h5aea950_4 conda-forge libgdal 3.6.2 h6c674c2_9 conda-forge libgfortran-ng 12.2.0 h69a702a_19 conda-forge libgfortran5 12.2.0 h337968e_19 conda-forge libglib 2.74.1 h606061b_1 conda-forge libglu 9.0.0 he1b5a44_1001 conda-forge libgpg-error 1.46 h620e276_0 conda-forge libhwloc 2.9.0 hd6dc26d_0 conda-forge libiconv 1.17 h166bdaf_0 conda-forge libkml 1.3.0 h37653c0_1015 conda-forge liblapack 3.9.0 16_linux64_openblas conda-forge libllvm11 11.1.0 he0ac6c6_5 conda-forge libllvm15 15.0.7 hadd5161_1 conda-forge libnetcdf 4.9.1 nompi_h34a3ff0_101 conda-forge libnghttp2 1.52.0 h61bc06f_0 conda-forge libnsl 2.0.0 h7f98852_0 conda-forge libogg 1.3.4 h7f98852_1 conda-forge libopenblas 0.3.21 pthreads_h78a6416_3 conda-forge libopus 1.3.1 h7f98852_1 conda-forge libpng 1.6.39 h753d276_0 conda-forge libpq 15.2 hb675445_0 conda-forge libprotobuf 3.21.12 h3eb15da_0 conda-forge librsvg 2.54.4 h7abd40a_0 conda-forge librttopo 1.1.0 ha49c73b_12 conda-forge libsecret 0.18.8 h329b89f_2 conda-forge libsndfile 1.2.0 hb75c966_0 conda-forge libspatialindex 1.9.3 h9c3ff4c_4 conda-forge libspatialite 5.0.1 h221c8f1_23 conda-forge libsqlite 3.40.0 h753d276_0 conda-forge libssh2 1.10.0 hf14f497_3 conda-forge libstdcxx-ng 12.2.0 h46fd767_19 conda-forge libsystemd0 253 h8c4010b_1 conda-forge libtiff 4.5.0 h6adf6a1_2 conda-forge libtool 2.4.7 h27087fc_0 conda-forge libudev1 253 h0b41bf4_1 conda-forge libuuid 2.32.1 h7f98852_1000 conda-forge libvorbis 1.3.7 h9c3ff4c_0 conda-forge libwebp 1.2.4 h1daa5a0_1 conda-forge libwebp-base 1.2.4 h166bdaf_0 conda-forge libxcb 1.13 h7f98852_1004 conda-forge libxgboost 1.7.4 cpu_h6e95104_0 conda-forge libxkbcommon 1.5.0 h79f4944_1 conda-forge libxml2 2.10.3 hca2bb57_4 conda-forge libxslt 1.1.37 h873f0b0_0 conda-forge libzip 1.9.2 hc929e4a_1 conda-forge libzlib 1.2.13 h166bdaf_4 conda-forge libzopfli 1.0.3 h9c3ff4c_0 conda-forge lightgbm 3.3.5 py310heca2aa9_0 conda-forge llvm-openmp 16.0.0 h417c0b6_0 conda-forge llvmlite 0.39.1 py310h58363a5_1 conda-forge locket 1.0.0 pyhd8ed1ab_0 conda-forge lxml 4.9.2 py310hbdc0903_0 conda-forge lz4-c 1.9.4 hcb278e6_0 conda-forge lzo 2.10 h516909a_1000 conda-forge mapclassify 2.5.0 pyhd8ed1ab_1 conda-forge markdown 3.4.3 pyhd8ed1ab_0 conda-forge markupsafe 2.1.2 py310h1fa729e_0 conda-forge matplotlib 3.7.1 py310hff52083_0 conda-forge matplotlib-base 3.7.1 py310he60537e_0 conda-forge mccabe 0.7.0 pypi_0 pypi metis 5.1.0 h58526e2_1006 conda-forge mock 5.0.1 pyhd8ed1ab_0 conda-forge mpc 1.3.1 hfe3b2da_0 conda-forge mpfr 4.2.0 hb012696_0 conda-forge mpg123 1.31.3 hcb278e6_0 conda-forge mpld3 0.5.9 pyhd8ed1ab_0 conda-forge mpmath 1.3.0 pyhd8ed1ab_0 conda-forge munch 2.5.0 py_0 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge mvgavg 0.1.0 pyh9f0ad1d_0 conda-forge mysql-common 8.0.32 ha901b37_1 conda-forge mysql-libs 8.0.32 hd7da12d_1 conda-forge natsort 8.3.1 pyhd8ed1ab_0 conda-forge ncurses 6.3 h27087fc_1 conda-forge netcdf4 1.6.3 nompi_py310h0feb132_100 conda-forge networkx 3.0 pyhd8ed1ab_0 conda-forge nitro 2.7.dev6 hcb278e6_5 conda-forge nomkl 1.0 h5ca1d4c_0 conda-forge nose2 0.9.2 py_0 conda-forge nspr 4.35 h27087fc_0 conda-forge nss 3.89 he45b914_0 conda-forge numba 0.56.4 py310ha5257ce_0 conda-forge numexpr 2.8.3 py310hf05e7a9_101 conda-forge numpy 1.23.5 py310h53a5b5f_0 conda-forge numpy-indexed 0.3.5 py_1 conda-forge openjpeg 2.5.0 hfec8fc6_2 conda-forge openpyxl 3.1.1 py310h1fa729e_0 conda-forge openssl 3.1.0 h0b41bf4_0 conda-forge owslib 0.28.1 pyhd8ed1ab_0 conda-forge packaging 23.0 pyhd8ed1ab_0 conda-forge pandas 1.5.3 py310h9b08913_0 conda-forge panel 0.14.4 pyhd8ed1ab_0 conda-forge pango 1.50.14 hd33c08f_0 conda-forge param 1.13.0 pyh1a96a4e_0 conda-forge partd 1.3.0 pyhd8ed1ab_0 conda-forge pcre2 10.40 hc3806b6_0 conda-forge pdal 2.5.2 h0ea1e05_1 conda-forge pebble 5.0.3 pyhd8ed1ab_0 conda-forge pillow 9.4.0 py310h023d228_1 conda-forge pint 0.20.1 pyhd8ed1ab_0 conda-forge pip 23.0.1 pyhd8ed1ab_0 conda-forge pixman 0.40.0 h36c2ea0_0 conda-forge platformdirs 3.1.1 pyhd8ed1ab_0 conda-forge plotly 5.13.1 pyhd8ed1ab_0 conda-forge pluggy 1.0.0 pypi_0 pypi ply 3.11 py_1 conda-forge pooch 1.7.0 pyha770c72_3 conda-forge poppler 23.03.0 h091648b_0 conda-forge poppler-data 0.4.12 hd8ed1ab_0 conda-forge postgresql 15.2 h3248436_0 conda-forge proj 9.1.1 h8ffa02c_2 conda-forge psutil 5.9.4 py310h5764c6d_0 conda-forge psycopg2 2.9.3 py310h416cc33_2 conda-forge pthread-stubs 0.4 h36c2ea0_1001 conda-forge pulseaudio 16.1 hcb278e6_3 conda-forge pulseaudio-client 16.1 h5195f5e_3 conda-forge pulseaudio-daemon 16.1 ha8d29e2_3 conda-forge py-tools-ds 0.21.1 py310hff52083_0 conda-forge py-xgboost 1.7.4 cpu_py310hd1aba9c_0 conda-forge pycodestyle 2.10.0 pypi_0 pypi pycparser 2.21 pyhd8ed1ab_0 conda-forge pyct 0.4.6 py_0 conda-forge pyct-core 0.4.6 py_0 conda-forge pydocstyle 6.3.0 pypi_0 pypi pyepsg 0.4.0 py_0 conda-forge pyerfa 2.0.0.3 py310h0a54255_0 conda-forge pyfftw 0.13.1 py310h0a54255_0 conda-forge pyflakes 3.0.1 pypi_0 pypi pygments 2.14.0 pyhd8ed1ab_0 conda-forge pygrib 2.1.4 py310h815554b_6 conda-forge pyhdf 0.10.5 py310heb19e17_1 conda-forge pykdtree 1.3.7.post0 py310h0a54255_0 conda-forge pykrige 1.7.0 py310h5764c6d_1 conda-forge pylint 2.17.1 pypi_0 pypi pyopengl 3.1.6 pyhd8ed1ab_1 conda-forge pyopenssl 23.1.0 pyhd8ed1ab_0 conda-forge pyparsing 3.0.9 pyhd8ed1ab_0 conda-forge pyprind 2.11.2 py310hff52083_1004 conda-forge pyproj 3.4.1 py310h15e2413_1 conda-forge pyqt 5.15.7 py310hab646b1_3 conda-forge pyqt5-sip 12.11.0 py310heca2aa9_3 conda-forge pyqtwebkit 5.15.9 py310h1165ae2_1 conda-forge pyresample 1.26.1 py310h9b08913_0 conda-forge pyrsr 0.7.0 pyhd8ed1ab_1 conda-forge pyshp 2.3.1 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge pytables 3.7.0 py310hb60b9b2_3 conda-forge pytest 7.2.2 pypi_0 pypi pytest-cov 4.0.0 pypi_0 pypi pytest-reporter 0.5.2 pypi_0 pypi pytest-reporter-html1 0.8.2 pypi_0 pypi python 3.10.9 he550d4f_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-graphviz 0.20.1 pyh22cad53_0 conda-forge python_abi 3.10 3_cp310 conda-forge pytz 2022.7.1 pyhd8ed1ab_0 conda-forge pyviz_comms 2.2.1 pyhd8ed1ab_1 conda-forge pywavelets 1.4.1 py310h0a54255_0 conda-forge pyyaml 6.0 py310h5764c6d_5 conda-forge qca 2.3.5 habb7c17_3 conda-forge qgis 3.30.0 py310hfa5b721_0 conda-forge qjson 0.9.0 hb2b434f_1009 conda-forge qscintilla2 2.13.4 py310h1165ae2_0 conda-forge qt-main 5.15.8 h5d23da1_6 conda-forge qtkeychain 0.13.2 h7ba989a_2 conda-forge qtwebkit 5.212 h3e5094c_8 conda-forge qwt 6.2.0 hc45b483_5 conda-forge readline 8.2 h8228510_1 conda-forge requests 2.28.2 pyhd8ed1ab_0 conda-forge rtree 1.0.1 py310hbdcdc62_1 conda-forge scikit-image 0.19.3 py310h769672d_2 conda-forge scikit-learn 1.2.2 py310h41b6a48_1 conda-forge scipy 1.10.1 py310h8deb116_0 conda-forge sensormapgeo 0.7.0 py310hff52083_0 conda-forge setuptools 67.6.0 pyhd8ed1ab_0 conda-forge shapely 2.0.1 py310h8b84c32_0 conda-forge sicor 0.18.0 pyhd8ed1ab_1 conda-forge sip 6.7.7 py310heca2aa9_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 h9fff704_0 conda-forge snowballstemmer 2.2.0 pypi_0 pypi soupsieve 2.3.2.post1 pyhd8ed1ab_0 conda-forge spectral 0.23.1 pyh1a96a4e_0 conda-forge sphinx 6.1.3 pypi_0 pypi sphinx-argparse 0.4.0 pypi_0 pypi sphinx-rtd-theme 1.2.0 pypi_0 pypi sphinxcontrib-applehelp 1.0.4 pypi_0 pypi sphinxcontrib-devhelp 1.0.2 pypi_0 pypi sphinxcontrib-htmlhelp 2.0.1 pypi_0 pypi sphinxcontrib-jquery 4.1 pypi_0 pypi sphinxcontrib-jsmath 1.0.1 pypi_0 pypi sphinxcontrib-qthelp 1.0.3 pypi_0 pypi sphinxcontrib-serializinghtml 1.1.5 pypi_0 pypi sqlite 3.40.0 h4ff8645_0 conda-forge suitesparse 5.10.1 h9e50725_1 conda-forge sympy 1.11.1 pypyh9d50eac_103 conda-forge tbb 2021.8.0 hf52228f_0 conda-forge tenacity 8.2.2 pyhd8ed1ab_0 conda-forge threadpoolctl 3.1.0 pyh8a188c0_0 conda-forge tifffile 2023.3.21 pyhd8ed1ab_0 conda-forge tiledb 2.13.2 hd532e3d_0 conda-forge tk 8.6.12 h27826a3_0 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tomlkit 0.11.6 pypi_0 pypi toolz 0.12.0 pyhd8ed1ab_0 conda-forge tornado 6.2 py310h5764c6d_1 conda-forge tqdm 4.65.0 pyhd8ed1ab_1 conda-forge typeguard 2.13.3 pyhd8ed1ab_0 conda-forge typing-extensions 4.5.0 hd8ed1ab_0 conda-forge typing_extensions 4.5.0 pyha770c72_0 conda-forge tzcode 2023b h0b41bf4_0 conda-forge tzdata 2023b h71feb2d_0 conda-forge unicodedata2 15.0.0 py310h5764c6d_0 conda-forge urlchecker 0.0.34 pypi_0 pypi urllib3 1.26.15 pyhd8ed1ab_0 conda-forge utm 0.7.0 pyhd8ed1ab_0 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.40.0 pyhd8ed1ab_0 conda-forge wrapt 1.15.0 pypi_0 pypi xarray 2023.3.0 pyhd8ed1ab_0 conda-forge xcb-util 0.4.0 h516909a_0 conda-forge xcb-util-image 0.4.0 h166bdaf_0 conda-forge xcb-util-keysyms 0.4.0 h516909a_0 conda-forge xcb-util-renderutil 0.3.9 h166bdaf_0 conda-forge xcb-util-wm 0.4.1 h516909a_0 conda-forge xerces-c 3.2.4 h55805fa_1 conda-forge xgboost 1.7.4 cpu_py310hd1aba9c_0 conda-forge xkeyboard-config 2.38 h0b41bf4_0 conda-forge xorg-fixesproto 5.0 h7f98852_1002 conda-forge xorg-inputproto 2.3.2 h7f98852_1002 conda-forge xorg-kbproto 1.0.7 h7f98852_1002 conda-forge xorg-libice 1.0.10 h7f98852_0 conda-forge xorg-libsm 1.2.3 hd9c2040_1000 conda-forge xorg-libx11 1.8.4 h0b41bf4_0 conda-forge xorg-libxau 1.0.9 h7f98852_0 conda-forge xorg-libxdmcp 1.1.3 h7f98852_0 conda-forge xorg-libxext 1.3.4 h0b41bf4_2 conda-forge xorg-libxfixes 5.0.3 h7f98852_1004 conda-forge xorg-libxi 1.7.10 h7f98852_0 conda-forge xorg-libxrender 0.9.10 h7f98852_1003 conda-forge xorg-renderproto 0.11.1 h7f98852_1002 conda-forge xorg-xextproto 7.3.0 h0b41bf4_1003 conda-forge xorg-xproto 7.0.31 h7f98852_1007 conda-forge xyzservices 2023.2.0 pyhd8ed1ab_0 conda-forge xz 5.2.6 h166bdaf_0 conda-forge yaml 0.2.5 h7f98852_2 conda-forge zfp 1.0.0 h27087fc_3 conda-forge zipp 3.15.0 pyhd8ed1ab_0 conda-forge zlib 1.2.13 h166bdaf_4 conda-forge zlib-ng 2.0.7 h0b41bf4_0 conda-forge zstd 1.5.2 h3eb15da_6 conda-forge ```
danschef commented 1 year ago

You should be able to create the environment with:

mamba env create -n enpt_full_dev -f https://git.gfz-potsdam.de/EnMAP/GFZ_Tools_EnMAP_BOX/EnPT/raw/main/tests/gitlab_CI_docker/context/environment_enpt_full_dev.yml
janzandr commented 1 year ago

Hi Daniel, please share your EnPT result product. I don't think that it is related to typeguard. Looks like it's rather this line: if np.min(np.abs(np.subtract(vnirWavelength, w))) < 0.01:

danschef commented 1 year ago

Yes, probably, it is also something related to the output writer of EnPT.

https://nextcloud.gfz-potsdam.de/s/kLqTyL9Kjjrdrfp contains the output of an EnPT CI test (small EnMAP subset). I removed everything which is not needed to reproduce the error.

janzandr commented 1 year ago

Ok, found it. In an original EnMAP L2A product, I look for VNIR and SWIR wavelength information here: image

image

image

I use this information to seperate between VNIR and SWIR bands.

Can you add this information to your output?

danschef commented 1 year ago

I am not sure if product/smileCorrection is always present in the XML files or only if the smileCorrection processor was enabled at the ground segment. My XML file is still from the pre-launch mission phase and apparently this branch of the XML metadata is missing. Might be that it is now (after launch) always present but I am not sure.

Safer places to read the wavelengths, FWHMs, gains, offsets are:

However, there it is a bit more difficult to distinguish between VNIR and SWIR bands within the spectral overlap of the detectors. However, it is still possible with regard to the FWHM of the bands - SWIR bands have a slightly wider FWHM.

janzandr commented 1 year ago

SWIR bands have a slightly wider FWHM.

I also thought about that. Do you think it is save to assume that SWIR bands inside the overlap region have FWHM > 10nm? If so, then I could change that and skip the product/smileCorrection infos.

janzandr commented 1 year ago

@danschef, how is it? Is it save to assume that SWIR bands inside the overlap region have FWHM > 10nm?

danschef commented 1 year ago

Looks like this changed after launch. I just plotted the FWHM for datasets from pre-launch, commissioning phase, and operational phase:

grafik grafik grafik

janzandr commented 1 year ago

Alright, how shall we proceed? Do we have another criterion seperating between VNIR and SWIR? Or will you write the product/smileCorrection infos?

danschef commented 1 year ago

Do we have another criterion seperating between VNIR and SWIR?

So far, I could not find anything else. I don´t really get, why there is no metadata item that provides a direct assignment between band index and detector array.

Or will you write the product/smileCorrection infos?

No, I am just passing the metadata from the ground segment through EnPT, which is contained in the L1B dataset. If there is no product/smileCorrection in the L1B metadata, it will also not be in the EnPT L2A result. The question is only if product/smileCorrection was added by the ground segment at some point. If it is now always in there, your approach should work but is simply not compatible to datasets acquired before.

janzandr commented 1 year ago

But EnPT is aware of which band belongs to which sensor, right? If so, just write this information in a format you like into the XML, and I will use it, in case the product/smileCorrection info is not available. Does that make sense?

danschef commented 1 year ago

In EnPT, it is clear, because the VNIR/SWIR merging algorithm is implemented there. So, I could create another metadata key but this would not solve the issue for L2A data coming directly from the ground segment, which were generated before this change. Probably, we should ask at the ground segment when product/smileCorrection was added and if it is always present in recent products. Probably, also old products have been reprocessed with newer processor versions by the ground segment and contain this metadata now, however, I don´t know that.

janzandr commented 1 year ago

this would not solve the issue for L2A data coming directly from the ground segment,

I haven't seen any L2A product from the ground segment, where that information was missing. Have you?

I thought we only have a problem with L2A products written by EnPT.

danschef commented 1 year ago

EnPT just passes the metadata from the L1B dataset through and updates some specific values according to the processing. So, the METADATA.XML above belongs to one of those datasets, where this information is missing in L1B. And if it is missing in L1B, I assume it would also be missing in a subsequent L2A product generated by the ground segment.

janzandr commented 1 year ago

And if it is missing in L1B, I assume it would also be missing in a subsequent L2A product generated by the ground segment.

I would guess that you are wrong here. Probably, the ground segment adds this information to the L2A product inside the L2A processor. In L1B you don't have to separate the bands, because they are still separated in two different raster files.

danschef commented 1 year ago

No, the information is also contained in an L1B dataset from the commissioning phase, so it is added in the L1 processing by the ground segment.

janzandr commented 1 year ago

Confirmed

janzandr commented 1 year ago

Ok, but have you seen any L2A product from the ground segment, where the info is missing?

danschef commented 1 year ago

Just checked it again - I have one pre-launch L2A ground segment dataset simulated in 02/2022, where product/smileCorrection is present. All earlier datasets do not have this key. But as said, I don´t know if this is a matter of processor configuration at the ground segment.

janzandr commented 1 year ago

Ok, how about this.

  1. Until I encounter a L2A product from the ground segment, that didn't have the information, I assume that we don't have I problem with data from the ground segment. If that changes, I will deal with it.
  2. You write the missing information in a format of your choice and I will fix the bug.
danschef commented 1 year ago

To me, it looks like the ground segment added product/smileCorrection at some date around the launch, probably a bit earlier. I had a look through some datasets in our local archive and found some with metadata/schema/versionSchema 00.03.00 which don´t have this key and all with metadata/schema/versionSchema 00.04.00 and above seem to have it. This would mean that we only have an incompatibility with very early versions of real EnMAP data which I guess, users cannot download anymore anyways.

So I would keep the code as is for now an probably re-open the issue if needed. I will replace the CI test data of EnPT with newer ones soon, so that I also won´t have that issue anymore.

However, you may think about catching the above exception and raising an error message that suggests to download a newer processing version of the EnMAP dataset.

Writing the missing information in EnPT would only solve the issue for datasets processed with EnPT. But if users import such data in the EnMAP-Box directly, it would still crash.

danschef commented 1 year ago

@janzandr We just had a look again at the METADATA.XML and found a direct assignment between band number and detector in the L2A product:

grafik

I think this would be a save place to get the information. It is contained in current datasets and also in the oldest dataset that we have here.

janzandr commented 1 year ago

Very nice! I'll implement it this way.