Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting view and sun angles #12

Open
ei-con opened this issue Oct 5, 2021 · 10 comments
Open

Selecting view and sun angles #12

ei-con opened this issue Oct 5, 2021 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ei-con
Copy link

ei-con commented Oct 5, 2021

I tried the Sentinelloader for my study site, and works well, thank you. I am in fact not interested in downloading the optical bands but the raster layers of sun and view angles: view_zenith_mean, view_azimuth_mean, sun_zenith, sun_azimuth.
Is it possible to download those layers instead of the band selection?

@flaviostutz
Copy link
Owner

If this is a regular band from Sentinel API (I really don't remember this as being a band name), you can set the band name on sentinel loader's call, on the band parameter (I don't remember the exact name, please take a look).

Could you please send me something from the docs explaining about those bands for me to check?

@ei-con
Copy link
Author

ei-con commented Oct 6, 2021

Looking at file in the SAFE format that I download from the Copernicus hub, they are not available as .jp2 files that I can call directly. Yet, if you open the file is SNAP, they are available as rasters (e.g. screenshot below).

Screenshot 2021-10-06 at 10 54 22

and here is an extract describing them from the ESA's documentation https://sentinel.esa.int/documents/247904/685211/Sentinel-2-Products-Specification-Document
Screenshot 2021-10-06 at 11 01 35

@flaviostutz
Copy link
Owner

flaviostutz commented Oct 6, 2021 via email

@ei-con
Copy link
Author

ei-con commented Oct 6, 2021

Here is just a view of the images, and yes they are geolocalized.
But, in the SAFE file format, I only found them in the MTD_TL.xml in the GRANULE subdirectory and are sampled at 5000m,

e.g. for Viewing_Incidence_Angles_Grids, here is an extract

  _</Viewing_Incidence_Angles_Grids>
  <Viewing_Incidence_Angles_Grids bandId="0" detectorId="5">
    <Zenith>
      <COL_STEP unit="m">5000</COL_STEP>
      <ROW_STEP unit="m">5000</ROW_STEP>
      <Values_List>
        <VALUES>NaN NaN NaN NaN NaN NaN NaN 4.06849 3.73064 3.40345 3.09056 2.79688 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN</VALUES>
        <VALUES>NaN NaN NaN NaN NaN NaN 4.3193 3.97529 3.64006 3.31648 3.00826 2.72084 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN</VALUES>
        <VALUES>NaN NaN NaN NaN NaN NaN 4.22447 3.88267 3.55035 3.2305 2.92744 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN</VALUES>

so, maybe what is best is to extract the MTD_TL.xml through the Sentinelloader, and then I can create rasters from the data? Is that possible?

Screenshot 2021-10-06 at 12 54 58

@flaviostutz
Copy link
Owner

flaviostutz commented Oct 6, 2021 via email

@ei-con
Copy link
Author

ei-con commented Oct 6, 2021

I think so. We can render a Geo raster from the data from the xml and interpret this data request as another “band name”. Is that the thing you were thinking?

Sounds perfect. If too complicated, we can just get the XML files through Sentinelloader and then I work on them.

The sun positioning info is meant to be in sync with the time the sensors data were captured, right?

yes

I didn’t realize the difference between azimuth and azimuth_mean. Do you know what is it? One is related to sun incidence and the other is related to which view? Aren't the satellites always facing earth at the same angle?

The mean bands are available for the view angles (not sun angles). In fact, here it is a bit tricky because the view angles are originally provided per band due to the sensor's specs. Yet, a mean value per grid cell of all band view angles are provided in the mean value layer (mean azimuth and mean zenith). Those mean layers are what I use and work well for my purpose. The screenshot below shows you an overview of how the layers are

Screenshot 2021-10-06 at 14 12 52

@flaviostutz
Copy link
Owner

The problem with "getting the XML" is that the result from SentinelLoader e a geolocalized raster... for returning the XML files we need a context (this is what the "product" does). I am not sure how to create an interface for this. For a single call to sentinelloader, sometimes I call multiple Copernicus products and then merge, cut and glue them together in order to compose the final desired area. I am not sure on how to "merge" those XMLs without rastering it.

It could help if you find a utility that rasters those XML files from Python so I can evaluate how hard it could be to add this feature here. If you have an idea of an API interface for returning those XML files I can think on something as well...

@ei-con
Copy link
Author

ei-con commented Oct 7, 2021

I found this. https://github.com/brazil-data-cube/s2-angs

@flaviostutz
Copy link
Owner

Great, @ei-con. It seems like a useful tool for our needs. I will try to give this a try on the following days.

@ei-con
Copy link
Author

ei-con commented Oct 14, 2021

looking forward! let me know if i can help.

@flaviostutz flaviostutz added enhancement New feature or request help wanted Extra attention is needed labels Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants