Playing with Metop AVHRR data


In this tutorial, we will read Metop AVHRR data and display a few composites, in satellite projection and on a couple of areas, and add coastlines to some images.

Finding the files, filtering with time

The data for this tutorial is comprised of a handfull of Metop-B AVHRR/3 granules, that span over a couple of hours time. Since we just want work with a fraction of all that data, one solution is to define a start and end time and filter the files we provide to Scene

In [ ]:
from satpy import Scene, find_files_and_readers
from datetime import datetime
import pprint

files = find_files_and_readers(base_dir='/tcenas/scratch/pytroll/ex2',
                               start_time=datetime(2018, 10, 7 ,9, 25),
                               end_time=datetime(2018, 10, 7 , 9, 30))

scn = Scene(filenames=files)

Then we decide on a composite to load and display it on screen

In [ ]:
In [ ]:
composite = 'overview'

Resampling and displaying with coastlines

Resampling is done exactly as in the previous tutorial. However this time we will display the data with coastlines on top.

In [ ]:
newscn = scn.resample('euro1')
In [ ]:, overlay={'coast_dir': '/tcenas/scratch/pytroll/shapes/', 'color': (255, 0, 0), 'resolution': 'i'})

For more information on which parameters you can pass for the coastline burning, check the pycoast documentation.

Dynamic area resampling

For polar data, it can be convenient do resample the data in a given projection, but adapt the area extent to the actual data being resampled. For this, we have at the moment two dynamic areas we can use: omerc_bb for the oblique mercator projection and laea_bb for the lambert azimuthal equal-area projection. Note: laea_bb here will not yield a sensible result for the used dataset.

In [ ]:
# Resample and show the image
newscn = scn.resample('omerc_bb'), overlay={'coast_dir': '/tcenas/scratch/pytroll/shapes/', 'color': (255, 0, 0), 'resolution': 'i'})

Filtering the data by area

When we have many data granules, it can be convenient to load only those covering a given area. We can achieve this by using the parameter filtering during the Scene instanciation

In [ ]:
files = find_files_and_readers(base_dir='/tcenas/scratch/pytroll/ex2',
scn = Scene(filenames=files, filter_parameters={'area':'germ'})
In [ ]:
composite = 'natural_color'
newscn = scn.resample('eurol'), overlay={'coast_dir': '/tcenas/scratch/pytroll/shapes/', 'color': (255, 0, 0), 'resolution': 'i'})

Saving the data

Satpy allows you to save the data in various formats, e.g. GeoTIFF

In [ ]:

Exercise 2.1

Generate an ndvi product using the individual channels and display the result on the euron1 area. Then save your work as PNG.

NDVI formula: ndvi = (vis08 - vis06) / (vis08 + vis06)

In [ ]: