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

Seviri L1b native Solar zenith angle #1510

Closed
cherif2019-dev opened this issue Jan 19, 2021 · 10 comments
Closed

Seviri L1b native Solar zenith angle #1510

cherif2019-dev opened this issue Jan 19, 2021 · 10 comments
Assignees
Labels

Comments

@cherif2019-dev
Copy link

Please, how to get the solar zenith angle fom the Eumetsat seviri L1b native scene.

@mraspaud
Copy link
Member

@ameraner @sjoro ?

@simonrp84
Copy link
Member

Hi @cherif2019-dev, for this you need to also use the pyorbital library.
Here's an example script, please note you'll have to adapt the filenames:

from satpy import Scene
from pyorbital import astronomy

# Choose composite
compo = 'natural_color'

# Create scene and load composite
scn = Scene([my_input_nat_file', reader='seviri_l1b_native')
scn.load([compo], upper_right_corner='NE')

# Extract longitudes and latitudes from scene area
lons, lats = scn[compo].attrs['area'].get_lonlats()
sza = astronomy.sun_zenith_angle(scn.start_time, lons, lats)

This will give you the solar zenith angle for each pixel as a numpy array, sza.
You can save the results with:

import numpy as np
import gdal
scn.save_dataset('natural_color', filename=my_rgb_filename, fill_value=0)
rows, cols = sza.shape
ds = gdal.GetDriverByName('GTiff').Create(my_sza_filename, cols, rows, 1, gdal.GDT_Float32)
ds.GetRasterBand(1).WriteArray(sza)
ds = None

@cherif2019-dev
Copy link
Author

cherif2019-dev commented Jan 19, 2021 via email

@mraspaud
Copy link
Member

You can use the astronomy.sun_zenith_angle function as @simonrp84 showed.

@cherif2019-dev
Copy link
Author

cherif2019-dev commented Jan 19, 2021 via email

@ameraner
Copy link
Member

Thanks @simonrp84 for the nice code snippet! I'll close this issue, @cherif2019-dev feel free to reopen it or add comments if you have further questions.

@cherif2019-dev
Copy link
Author

cherif2019-dev commented Feb 1, 2021 via email

@ameraner
Copy link
Member

ameraner commented Feb 1, 2021

Hi @cherif2019-dev, could you please elaborate on what differences you see? In theory there shouldn't be any.

@cherif2019-dev
Copy link
Author

cherif2019-dev commented Feb 1, 2021 via email

@ameraner
Copy link
Member

ameraner commented Feb 1, 2021

@cherif2019-dev I'm afraid the attachments to the email are not included in the issue reply and are now lost. Could you please post the images as an answer to the issue via the Github webpage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants