Batch run SNAP LAI in python


#1

Hi there,
I already tried SNAP Biophysical Processor to compute LAI index from Sentinel 2 L2A product.
I would like to script this in python and would like to see if I can obtain formular used by SNAP to compute LAI.
Of course I also see the spec document but it is too hard to understand…
So far this is what I known. In SNAP it use B3(G), B4®, B6(Veg Red Edge), B8A(Narrow NIR), B11, B12(SWIR) and view azimuth mean to compute, however I would like to script this process that can batch compute the image from the solid L2A product file location. Is this possible? Is there any where I can obtain the source code of LAI in SNAP?

Thanks for any suggestions and commands


#2

Dear Ariel,

the Biophysical processor is using a Neural Network to retrieve the biophysical parameters estimates. Hence there is not a simple equation based on spectral bands to retrieve LAI.
The processor is based on the PROSPECT model and the SAIL radiative transfer model.
You can find more information in the ATBD:

Federico


#3

Hi FedericoF,
Thank you for your answer.
I now tried gpt to run xml file and from there run the LAI process.
However I get these error message, is that something related to S2tbx?

INFO: org.hsqldb.persist.Logger: dataFileCache open start
SEVERE: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when reading /root/.snap/auxdata/s2tbx/biophysical/2_1/LAI_Cw/LAI_Cw_TestCases
WARNING: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when loading coefficients TEST_CASES for variable LAI_Cw. They won’t be available.
SEVERE: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when reading /root/.snap/auxdata/s2tbx/biophysical/2_1/FCOVER/FCOVER_TestCases
WARNING: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when loading coefficients TEST_CASES for variable FCOVER. They won’t be available.
SEVERE: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when reading /root/.snap/auxdata/s2tbx/biophysical/2_1/FCOVER/FCOVER_DefinitionDomain_MinMax
WARNING: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when loading coefficients DEFINITION_DOMAIN_MINMAX for variable FCOVER. They won’t be available.
SEVERE: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when reading /root/.snap/auxdata/s2tbx/biophysical/2_1/FCOVER/FCOVER_DefinitionDomain_Grid
WARNING: org.esa.s2tbx.biophysical.BiophysicalAuxdata: Error when loading coefficients DEFINITION_DOMAIN_GRID for variable FCOVER. They won’t be available.

I am running SNAP in LinuxBiophysical.xml (1.3 KB)