COREG_LOCAL.view_CoRegPoints() raises KeyError: 'X_SHIFT_M' error when there are too many clouds.
We are using AROSICS version 1.2.1
. For the following granule S2B_L1C/32U/LC/2020/S2B_MSIL1C_20201026T103039_N0209_R108_T32ULC_20201026T125048.SAFE/GRANULE/L1C_T32ULC_A019010_20201026T103612
the CoReg
gives the following error message:
20201112-07:54:13:ERROR::AttributeError("'GeoDataFrame' object has no attribute 'X_SHIFT_M'")
Traceback (most recent call last):
File "/usr/local/python/.pyenv/versions/gts2_python_3.8.6/lib/python3.8/site-packages/sicor-0.15.2-py3.8.egg/sicor/sicor_ac.py", line 226, in coreg_s2
cr.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', savefigPath=fn_grid_image,
File "/usr/local/python/.pyenv/versions/gts2_python_3.8.6/lib/python3.8/site-packages/arosics-1.2.1-py3.8.egg/arosics/CoReg_local.py", line 431, in view_CoRegPoints
GDF = self.CoRegPoints_table.loc[self.CoRegPoints_table.X_SHIFT_M != self.outFillVal, attr2include].copy()\
File "/usr/local/python/.pyenv/versions/gts2_python_3.8.6/lib/python3.8/site-packages/pandas/core/generic.py", line 5139, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'GeoDataFrame' object has no attribute 'X_SHIFT_M'
To replicate it the user should run the following code:
from arosics import DESHIFTER, COREG_LOCAL
from geoarray import GeoArray
def test_coreg_local():
import dill
with open('/home/gts2/kwargs_dump_assertionerror_issue_47.dill', 'rb') as inF:
kw = dill.load(inF)
kw['r_b4match'] = 1
kw['q'] = False
CRL = COREG_LOCAL(**kw)
#CRL.calculate_spatial_shifts()
CRL.correct_shifts()
if not CRL.success:
print('Result not co-registered.')
fn_grid_image = None
CRL.view_CoRegPoints(figsize=(20, 20), backgroundIm='tgt', savefigPath=fn_grid_image, hide_filtered=False)
test_coreg_local()
and the following dump /misc/gts2/setup_files/test_data/kwargs_dump_assertionerror_issue_47.dill
.
We think a check should be added to the code to avoid an exception to be raised. However, we also think if CoReg is not successful then we should not try to run view_CoRegPoints
, the issue was identified at https://gitext.gfz-potsdam.de/EnMAP/sicor/-/issues/71.
Edited by Daniel Scheffler