Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

ESDS-Leipzig/sen2nbar

Repository files navigation

cubo

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

PyPIconda-forgeDocumentation StatusarXivTestsLicenseGitHub SponsorsBuy me a coffeeKo-fiTwitterBlackisort


GitHub:https://github.com/ESDS-Leipzig/sen2nbar

Documentation:https://sen2nbar.readthedocs.io/

PyPI:https://pypi.org/project/sen2nbar/

Conda-forge:https://anaconda.org/conda-forge/sen2nbar

Tutorials:https://sen2nbar.readthedocs.io/en/latest/tutorials.html

Paper:https://doi.org/10.5194/isprs-archives-XLVIII-4-W12-2024-105-2024


Overview

First, a super small glossary:

  • BRDF: Bidirectional Reflectance Distribution Function.
  • DN: Digital Number.
  • NBAR: Nadir BRDF Adjusted Reflectance.
  • SR: Surface Reflectance.
  • STAC: SpatioTemporal Assets Catalogs.

Second, the amazing bibliography by David P. Roy et al., used to create this package:

Third, the super useful bibliography by Lucht et al.,:

Given this, and in a few words,sen2nbar converts theSentinel-2 SR (i.e., L2A) toSentinel-2 NBAR via thec-factor method.

SAFE

You can usesen2nbar to convert complete images via SAFE:

fromsen2nbar.nbarimportnbar_SAFE# Converted images are saved inside the SAFE pathnbar_SAFE("S2A_MSIL2A_20230223T075931_N0509_R035_T35HLC_20230223T120656.SAFE")

Note

Note thatsen2nbar automatically shifts the DN of images with a processing baseline >= 04.00. This includes data cubes obtained viastackstac orcubo.

stackstac

Or, if you are using STAC and retrieving images viastackstac:

importpystac_clientimportstackstacimportplanetary_computeraspcfromsen2nbar.nbarimportnbar_stackstac# Important infor for laterendpoint="https://planetarycomputer.microsoft.com/api/stac/v1"collection="sentinel-2-l2a"bounds= (-148.565368,60.800723,-147.443389,61.183638)# Open the STACcatalog=pystac_client.Client.open(endpoint,modifier=pc.sign_inplace)# Define your areaarea_of_interest= {"type":"Polygon","coordinates": [        [            [bounds[0],bounds[1]],            [bounds[2],bounds[1]],            [bounds[2],bounds[3]],            [bounds[0],bounds[3]],            [bounds[0],bounds[1]],        ]    ],}# Search the itemsitems=catalog.search(collections=[collection],intersects=area_of_interest,datetime="2019-06-01/2019-08-01",query={"eo:cloud_cover": {"lt":10}},).get_all_items()# Retrieve all items as a xr.DataArraystack=stackstac.stack(items,assets=["B05","B06","B07"],# Red Edge here, but you can use more!bounds_latlon=bounds,resolution=20)# Convert it to NBAR!da=nbar_stackstac(stack,stac=endpoint,collection=collection)

Warning

These examples are done usingPlanetary Computer. If you are using data cubes retrieved via STAC (e.g., by usingstackstac orcubo), we recommend you to use this provider. The providerElement84 is not supported at the moment.

cubo

And going deeper, if you are usingcubo:

importcuboimportxarrayasxrfromsen2nbar.nbarimportnbar_cubo# Get your cubeda=cubo.create(lat=47.84815,lon=13.37949,collection="sentinel-2-l2a",bands=["B02","B03","B04"],# RGB here, but you can add more bands!start_date="2020-01-01",end_date="2021-01-01",edge_size=64,resolution=10,query={"eo:cloud_cover": {"lt":3}})# Convert it to NBAR (This a xr.DataArray)da=nbar_cubo(da)

Bands

sen2nbar converts the following bands (if available in the input data):

  • RGB Bands: 02, 03, 04.
  • Red Edge Bands: 05, 06, 07.
  • Broad NIR Band: 08.
  • SWIR Bands: 11, 12.

Installation

Install the latest version from PyPI:

pip install sen2nbar

Upgradesen2nbar by running:

pip install -U sen2nbar

Install the latest version from conda-forge:

conda install -c conda-forge sen2nbar

Install the latest dev version from GitHub by running:

pip install git+https://github.com/davemlz/sen2nbar

Citation

If you use this work, please consider citing the following paper:

@article{montero2024sen2nbar,title ={Facilitating advanced Sentinel-2 analysis through a simplified computation of Nadir BRDF Adjusted Reflectance},volume ={XLVIII-4/W12-2024},ISSN ={2194-9034},url ={http://dx.doi.org/10.5194/isprs-archives-XLVIII-4-W12-2024-105-2024},DOI ={10.5194/isprs-archives-xlviii-4-w12-2024-105-2024},journal ={The International Archives of the Photogrammetry,  Remote Sensing and Spatial Information Sciences},publisher ={Copernicus GmbH},author ={Montero,  David and Mahecha,  Miguel D. and Aybar,  César and Mosig,  Clemens and Wieneke,  Sebastian},year ={2024},month = jun,pages ={105–112}}

License

The project is licensed under the MIT license.

RSC4Earth

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp