MarcYin / SIAC

A sensor invariant Atmospheric Correction (SIAC)
http://www2.geog.ucl.ac.uk/~ucfafyi/Atmo_Cor/
GNU Affero General Public License v3.0
61 stars 17 forks source link

Create NBAR from Sentinel-2 image generated with VIIRS BRDF data #20

Closed nbennasr closed 1 year ago

nbennasr commented 1 year ago

I tested the create_nbar(...) function with the following parameters: s2_file_dir=S2A_MSIL1C_20220825T155541_N0400_R011_T17QRG_20220825T205824.SAFE (Sentinel-2 image generated with VIIRS BRDF data) nbar_sza='temporal_average_sza', mosaic_start_date=datetime.datetime.strptime('2022-08-25', '%Y-%m-%d'), mosaic_end_date=datetime.datetime.strptime('2022-08-25', '%Y-%m-%d'), Gee = False, use_VIIRS = True

I get the error below due to a division by zero interped_f0, interped_f1, interped_f2 defined in line 561 are zeros because all kernal weights are zeros and unc are 150 line 693: rho_mod_s2_ang = kers np.array([interped_f0[ind], interped_f1[ind], interped_f2[ind]]) line 703: rho_mod_s2_nadir = kers np.array([interped_f0[ind], interped_f1[ind], interped_f2[ind]]) line 709: c_factor = rho_mod_s2_nadir / rho_mod_s2_ang line 719: c_factor_unc = np.abs(c_factor) np.sqrt((rho_mod_s2_nadir_unc / rho_mod_s2_nadir)2 + (rho_mod_s2_ang_unc / rho_mod_s2_ang)2 - 2 rho_mod_s2_nadir_unc rho_mod_s2_ang_unc corrcoef / (rho_mod_s2_nadir * rho_mod_s2_ang))

division by zeros in lines 709 and 719 rho_mod_s2_ang and rho_mod_s2_nadir will be arrays of zeros c_factor will be an arrays of nan

image

However NBAR creation works well with the same parameters except the sentinel-2 image generated with MODIS BRDF data.

nbennasr commented 1 year ago

The issue is related to data not synchronized to disk in reading VNP43 files with gdal 3.0.4, everything is ok with gdal 3.6