Skip to content

Instantly share code, notes, and snippets.

@mraspaud mraspaud/s3_olci_sand.py
Last active Feb 25, 2020

Embed
What would you like to do?
Sand over canaries with sentinel 3
from datetime import datetime
from satpy import Scene, find_files_and_readers
if __name__ == '__main__':
files = find_files_and_readers(start_time=datetime(2020, 2, 22, 11, 0),
end_time=datetime(2020, 2, 22, 12, 0),
base_dir="/data/Sentinel-3/",
reader='olci_l1b')
scn = Scene(filenames=files)
composite = 'true_color'
scn.load([composite])
scn.show(composite)
scn.save_dataset(composite, filename="sand.png")
# credits @simonrp84
from satpy import Scene, find_files_and_readers
from glob import glob
from datetime import datetime
import numpy as np
files = find_files_and_readers(start_time=datetime(2020, 2, 22, 11, 0),
end_time=datetime(2020, 2, 22, 11, 15),
base_dir='/data/Sentinel-3/SLSTR/',
reader='slstr_l1b')
scn = Scene(files, reader='slstr_l1b')
scn.load(['natural_color', 'natural_color_oblique'])
scn2 = scn.resample(scn['natural_color'].area)
scn2.save_dataset('natural_color', filename='SLSTR_Nadir_Sand.png')
scn2.save_dataset('natural_color_oblique', filename='SLSTR_Oblique_Sand.png')
@simonrp84

This comment has been minimized.

Copy link

simonrp84 commented Feb 24, 2020

For SLSTR natural colour composites in both the nadir and oblique views you can use this:

from satpy import Scene, find_files_and_readers
from glob import glob
from datetime import datetime
import numpy as np

files = find_files_and_readers(start_time=datetime(2020, 2, 22, 11, 0),
                               end_time=datetime(2020, 2, 22, 11, 15),
                               base_dir='/data/Sentinel-3/SLSTR/',
                               reader='slstr_l1b')

scn = Scene(files, reader='slstr_l1b')
scn.load(['natural_color', 'natural_color_oblique'])
scn2 = scn.resample(scn['natural_color'].area)
scn2.save_dataset('natural_color', filename='SLSTR_Nadir_Sand.png')
scn2.save_dataset('natural_color_oblique', filename='SLSTR_Oblique_Sand.png')
@mraspaud

This comment has been minimized.

Copy link
Owner Author

mraspaud commented Feb 24, 2020

Thanks a lot @simonrp84 !

@kikocorreoso

This comment has been minimized.

Copy link

kikocorreoso commented Feb 25, 2020

Hi @mraspaud and @simonrp84

This line (line 10 in s3_slstr_sand.py) is wrong:

base_dir=/data/Sentinel-3/SLSTR/',

It should be:

base_dir='/data/Sentinel-3/SLSTR/',

BTW, thanks for the example.

@simonrp84

This comment has been minimized.

Copy link

simonrp84 commented Feb 25, 2020

Thanks, @kikocorreoso. Fixed it now.

@mraspaud

This comment has been minimized.

Copy link
Owner Author

mraspaud commented Feb 25, 2020

Thanks, fixed in the file too.

@mraspaud

This comment has been minimized.

Copy link
Owner Author

mraspaud commented Feb 25, 2020

sand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.