0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PyGMTの導入

Last updated at Posted at 2020-08-11

PythonでGMTがつかえるらしいので入れてみる。
https://www.pygmt.org/dev/install.html

仮想環境の構築

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

サンプルテスト

チュートリアルにしたがってすすめる。

conda install pytest pytest-mpl ipython

pythonを起動して、

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

返ってきたメッセージ

============================== 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.

けっこう失敗している気がするけど、これでいいのか?
GMT5も入れているので、チュートリアルにある通りGMT_LIBRARY_PATHも設定してみたが、failedの数は変わらなかった。

とりあえず地図!

チュートリアル通りに、絵を描いてみた。

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")

うまくかけました!
ただし、JupyterLabがDark modeだとなにも見えない・・・oh

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?