GeoPython,a project of using Python for geology related daily work

GeoPython, a project of using Python for geology related daily work

GeoPython,一个将 Python 用于地质学的日常工作的计划

author: cycleuser
Copyright 2016 cycleuser
MileStone Date Function
Beginning Date 2016-07-07 6:20 TAS
Adding QAPF 2016-07-09 08:32 QAPF
Adding Wulff 2016-12-18 08:32 Wulf


GeoPython is a project of using Python for geology related daily work. It is a set of free softwares: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GeoPython 是一个将 Python 用于地质学的日常工作的计划。这是一套自由软件:你可以重新分发或者做出修改,但必须基于由自由软件基金会发布的GNU通用公共许可证第三版的许可,或其后的版本。 and are all Python modules of plotting data of volcanic rocks. All data used in this module are from the book: "Igneous Rocks_ a Classification and Glossary of Terms" by R.W. Le Maitre & International Union of Geological Sciences 2002 和 都是用于火山岩数据投图的 Python 模块。 其中所有用到的数据引用自下面这本书: 《火成岩—分类和术语表》 R.W. Le Maitre & International Union of Geological Sciences 2002

Texts below is cited from this book as an introduction:


The TAS (Total Alkali  Silica) classification should be used only if:
>TAS 全碱-硅)分类法只适用于以下条件:

(1) the rock is considered to be volcanic

(2) a mineral mode cannot be determined, owing either to the presence of glass or to the fine-grained nature of the rock
(3) a chemical analysis of the rock is available.


QAPF modal classification of volcanic rocks (based on Streckeisen, 1978, Fig. 1).
>QAPF 火山岩模式分类基于 Streckeisen1978年的文献。

(1) The corners of the double triangle are Q = quartz, A = alkali feldspar, P = plagioclase and F = feldspathoid.
>双三角图解中的 Q 代表石英,A 代表碱性长石,P 代表斜长石,F 代表似长石。

(2) This diagram must not be used for rocks in which the mafic mineral content, M, is greater than 90%.



This module is written with Python3.4 and based on numpy, matplotlib and pandas. That means you need to install them.

本模块是在Python 3.4下写的,基于 numpy, matplotlib 以及 pandas。所以这几个包你都得安装。

You can install these packages with PIP:


pip install numpy
pip install matplotlib
pip install pandas

Background Information


You can also set width, color and other features in the Xlsx files. And the introduction can be found here


Usage Under Windows


Just put your data in the correspoinding Xlsx file and double click the correspoinding EXE file.


Usage with Python


In order to use these modules, you need to install geopython with pip:


pip install geopython

Then open you python , and enter to the location path of data files, which are the xlsx files that you still need to download from here. Then you can use geopython as the codes below:


import geopython as gp


Remember that you need to import the module first and then you can use the functions in it.


You need to put you data in a xlsx file in the same form as the example files.


If python told you that it cannot find a xlsx file, you must have entered to the wrong location, and you need to use the cd command to go to the path containing xlsx files that you downloaded and modiffed.


Then you only need to input the data from the file, and everything will be done.


If the data file is in the right form and nothing goes wrong, you will have three files, which will be in the same location of these xlsx files:


  • a svg(Scalable Vector Graphics) file which can be modified directly in Adobe Illustrator or Corel Draw,

    • 一个碉堡的 svg(一种矢量图)文件,直接就能用Adobe Illustrator 或者 Corel Draw来打开编辑。
  • a png (Portable Network Graphics) .

    • 然后就是一个png图像了。

IDE Server Raspbian Discuss MayaVi Poem Translation Hackintosh Library GlumPy Data Moon Kivy University Disease NAS Pyenv Life ChromeBook QT Download Photo RTL-SDR Microscope Scholar VisPy Game PyOpenCL Mount&Blade CUDA Chat Hardware VTK Programming OpenCL Conda RaspberryPi VirtualBox Hate Software Video Story Book Mac Science DIY Lesson Memory GeoPython Geology Camera Junck Visualization Hack Python Lens Telescope Radio Communicate Linux Xcode