ESDS-Leipzig / sen2nbar

Nadir BRDF Adjusted Reflectance (NBAR) for Sentinel-2 in Python

Home Page:https://sen2nbar.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NBAR for Level 1-C products

behzad-vahedi opened this issue · comments

Thank you for this amazing package. I'm working with Level-1C images and was wondering how to apply your code for those images.
I know the documentation clearly mentions that the code is designed for "Sentinel-2 SR (i.e., L2A)", but the David Roy papers you have referenced both predate level 2 products (I think), so I guess the algorithm should work the same. I might be wrong though as I have limited knowledge about Sentinel-2.

Regardless, I ran nbar_safe on a level-1c product and got the following error:

nbar_SAFE(SAFE, quiet=False)
File "~\site-packages\sen2nbar\nbar.py", line 54, in nbar_SAFE
PROCESSING_BASELINE = get_processing_baseline(f"{path}/MTD_MSIL2A.xml")
File "~\site-packages\sen2nbar\metadata.py", line 134, in get_processing_baseline
data = xmltodict.parse(requests.get(metadata).content)
File "~\site-packages\requests\api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "~\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "~\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "~\site-packages\requests\sessions.py", line 697, in send
adapter = self.get_adapter(url=request.url)
File "~\site-packages\requests\sessions.py", line 794, in get_adapter
raise InvalidSchema(f"No connection adapters were found for {url!r}")
requests.exceptions.InvalidSchema: No connection adapters were found for '2A_MSIL1C_20170425T193901_N0204_R042_T10VDK_20170425T193904.SAFE/MTD_MSIL2A.xml'

Hi @behzad-vahedi!

L1C data corresponds to Top of Atmosphere (TOA) reflectance data. L2A data corresponds to Bottom of Atmosphere (BOA) reflectance, aka Surface Reflectance (SR). In order to correct by BRDF effects, and following Roy et al., it is required to work on SR data. That's why it can't be used on L1C.

I hope this solves your questions!

Best,

David