๐ŸŒ Crafting beautiful maps with PyGMTยถ

Welcome to the EGU22 PyGMT short course ๐Ÿฅณยถ

This Jupyter book ๐Ÿ“– contains PyGMT tutorials for producing maps ๐Ÿ—บ๏ธ and doing geospatial data processing ๐ŸŒ

Each tutorial is rendered on this website for easy viewing ๐Ÿ‘€, but they are all Jupyter notebooks designed to be ran interactively ๐Ÿ’ซ. See the instructions below on how you can start running the tutorials in no time! ๐Ÿš€

Recordingยถ

A recording of the full short course is available on YouTube:

YouTube Playlist

๐ŸŒ  Quickstartยถ

To run these notebooks in an interactive Jupyter session online, ๐Ÿ–ฑ๏ธ click on the button below to launch on regular Binder.

Binder

Alternatively, you can go to a specific tutorial page, hover over the rocket ๐Ÿš€ icon on the top right, and click โ€˜Binderโ€™.

Note

If you see an error like toomanyrequests: You have reached your pull rate limit, you can try this Pangeo Binder link instead as a backup, though it will require a GitHub account to work:

Pangeo Binder

๐Ÿ’ป Running the notebooks locallyยถ

If you prefer to run the ๐Ÿง‘โ€๐Ÿซ tutorials with a local installation of PyGMT, then follow along! For this EGU22 short course, we recommend creating a virtual conda environment and installing the ๐Ÿ Python libraries inside.

Tip

For users comfortable with using git, feel free to โฌ‡๏ธ download or clone the repository containing the short course materials directly using git clone https://github.com/GenericMappingTools/egu22pygmt.git

Hereโ€™s the instructions to install the egu22pygmt environment:

  1. Ensure that you have the conda package manager installed (e.g. via miniconda or Anaconda). You can also use mamba which tends to be a โšก faster alternative.

  2. Make a folder called โ€˜egu22pygmtโ€™. This will be where you will put all the Jupyter notebooks and data files ๐Ÿ—ƒ๏ธ used in the short course.

  3. Download a copy of the โ€˜environment.ymlโ€™ file which contains a ๐Ÿ“„ list of dependencies required to run the tutorials in this short course. Get it at https://github.com/GenericMappingTools/egu22pygmt/blob/main/environment.yml.

  4. Run the following commands on the ๐Ÿง‘โ€๐Ÿ’ป command-line to create the virtual environment

    cd /path/to/egu22pygmt
    conda env create --name egu22pygmt --file environment.yml
    
  5. Once the installation is completed ๐Ÿ, launch Jupyter Lab as follows:

    conda activate egu22pygmt
    jupyter lab
    

    This should open up a page in your default browser. If not, you can click and open the ๐Ÿ”— link that says http://localhost:8888/lab?token=... in your command-line terminal and this will will take you to the Jupyter Lab page.

  6. Download the Jupyter notebook(s) you want to run (e.g. https://www.generic-mapping-tools.org/egu22pygmt/first-figure.html) using either the download button on the โ†—๏ธ top right (select โ€˜.ipynbโ€™) or from GitHub at https://github.com/GenericMappingTools/egu22pygmt/tree/main/book. Make sure to put the *.ipynb file(s) inside of the โ€˜egu22pygmtโ€™ folder.

  7. Open the Jupyter notebook in the left-pane file browser, e.g. by ๐Ÿ–ฑ๏ธ double-clicking on first-figure.ipynb. You are now ready to run through the course materials ๐ŸŽ‰!

Note

If youโ€™re intending to use PyGMT in another project outside of this course, please follow the official installation instructions at https://www.pygmt.org/latest/install.html