Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply smile effect correction #5

Open
zxdawn opened this issue May 2, 2023 · 2 comments
Open

Apply smile effect correction #5

zxdawn opened this issue May 2, 2023 · 2 comments

Comments

@zxdawn
Copy link

zxdawn commented May 2, 2023

  • enpt version: 0.19.2
  • Python version: 3.10.10
  • Operating System: Mac OS M2

Description

Current version of enpt sets the smile coeff to 0:

# FIXME hardcoded - DLR does not provide any smile information
# => smile coefficients are set to zero until we have valid ones
self.nsmile_coef = 5
self.smile_coef = np.zeros((self.nwvl, self.nsmile_coef), dtype=float)

I see there're some smile coeffs in the METADATA.XML file:

    <smileCorrection applied="no" parametrization="polynomial">
      <VNIR>
        <bandID number="1">
          <wavelength unit="nm">418.42</wavelength>
          <coeff0 unit="nm">-2.17157E-01</coeff0>
          <coeff1 unit="nm">4.65630E-04</coeff1>
          <coeff2 unit="nm">-1.23312E-08</coeff2>
          <coeff3 unit="nm">-4.46007E-11</coeff3>
          <coeff4 unit="nm">-7.96608E-16</coeff4>
        </bandID>
        <bandID number="2">

It seems we can apply the smilecorrection by setting these data as self.nsmile_coef.

@danschef
Copy link
Collaborator

danschef commented May 8, 2023

Currently, a smile correction is not implemented in EnPT. There were some attempts to implement it in sicor, the atmospheric correction used under the hood of EnPT but so far as I can see (here), the implementation is not complete, yet. Probably, @unbohn knows more.

@zxdawn
Copy link
Author

zxdawn commented May 9, 2023

Thanks @danschef. I checked the EnMAP Guide and some codes in enpt:

for bi in band_informations:
k = np.int64(bi.attrib['Id']) - 1
self.wvl_center[k] = float(bi.findall("CenterWavelength")[0].text)
self.fwhm[k] = float(bi.findall("FullWidthHalfMaximum")[0].text)
self.l_min[k] = float(bi.findall("L_min")[0].text)
self.l_max[k] = float(bi.findall("L_max")[0].text)
scl = bi.findall("Smile/Coefficient")
for sc in scl:
self.smile_coef[k, np.int64(sc.attrib['exponent'])] = float(sc.text)

def calc_smile(self):
"""Compute smile for each EnMAP column.
The sum in (1) is expressed as inner product of two arrays with inner dimension as the polynomial smile
coefficients shape = (ncols, nsmile_coef) of polynomial x
:return:
"""
# smile(icol, iwvl) = sum_(p=0)^(nsmile_coef-1) smile_coef[iwvl, p] * icol**p (1)
return np.inner(
np.array([[icol ** p for p in np.arange(self.nsmile_coef)] for icol in np.arange(self.ncols)]),
self.smile_coef # shape = (nwvl, nsmile_coef)
) # shape = (ncols, nwvl)

It seems smile correction is already implemented but for is_dummy_dataformat. Is it possible to apply it based on the default L1B META file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants