Skip to content

Instantly share code, notes, and snippets.

@mraspaud
Last active February 25, 2020 10:26
Show Gist options
  • Save mraspaud/ab4060cd5074ef5d20100634d02dc4f4 to your computer and use it in GitHub Desktop.
Save mraspaud/ab4060cd5074ef5d20100634d02dc4f4 to your computer and use it in GitHub Desktop.
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
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
Copy link
Author

Thanks a lot @simonrp84 !

@kikocorreoso
Copy link

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
Copy link

Thanks, @kikocorreoso. Fixed it now.

@mraspaud
Copy link
Author

Thanks, fixed in the file too.

@mraspaud
Copy link
Author

sand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment