Lambert projection

Lambert projection

This is one cell notebook example that will help you set Lambert projection using Magics.

Installing Magics

If you don't have Magics installed, run the next cell to install Magics using conda.

# Install Magics in the current Jupyter kernel
import sys
!conda install --yes --prefix {sys.prefix} Magics

Magics supports several different projections, and they are controled using mmap funciton.

List of all mmap parameters and projections you can find in Magics documentation.

import Magics.macro as magics

# Setting the projection
projection = magics.mmap(
    subpage_map_projection        = "lambert",
    subpage_lower_left_latitude   = -0.00,
    subpage_lower_left_longitude  = -80.00,  
    subpage_upper_right_latitude  = 70.00,
    subpage_upper_right_longitude = 160.00,
    subpage_map_area_definition   = "corners",
    page_id_line                  = "off")

# Defining the coastlines
coast = magics.mcoast(
    map_coastline_resolution        = "automatic",
    map_coastline_colour            = "tan",
    map_coastline_land_shade        = "on",    
    map_coastline_land_shade_colour = "cream",
    map_grid                        = "on",
    map_grid_line_style             = "dot",
    map_grid_colour                 = "tan"
)

magics.plot(projection, coast)

Note that this example is only skeleton to illustrate the functionality of Magics.


You can download this Jupyter notebook from the ECMWF github space.














More about coastline plotting in coastline examples.



Plotting in directly in Jupyter notebooks doesn't need output to be specified. Most of the time you will want an output.

To run this outside of Jupyter notebooks add this piece of code:
png = magics.output(
    output_formats = ['png'],
    output_name_first_page_number = "off",
    output_name = "my_png")
magics.plot(png, projection, coast)