[PYTHON] Introduction of PyGMT

It seems that GMT can be used in Python, so I will add it. https://www.pygmt.org/dev/install.html

Building a virtual environment

python


conda create -n pygmt python=3.8.2
conda activate pygmt
conda install pip numpy pandas xarray netcdf4 packaging gmt
conda install pygmt -c conda-forge
conda install ipython jupyter jupyterlab -c conda-forge

Sample test

Follow the tutorial.

python


conda install pytest pytest-mpl ipython

Start python and

python


import pygmt
pygmt.show_versions()
pygmt.test()

Message returned

python


============================== 53 failed, 212 passed, 1 skipped, 353 warnings in 83.38s (0:01:23) ==============================
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kanon/local/anaconda3/envs/pygmt/lib/python3.8/site-packages/pygmt/__init__.py", line 187, in test
    assert status == 0, "Some tests have failed."
AssertionError: Some tests have failed.

I feel like I've failed quite a bit, is this okay? I also included GMT5, so I tried setting GMT_LIBRARY_PATH as in the tutorial, but the number of ** failed ** did not change.

Map for the time being!

I drew a picture according to the tutorial.

python


import pygmt

fig = pygmt.Figure()

fig.basemap(region=[-90,-70,0,20], projection="M8i", frame=True)

fig.coast(shorelines=True)

fig.show()

fig.savefig("test_pygmt.png ")

It worked! However, I can't see anything when Jupyter Lab is in Dark mode ... oh

Recommended Posts

Introduction of PyGMT
Introduction of Python
Introduction of scikit-optimize
Introduction of cymel
Introduction of Python
Introduction of ferenOS 1 (installation)
Introduction of Virtualenv wrapper
Introduction
Introduction of activities applying Python
Introduction of caffe using pyenv
Introduction and tips of mlflow.Tracking
Introduction and Implementation of JoCoR-Loss (CVPR2020)
Introduction and implementation of activation function
Introduction of data-driven controller design method
Introduction of pipenv (also create requirements.txt)
Introduction of ferenOS 3 (package update, installation)
Introduction of python drawing package pygal
Record of Python introduction for newcomers
A little niche feature introduction of faiss
kivy introduction
General Theory of Relativity in Python: Introduction
Easy introduction of speech recognition with Python
[EDA] Introduction of Sweetviz (comparison with + pandas-profiling)
Introduction of Go's RDB access library (go-pg/pg)
Complete everything with Jupyter ~ Introduction of nbdev ~
Easy introduction of python3 series and OpenCV3
Introduction to Scapy ① (From installation to execution of Scapy)
[Introduction to Data Scientists] Basics of Python ♬
Introduction of SoftLayer Command Line Interface environment
[Introduction to cx_Oracle] (16th) Handling of LOB types
[Introduction to Udemy Python 3 + Application] 26. Copy of dictionary
[Introduction to Udemy Python 3 + Application] 19. Copy of list
[Introduction to cx_Oracle] (Part 3) Basics of Table Reference
Python & Machine Learning Study Memo ②: Introduction of Library
Introduction of Python Imaging Library (PIL) using HomeBrew
Introduction of ferenOS 2 (settings after installation, Japanese input settings)
Kyoto University Python Lecture Material: Introduction of Columns
[Translation] scikit-learn 0.18 Tutorial Introduction of machine learning by scikit-learn
[Introduction to cx_Oracle] (5th) Handling of Japanese data
[Introduction to cx_Oracle] (Part 7) Handling of bind variables
From the introduction of pyethapp to the execution of contract
[Introduction to Python] Basic usage of lambda expressions