In this tutorial, we will read MSG data and display a few composites and channels, in satellite projection and on predefined areas.
If you went through the installation procedure described in tutorial 0, you should be all set up :)
The first step is to find the files to load, and to create a Scene
instance
from satpy import Scene, find_files_and_readers
files = find_files_and_readers(base_dir='/tcenas/scratch/pytroll/ex1/',
reader='seviri_l1b_native')
scn = Scene(filenames=files)
To list the available datasets run 'available_composite_names' method
scn.available_dataset_names()
Then we decide on a composite to load and display it on screen. To get the list of available composites, use the available_composite_names
method.
print(scn.available_composite_names())
composite = 'natural_color'
scn.load([composite])
scn.show(composite)
The loaded composite is a DataArray
from the xarray
library, containing the data, the projection coordinates of the pixels and some metadata.
scn[composite]
Load and display other composite, like fog
and airmass
A simple call to the resample
method is enough to resample the data to another area. Here, we use the predefined area euro4
, but we will see in another tutorial how to customize the areas. Some other predifined areas are euron1
, eurol
, germ
newscn = scn.resample('euro4', radius_of_influence=20000)
newscn.show(composite)
The save_dataset
method can be used to save the image to disk. Formats supported for writing are some of the standard image formats (png, jpeg), GeoTIFF, NetCDF. The default will be to save to GeoTIFF with a filename based on the composite name and the start time of the scene.
newscn.save_dataset(composite)
Alternatively, one can specify the filename to save to (and using the proper extension, the format).
newscn.save_dataset(composite, filename='really_cool_pic.png')
It is also possible to load the seviri channels individually (using their names or approximate wavelengths in µm) and work with them. To get the list of available channels, use the available_dataset_names
method.
scn.load([10.8, 12.0])
scn['t11-t12'] = scn[10.8] - scn[12.0]
scn.show('t11-t12')
Try to resample t11-t12
, and if it doesn't work, try to fix it :)
(Hint: look at the metadata)