"ValueError: operands could not be broadcast together with shapes" when I try to run "Sharpen LST"

INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: GDAL 3.0.2 found on system. JNI driver will be used.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Installed GDAL 3.0.2 set to be used by SNAP.
WARNING: org.esa.s2tbx.dataio.gdal.GDALInstaller: Failed to delete the GDAL distribution folder ‘C:\Users\Administrator.snap\auxdata\gdal’.
SEVERE: org.esa.s2tbx.dataio.gdal.GDALLoader: Failed to initialize GDAL native drivers. GDAL readers and writers were disabled.C:\Users\Administrator.snap\auxdata\gdal\environment-variables.dll (另一个程序正在使用此文件,进程无法访问。)
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
INFO: org.esa.s2tbx.dataio.gdal.GDALVersion: Installed GDAL 3.0.2 set to be used by SNAP.
INFO: org.hsqldb.persist.Logger: dataFileCache open start
INFO: org.esa.snap.dataio.bigtiff.BigGeoTiffProductWriter: writing to output file C:\Users\ADMINI~1\AppData\Local\Temp\tmp7ndril4e.tif
INFO: Deriving solar illumination conditions…
Traceback (most recent call last):
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\data_mining_sharpener.py”, line 216, in
main()
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 764, in call
return self.main(*args, **kwargs)
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 717, in main
rv = self.invoke(ctx)
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\data_mining_sharpener.py”, line 50, in main
cos_theta = incidence_angle_tilted(lat, lon, doy, ftime, stdlon=0, A_ZS=aspect, slope=slope)
File “C:\Users\Administrator.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\data_mining_sharpener.py”, line 209, in incidence_angle_tilted
- np.cos(delta) * np.sin(slope) * np.sin(A_ZS) * np.sin(omega))
ValueError: operands could not be broadcast together with shapes (262,276) (5490,5490)
Process exited with value 1
Finished tool execution in 64 seconds

I hope you can help me, thanks a lot!

You probably forgot to run “Wrap to template” operator on the S3 observation geometry files (see Figure 2.2 and section 3.3.1.10 of the User Manual).

Hi Estella, how did you solve this? I am facing the same issue

my error message is as below

C:\Users\arpit\AppData\Local\Temp>“C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\…\python.exe” “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\data_mining_sharpener.py” --sentinel_2_reflectance N:\PunjabEvotranspiration\Base!OUTPUT_reflectance!.dim --sentinel_3_lst N:\PunjabEvotranspiration\Base\S3B_SL_2_LST____20220604T052622_OUTPUT_LST.dim --high_res_dem N:\PunjabEvotranspiration\Base!OUTPUT_SRTM_elevation!.dim --high_res_geom N:\PunjabEvotranspiration\Base\S3B_SL_2_LST____20220604T052622_OUTPUT_observation_geometry_warp.dim --lst_quality_mask N:\PunjabEvotranspiration\Base\S3B_SL_2_LST____20220604T052622_OUTPUT_mask.dim --date_time_utc “2022-06-04 05:26” --elevation_band elevation --lst_good_quality_flags 1 --cv_homogeneity_threshold 0.0 --moving_window_size 30 --parallel_jobs 1 --output N:\PunjabEvotranspiration\Base!OUTPUT_SharpLST!.dim
INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.snap.core.util.EngineVersionCheckActivator: Please check regularly for new updates for the best SNAP experience.
INFO: org.hsqldb.persist.Logger: dataFileCache open start
INFO: org.esa.snap.dataio.bigtiff.BigGeoTiffProductWriter: writing to output file C:\Users\arpit\AppData\Local\Temp\tmpcgxsfe5c.tif
INFO: org.esa.snap.dataio.bigtiff.BigGeoTiffProductWriter: writing to output file C:\Users\arpit\AppData\Local\Temp\tmpdp_xocpd.tif
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn’t match SamplesPerPixel. Defining non-color channels as ExtraSamples.
INFO: org.esa.snap.dataio.bigtiff.BigGeoTiffProductWriter: writing to output file C:\Users\arpit\AppData\Local\Temp\tmprtzfx2fi.tif
INFO: org.esa.snap.dataio.bigtiff.BigGeoTiffProductWriter: writing to output file C:\Users\arpit\AppData\Local\Temp\tmpdx9wq6wt.tif
INFO: Deriving solar illumination conditions…
Saved C:\Users\arpit\AppData\Local\Temp\tmpcgxsfe5c_cos_theta.tif
INFO: Preparing high-resolution data…
INFO: Training regressor…
Traceback (most recent call last):
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\data_mining_sharpener.py”, line 216, in
main()
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 764, in call
return self.main(*args, **kwargs)
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 717, in main
rv = self.invoke(ctx)
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\lib\site-packages\click\core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\sen-et-snap-scripts\data_mining_sharpener.py”, line 97, in main
disaggregator.trainSharpener()
File “C:\Users\arpit.snap\auxdata\sen-et-conda-Win64\lib\site-packages\pyDMS\pyDMS.py”, line 332, in trainSharpener
qualityPix = np.logical_and(qualityPix, ~np.isnan(data_LR))
ValueError: operands could not be broadcast together with shapes (23,45) (24,47)
Process exited with value 1
Finished tool execution in 13 seconds

I was able to solve it… one has to take the geometric info from the s2 reflectance output and then apply it during the s3 preprocessing phase in the reprojection section. refer page 27 and 28 of the revised tutorial.

“Before getting into the S3 pre-processing details, some important geometric information should be taken from the pre-processed S2. From the File /Open product, navigate to the folder of the pre-processed extracted bands, double click on the product, or click advanced, and then say yes in the new popped up window, or use the easiest way of dragging and dropping the product from its container folder; In the Product Explorer expand the image, then the Metadata, Granules, Geometric_Info, and double click on Tile_Geocoding. The outlined information is needed in the next S3_pre-processing steps, specifically in the Reprojection step. See the figures below:”