More about areas and pyresample


In this tutorial, we will learn more about defining areas to work with in pytroll/satpy, and how to save them for later use.

Defining Area Definitions

The areas in pytroll/satpy are defined through the pyresample package.

To define an area, have a look at the pyresample documentation:

In this tutorial, we will create an area definition that covers Sweden, following the official SWEREF99TM.

The projection to use is transverse mercator, with the following parameter:

  • reference longitude is 15
  • scale factor is 0.9996

Sweden is included in a lon/lat box spanning approximately 10 to 25 degrees east and 55 to 70 degrees north. (If you're curious, look here:

Exercise 4.1

Use pyproj to determine the area extent in projection coordinate of the bounding box.

Pyproj documentation:

The transverse mercator projection parameters

Exercise 4.2

Create a pyresample AreaDefinition object using your computed parameters, with a resolution of ~1km

Exercise 4.3

Resample your metop data on your newly defined area definition.

Saving the area

The area definitions can be saved in yaml format. An areas.yaml file is provided in the satpy installation (, but for areas you want to save, it is best to have an areas.yaml file in your working directory that will complete or replace the standard one. Alternatively, you can place your areas file in a directory pointed to by the PPP_CONFIG_DIR environment variable. To export the area you created, use the area's create_areas_def method.

Exercise 4.4

Save the area you just defined into your own areas.yaml file. Resample your metop data using the saved area definition, ie by refering to it by name in the scn.resample call.

In [ ]: