Dr. Xiao-Le Deng

Ubuntu安装Tesseroid1.2.1和Gravitational Curvatures of Tesseroids

2020-09-29 13:00
#Linux #Researchsoftware #Geodesy

1.下载

在以下页面下载:

两篇文献的引用格式为:

Uieda, L., V. Barbosa, and C. Braitenberg (2016), Tesseroids: Forward-modeling gravitational fields in spherical coordinates, GEOPHYSICS, F41-F48, doi:10.1190/geo2015-0204.1.

Deng, X.L., Shen, W.B (2019), Topographic effects up to Gravitational Curvatures of tesseroids: A case study in China, Studia Geophysica et Geodaetica, 63(3), 345-366, doi:10.1007/s11200-018-0772-4.

2.文件操作

包括:解压和文件复制。

unzip tesseroids-1.2.1.zip
unzip Gravitational_Curvatures_of_Tesseroids-master.zip

cd Gravitational_Curvatures_of_Tesseroids-master/
cp -r src/ ../tesseroids-1.2.1
cp SConstruct ../tesseroids-1.2.1

3.安装必要python库

查看必要的python库:

cd ../tesseroids-1.2.1/
cat python-requirements.txt

显示为:

matplotlib
basemap
numpy
sphinx
scons

使用conda安装python库【需要提前安装Anaconda3】:

conda install matplotlib
conda install basemap
conda install numpy
conda install sphinx
conda install scons

4.scons编译

在终端下输入:

cd ..
scons

编译成功后,可以看到bin目录。

原始的tesseroids-1.2.1/SConstruct会出现以下错误:

File "/home/shalom/tesseroids-1.2.1/SConstruct", line 22
    print "Error: unknown mode '%s'" % (mode)
          ^
SyntaxError: invalid syntax

这个错误是因为tesseroids1.2.1采用的是python2的输出,需要改为python3的输出。

SConstruct文件的22行和25行,分别改为:

   print("Error: unknown mode '%s'" % mode)

print('**** Compiling in ' + mode + ' mode...')   

修改完成后,scons能编译成功。

4.添加环境变量

将bin目录添加到系统的环境变量。

Windows下可参考:adding the bin folder to your PATH environment variable

Ubuntu下,打开~/.bashrc

gedit ~/.bashrc

加入以下命令:

export PATH=/home/shalom/tesseroids-1.2.1/bin:$PATH

使之有效:

source ~/.bashrc

5.测试安装成功

tessgzzz -h

显示:

tessgzzz -h
Usage: tessgzzz MODELFILE [OPTIONS]

Calculate the gzzz component due to a tesseroid model on
specified observation points.

Values are calculated in the local coordinate system of the
observation point: x-> North  y-> East  z-> Up (away from the
center of the Earth).
In order to maintain mainstream convention, component gz is
calculated with z-> Down.

All units either SI or degrees!

The computation of the gravitational effect of the tesseroids
is done using the Gauss-Legendre Quadrature (GLQ) numerical
integration method.

WARNING: Avoid computing directly on top or inside the
         tesseroids! This will break the GLQ and the formulas!

Input:
  Computation points passed through standard input (stdin).
  Reads 3 or more values per line and inteprets the first 3 as:
    longitude, latitude and height
  of a computation points. Height should be in meters.
  Othervalues in the line are ignored.
  Lines that start with # are ignored as comments.
  Lines should be no longer than 10000 (ten thousand) characters.

Output:
  Printed to standard output (stdout) in the form:
    lon lat height ... result
  ... represents any values that were read from input and
  ignored. In other words, the result is appended to the last
  column of the input. Use this to pipe tessg* programs
  together.
  * Comments about the provenance of the data are inserted into
    the top of the output

MODELFILE: File containing the tesseroid model
  * Each tesseroid is specified by the values of its borders
    and density
  * The file should contain one tesseroid per line
  * Each line should have the following column format:
      West East South North Top Bottom Density
  * Top and Bottom should be read as 'height to top' and 
    'height to bottom' from the mean Earth radius. Use negative
    values if bellow the surface, for example when modeling
    deep structures, and positive if above the surface, for
    example when modeling topography.
  * If a line starts with # it will be considered a comment and
    will be ignored.

Options:
  -a             Disable the automatic subdividing of
                 tesseroids. Subdividing is done to ensure the
                 GLQ gives accurate results. ONLY USE THIS
                 OPTION IF YOU KNOW WHAT YOU ARE DOING!
  -tRATIO        Use a custom distance-size ratio for the
                 automatic subdivision of tesseroids. ONLY USE
                 THIS OPTION IF YOU KNOW WHAT YOU ARE DOING!
  -oOLON/OLAT/OR GLQ order to use in the longitudinal,
                 latitudinal and radial integrations,
                 respectively. Defaults to 2/2/2.
                 Subdividing of tesseroids works best with the
                 default order.
  -h             Print instructions.
  --version      Print version and license information.
  -v             Enable verbose printing to stderr.
  -lFILENAME     Print log messages to file FILENAME.

Part of the Tesseroids package (v1.2.1).

Project site: <http://www.leouieda.com/tesseroids/>
Report bugs at: <https://github.com/leouieda/tesseroids/issues>

Copyright (C) 2011-2020, Leonardo Uieda.
This software is distributed under the terms of the BSD License:
<http://tesseroids.readthedocs.org/en/latest/license.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.