Ubuntu installs Tesseroid1.2.1 and Gravitational Curvatures of Tesseroids

1. Download

Dowload the files:

The references are:

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

  1. Unzip and copy
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
  1. Install python requirements
cd ../tesseroids-1.2.1/
cat python-requirements.txt

It shows:

matplotlib
basemap
numpy
sphinx
scons

Using conda to install python requirements:

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

The Anaconda3 should be installed firstly.

4. scons compile

scons

After the compilation is successful, you can see the bin directory.

Original tesseroids-1.2.1/SConstruct will have the following error:

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

This error is due to that tesseroids1.2.1 uses the output of python2, which needs to be changed to the output of python3.

On lines 22 and 25 of the SConstruct file, the codes change to:

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

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

After modification, scons can be compiled successfully.

4. Adding PATH environment

It needs to add the bin directory to the environment variable of the system.

Windows: adding the bin folder to your PATH environment variable

On Ubuntu, open ~/.bashrc by:

gedit ~/.bashrc

Add the following command:

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

Source it by:

source ~/.bashrc

5. Test

tessgzzz -h

shows

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.