{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Getting started with MSG level 1.5 data, native format" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Summary\n", "In this tutorial, we will read MSG data and display a few composites and channels, in satellite projection and on predefined areas." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Installation and setup\n", "If you went through the installation procedure described in tutorial 0, you should be all set up :)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Loading some data\n", "\n", "The first step is to find the files to load, and to create a `Scene` instance" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "from satpy import Scene, find_files_and_readers\n", "\n", "files = find_files_and_readers(base_dir='/tcenas/scratch/pytroll/ex1/',\n", " reader='seviri_l1b_native')\n", "\n", "scn = Scene(filenames=files)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To list the available datasets run 'available_composite_names' method" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "scn.available_dataset_names()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "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." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "print(scn.available_composite_names())" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "\n", "composite = 'natural_color'\n", "scn.load([composite])\n", "scn.show(composite)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The loaded composite is a `DataArray` from the `xarray` library, containing the data, the projection coordinates of the pixels and some metadata." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "scn[composite]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 1.1\n", "Load and display other composite, like `fog` and `airmass`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Resampling the data\n", "\n", "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`" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "newscn = scn.resample('euro4', radius_of_influence=20000)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "newscn.show(composite)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Saving the image to disk\n", "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." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "newscn.save_dataset(composite)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Alternatively, one can specify the filename to save to (and using the proper extension, the format)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "newscn.save_dataset(composite, filename='really_cool_pic.png')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Working with the individual channels\n", "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." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "scn.load([10.8, 12.0])\n", "scn['t11-t12'] = scn[10.8] - scn[12.0]\n", "scn.show('t11-t12')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exercise 1.2\n", "Try to resample `t11-t12`, and if it doesn't work, try to fix it :)\n", "\n", "(Hint: look at the metadata)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" } }, "nbformat": 4, "nbformat_minor": 2 }