Each source can be computed in DN/TOA/TOC reflectance.
``` py
xs_raw=sc.get_xs()# DN
xs_raw=sc.get_xs(reflectance="dn")# DN
xs_toa=sc.get_xs(reflectance="toa")# TOA
xs_toc=sc.get_xs(reflectance="toc")# TOC
xs_toa=sc.get_xs().reflectance(level="toa")# TOA
xs_toc=sc.get_xs().reflectance(level="toc")# TOC
```
!!! Warning
OTB version must be >= 8.1.0 to support optical calibration using source
`reflectance()` method.
kwargs of `reflectance()` are the same as `pyotb.OpticalCalibration`.
Each source can be masked with the cloud masks of the original product.
The no-data value can be chosen.
...
...
@@ -67,21 +77,22 @@ The no-data value can be chosen.
xs_toa_cld=xs_toa.cld_msk_drilled()# (1)
```
1. To change the no-data inside the clouds mask: `masked_src = src.cld_msk_drilled(nodata=-999)`
1. To change the no-data inside the clouds mask:
`masked_src = src.cld_msk_drilled(nodata=-999)`
### Examples
Computing NDVI from XS image in TOA reflectance:
``` py
xs=toa.get_xs(reflectance="toa")# (1)
xs=toa.get_xs().reflectance(level="toa")# (1)
exp="(im1b4-im1b1)/(im1b4+im1b1)"
ndvi=pyotb.bandmath(exp=exp,il=[xs])# (2)
ndvi=pyotb.bandmath(exp=exp,il=[xs])# (2)
ndvi.write("ndvi.tif")
```
1.`xs` is a `scenes.spot.Spot67Source` instance
2.`ndvi` is a `pyotb.app` that inputs `xs`
2.`ndvi` is a `pyotb.App`object that inputs `xs`
The next example is a set of preprocessing operations on a Spot-6/7 XS image:
...
...
@@ -91,10 +102,10 @@ The next example is a set of preprocessing operations on a Spot-6/7 XS image:
4. clip the result over a reference raster
``` py
pxs=sc.get_pxs(reflectance="toa")# (1)
drilled=pxs.cld_msk_drilled()# (2)
pxs=sc.get_pxs().reflectance(level="toa")# (1)
drilled=pxs.cld_msk_drilled()# (2)
ref_img="/tmp/S2A_2020...._FRE_10m.tif"
subset=drilled.clip_over_img(ref_img)# (3)
subset=drilled.clip_over_img(ref_img)# (3)
subset.write("subset.tif")
```
...
...
@@ -112,14 +123,16 @@ Superimpose an image over a reference image.
In the example below, `ref_img` is another `scenes.core.Source` instance.
``` py
toa=sc.get_pxs(reflectance="toa")
toa=sc.get_pxs().reflectance(level="toa")
superimposed=toa.resample_over(ref_img)
superimposed.write("superimposed.tif")
```
## Sentinel-2
Currently, Level-2 and Level-3 products from the [Theia land data center](https://www.theia-land.fr/en/product/sentinel-2-surface-reflectance/) are supported.
Currently, Level-2 and Level-3 products from the
[Theia land data center](https://www.theia-land.fr/en/product/sentinel-2-surface-reflectance/)
and Level-2 products from Microsoft Planetary Computer are supported