I am working with Sentinel-2 images and would like to generate per pixel angle bands (view_zenith, view_azimuth, sun_zenith and sun_azimuth).
Considering Sentinel-2 SAFE structure, I found that MTD_TL.xml (metadata) describes the angle bands. This XML file describes the angle bands as 5000m resolution 23x23 data. Regarding solar zenith and azimuth each one is separated in one matrix, while for view zenith and azimuth it is distributed in several matrix based on the band and detectors. Another consideration to be done is that this 23x23 matrix (at 5000m) is larger than the granule image. Regarding this, from ESA Sentinel Application Platform (SNAP) forum (https://forum.step.esa.int/t/generate-view-angles-from-metadata-sentinel-2/5598/2) I found out that not all fields from this matrix are used (normally the last row and column).
That said, I would like to know if there is any code or platform that is used to calculate Sentinel-2 angle bands. I found out that SNAP can perform that but it has several memory issues.
I started developing a script to calculate the angle images. If anyone need something similar, it can be found at https://github.com/marujore/sentinel_angle_bands . The only parameter is the MTD_TL path in the sentinel ".SAFE/GRANULE" folder. However, the sensor azimuth bands are not satisfatory, as can be seen in attached images (view_zenith, view_azimuth, sun_zenith and sun_azimuth at 23x23 5000m resolution and the same images resampled by bilinear function).