initial upload
10
cookbook/custom_ratio/custom_ratio.bat
Executable file
@@ -0,0 +1,10 @@
|
||||
:: Calculate effect of the model at a low height using difference distance-size
|
||||
:: ratios for the recursive division of tesseroids.
|
||||
:: WARNING: This is only an example. You should not use the -t option in
|
||||
:: practice
|
||||
|
||||
tessgrd -r-3/3/-3/3 -b50/50 -z4e03 | ^
|
||||
tessgzz model.txt -t0.0001 -lratio1.log | ^
|
||||
tessgzz model.txt -t0.5 -lratio2.log | ^
|
||||
tessgzz model.txt -t1 -lratio3.log | ^
|
||||
tessgzz model.txt -v -lratio-default.log > output.txt
|
11
cookbook/custom_ratio/custom_ratio.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Calculate effect of the model at a low height using difference distance-size
|
||||
# ratios for the recursive division of tesseroids.
|
||||
# WARNING: This is only an example. You should not use the -t option in practice
|
||||
|
||||
tessgrd -r-3/3/-3/3 -b50/50 -z4e03 | \
|
||||
tessgzz model.txt -t0.0001 -lratio1.log | \
|
||||
tessgzz model.txt -t0.5 -lratio2.log | \
|
||||
tessgzz model.txt -t1 -lratio3.log | \
|
||||
tessgzz model.txt -v -lratio-default.log > output.txt
|
2
cookbook/custom_ratio/model.txt
Executable file
@@ -0,0 +1,2 @@
|
||||
# Test tesseroid model file
|
||||
-1.5 1.5 -1.5 1.5 0 -5000 200
|
18
cookbook/custom_ratio/plot.py
Executable file
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
Plot the columns of the output files
|
||||
"""
|
||||
import sys
|
||||
from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
data = np.loadtxt(sys.argv[1], unpack=True)
|
||||
shape = (int(sys.argv[2]), int(sys.argv[3]))
|
||||
lon = np.reshape(data[0], shape)
|
||||
lat = np.reshape(data[1], shape)
|
||||
for i, value in enumerate(data[3:]):
|
||||
value = np.reshape(value, shape)
|
||||
plt.figure(figsize=(4, 3))
|
||||
plt.title("Column %d" % (i + 4))
|
||||
plt.contourf(lon, lat, value, 50)
|
||||
plt.colorbar()
|
||||
plt.savefig('column%d.png' % (i + 4))
|
22805
cookbook/dem_brasil/dem.xyz
Executable file
22
cookbook/dem_brasil/dem_brasil.bat
Executable file
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
:: First, insert the density information into
|
||||
:: the DEM file using the Python script.
|
||||
python dem_density.py dem.xyz > dem-dens.txt
|
||||
|
||||
:: Next, use the modified DEM with tessmodgen
|
||||
:: to create a tesseroid model
|
||||
tessmodgen -s0.166667/0.166667 -z0 -v < dem-dens.txt ^
|
||||
> dem-tess.txt
|
||||
|
||||
:: Calculate the GGT on a regular grid at 250km
|
||||
:: use the -l option to log the processes to files
|
||||
:: (usefull to diagnose when things go wrong)
|
||||
:: The output is dumped to dem-ggt.txt
|
||||
tessgrd -r-60/-45/-30/-15 -b50/50 -z250e03 | ^
|
||||
tessgxx dem-tess.txt -lgxx.log | ^
|
||||
tessgxy dem-tess.txt -lgxy.log | ^
|
||||
tessgxz dem-tess.txt -lgxz.log | ^
|
||||
tessgyy dem-tess.txt -lgyy.log | ^
|
||||
tessgyz dem-tess.txt -lgyz.log | ^
|
||||
tessgzz dem-tess.txt -lgzz.log -v > dem-ggt.txt
|
22
cookbook/dem_brasil/dem_brasil.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# First, insert the density information into
|
||||
# the DEM file using the Python script.
|
||||
python dem_density.py dem.xyz > dem-dens.txt
|
||||
|
||||
# Next, use the modified DEM with tessmodgen
|
||||
# to create a tesseroid model
|
||||
tessmodgen -s0.166667/0.166667 -z0 -v < dem-dens.txt \
|
||||
> dem-tess.txt
|
||||
|
||||
# Calculate the GGT on a regular grid at 250km
|
||||
# use the -l option to log the processes to files
|
||||
# (usefull to diagnose when things go wrong)
|
||||
# The output is dumped to dem-ggt.txt
|
||||
tessgrd -r-60/-45/-30/-15 -b50/50 -z250e03 | \
|
||||
tessgxx dem-tess.txt -lgxx.log | \
|
||||
tessgxy dem-tess.txt -lgxy.log | \
|
||||
tessgxz dem-tess.txt -lgxz.log | \
|
||||
tessgyy dem-tess.txt -lgyy.log | \
|
||||
tessgyz dem-tess.txt -lgyz.log | \
|
||||
tessgzz dem-tess.txt -lgzz.log -v > dem-ggt.txt
|
13
cookbook/dem_brasil/dem_density.py
Executable file
@@ -0,0 +1,13 @@
|
||||
"""
|
||||
Assign density values for the DEM points.
|
||||
"""
|
||||
import sys
|
||||
import numpy
|
||||
|
||||
lons, lats, heights = numpy.loadtxt(sys.argv[1], unpack=True)
|
||||
|
||||
for i in xrange(len(heights)):
|
||||
if heights[i] >=0:
|
||||
print "%lf %lf %lf %lf" % (lons[i], lats[i], heights[i], 2670.0)
|
||||
else:
|
||||
print "%lf %lf %lf %lf" % (lons[i], lats[i], heights[i], 1670.0)
|
117
cookbook/dem_brasil/plot.py
Executable file
@@ -0,0 +1,117 @@
|
||||
# Make some nice plots of the DEM, the densities used and the calculated GGT
|
||||
import numpy
|
||||
from matplotlib import pyplot as plt
|
||||
from mpl_toolkits.basemap import Basemap
|
||||
|
||||
# Plot the DEM and density maps
|
||||
################################################################################
|
||||
lons, lats, heights, dens = numpy.loadtxt('dem-dens.txt', unpack=True)
|
||||
nlons = 151 # Number of points in the longitude direction
|
||||
nlats = len(lats)/nlons
|
||||
|
||||
# Convert the lists to 2D grids
|
||||
glons = numpy.reshape(lons, (nlats, nlons))
|
||||
glats = numpy.reshape(lats, (nlats, nlons))
|
||||
gheights = numpy.reshape(heights, (nlats, nlons))
|
||||
gdens = numpy.reshape(dens, (nlats, nlons))
|
||||
|
||||
# Set up a Mercator projection
|
||||
bm = Basemap(projection='merc',
|
||||
llcrnrlon=lons[0], llcrnrlat=lats[-1],
|
||||
urcrnrlon=lons[-1], urcrnrlat=lats[0],
|
||||
lon_0=lons[nlons//2], lat_0=lats[len(lats)//2],
|
||||
resolution='l',
|
||||
area_thresh=10000)
|
||||
glons, glats = bm(glons, glats)
|
||||
|
||||
# Plot the DEM first
|
||||
print "Plotting DEM"
|
||||
plt.figure()
|
||||
bm.drawmeridians(numpy.arange(lons[0]+5., lons[-1], 5.),
|
||||
labels=[0,0,0,1], fontsize=12, linewidth=0.5)
|
||||
bm.drawparallels(numpy.arange(lats[-1]+5., lats[0], 5.),
|
||||
labels=[1,0,0,0], fontsize=12, linewidth=0.5)
|
||||
bm.drawcoastlines(linewidth=1)
|
||||
bm.drawmapboundary()
|
||||
bm.drawcountries(linewidth=0.8)
|
||||
# Do the pseudocolor plot
|
||||
cf = bm.pcolor(glons, glats, gheights, cmap=plt.cm.gist_earth, \
|
||||
vmin=-1000, vmax=1000)
|
||||
cb = plt.colorbar()
|
||||
cb.set_label("Height [m]")
|
||||
# Plot the calculation area used later
|
||||
w = -60
|
||||
e = -45
|
||||
s = -30
|
||||
n = -15
|
||||
areax, areay = bm([w, w, e, e, w], \
|
||||
[n, s, s, n, n])
|
||||
bm.plot(areax, areay, '-r', label="Computation grid", linewidth=1.8)
|
||||
plt.legend(shadow=True, loc='lower right', prop={'size':10})
|
||||
# Save a png figure
|
||||
plt.savefig('dem.png')
|
||||
|
||||
# Now plot the densities
|
||||
print "Plotting density model"
|
||||
plt.figure()
|
||||
bm.drawmeridians(numpy.arange(lons[0]+5., lons[-1], 5.),
|
||||
labels=[0,0,0,1], fontsize=12, linewidth=0.5)
|
||||
bm.drawparallels(numpy.arange(lats[-1]+5., lats[0], 5.),
|
||||
labels=[1,0,0,0], fontsize=12, linewidth=0.5)
|
||||
bm.drawcoastlines(linewidth=1)
|
||||
bm.drawmapboundary()
|
||||
bm.drawcountries(linewidth=0.8)
|
||||
# Do the pseudocolor plot
|
||||
cf = bm.pcolor(glons, glats, gdens, cmap=plt.cm.jet)
|
||||
cb = plt.colorbar()
|
||||
cb.set_label(r"Density [$g.cm^{-3}$]")
|
||||
# Save a png figure
|
||||
plt.savefig('dem-dens.png')
|
||||
|
||||
# Plot the GGT
|
||||
################################################################################
|
||||
print "Plotting GGT"
|
||||
data = numpy.loadtxt('dem-ggt.txt')
|
||||
lons, lats, heights, gxx, gxy, gxz, gyy, gyz, gzz = data.T
|
||||
nlons = 50 # Number of points in the longitude direction
|
||||
nlats = len(lats)/nlons
|
||||
|
||||
# Convert the lists to 2D grids
|
||||
glons = numpy.reshape(lons, (nlats, nlons))
|
||||
glats = numpy.reshape(lats, (nlats, nlons))
|
||||
|
||||
# Set up a Mercator projection
|
||||
bm = Basemap(projection='merc', \
|
||||
llcrnrlon=lons[0], llcrnrlat=lats[0], \
|
||||
urcrnrlon=lons[-1], urcrnrlat=lats[-1], \
|
||||
lon_0=lons[nlons//2], lat_0=lats[len(lats)//2],
|
||||
resolution='l', area_thresh=10000)
|
||||
glons, glats = bm(glons, glats)
|
||||
|
||||
# Plot each component
|
||||
fig = plt.figure(figsize=(14,9))
|
||||
plt.subplots_adjust(wspace=0.35)
|
||||
titles = [r"$g_{xx}$", r"$g_{xy}$", r"$g_{xz}$", r"$g_{yy}$", r"$g_{yz}$",
|
||||
r"$g_{zz}$"]
|
||||
fields = [gxx, gxy, gxz, gyy, gyz, gzz]
|
||||
for i, args in enumerate(zip(fields, titles)):
|
||||
field, title = args
|
||||
ax = plt.subplot(2, 3, i + 1, aspect='equal')
|
||||
plt.title(title, fontsize=18)
|
||||
# Make it a 2D grid
|
||||
gfield = numpy.reshape(field, (nlats, nlons))
|
||||
# Plot the coastlines and etc
|
||||
mer = bm.drawmeridians(numpy.arange(lons[0]+3, lons[-1]-3, 3),
|
||||
labels=[0,0,0,1], fontsize=9, linewidth=0.5)
|
||||
bm.drawparallels(numpy.arange(lats[0]+3, lats[-1]-3, 3),
|
||||
labels=[1,0,0,0], fontsize=9, linewidth=0.5)
|
||||
bm.drawcoastlines(linewidth=1)
|
||||
bm.drawmapboundary()
|
||||
bm.drawcountries(linewidth=1)
|
||||
bm.drawstates(linewidth=0.2)
|
||||
# Make a pseudocolor plot
|
||||
cf = bm.pcolor(glons, glats, gfield, cmap=plt.cm.jet)
|
||||
cb = plt.colorbar(orientation='vertical', format='%.2f', shrink=0.8)
|
||||
cb.set_label(r"$E\"otv\"os$")
|
||||
# Save a png figure
|
||||
plt.savefig('dem-ggt.png')
|
BIN
cookbook/dem_brasil/sample-dem-dens.png
Executable file
After Width: | Height: | Size: 150 KiB |
22801
cookbook/dem_brasil/sample-dem-dens.txt
Executable file
BIN
cookbook/dem_brasil/sample-dem-ggt.png
Executable file
After Width: | Height: | Size: 372 KiB |
22806
cookbook/dem_brasil/sample-dem-tess.txt
Executable file
BIN
cookbook/dem_brasil/sample-dem.png
Executable file
After Width: | Height: | Size: 260 KiB |
3
cookbook/simple_prism/model.txt
Executable file
@@ -0,0 +1,3 @@
|
||||
# Test prism model file
|
||||
2000 5000 2000 15000 0 5000 1000
|
||||
10000 18000 10000 18000 0 5000 -1000
|
25
cookbook/simple_prism/plot.py
Executable file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
Plot the columns of the output files
|
||||
"""
|
||||
import sys
|
||||
import pylab
|
||||
|
||||
data = pylab.loadtxt(sys.argv[1], unpack=True)
|
||||
shape = (int(sys.argv[2]), int(sys.argv[3]))
|
||||
lon = pylab.reshape(data[0], shape)
|
||||
lat = pylab.reshape(data[1], shape)
|
||||
xmin, xmax = lon.min(), lon.max()
|
||||
ymin, ymax = lat.min(), lat.max()
|
||||
for i, value in enumerate(data[3:]):
|
||||
value = pylab.reshape(value, shape)
|
||||
pylab.figure(figsize=(4, 3))
|
||||
pylab.title("Column %d" % (i + 4))
|
||||
pylab.axis('scaled')
|
||||
pylab.pcolor(lon, lat, value)
|
||||
pylab.colorbar()
|
||||
pylab.contour(lon, lat, value, 12, color='k')
|
||||
#pylab.xlabel("Longitude")
|
||||
#pylab.ylabel("Latitude")
|
||||
pylab.xlim(xmin, xmax)
|
||||
pylab.ylim(ymin, ymax)
|
||||
pylab.savefig('column%d.png' % (i + 4))
|
11
cookbook/simple_prism/simple_prism.bat
Executable file
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
:: Generate a regular grid, pipe it to all the computation programs,
|
||||
:: and write the result to output.txt
|
||||
|
||||
tessgrd -r0/20000/0/20000 -b50/50 -z1000 | ^
|
||||
prismpot model.txt | ^
|
||||
prismgx model.txt | prismgy model.txt | prismgz model.txt | ^
|
||||
prismgxx model.txt | prismgxy model.txt | ^
|
||||
prismgxz model.txt | prismgyy model.txt | ^
|
||||
prismgyz model.txt | prismgzz model.txt > output.txt
|
BIN
cookbook/simple_prism/simple_prism.png
Executable file
After Width: | Height: | Size: 585 KiB |
11
cookbook/simple_prism/simple_prism.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Generate a regular grid, pipe it to all the computation programs,
|
||||
# and write the result to output.txt
|
||||
|
||||
tessgrd -r0/20000/0/20000 -b50/50 -z1000 | \
|
||||
prismpot model.txt | \
|
||||
prismgx model.txt | prismgy model.txt | prismgz model.txt | \
|
||||
prismgxx model.txt | prismgxy model.txt | \
|
||||
prismgxz model.txt | prismgyy model.txt | \
|
||||
prismgyz model.txt | prismgzz model.txt > output.txt
|
3
cookbook/simple_tess/model.txt
Executable file
@@ -0,0 +1,3 @@
|
||||
# Test tesseroid model file
|
||||
10 20 10 20 0 -50000 200
|
||||
-20 -10 -20 -10 0 -30000 -500
|
29
cookbook/simple_tess/plot.py
Executable file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Plot the columns of the output files
|
||||
"""
|
||||
import sys
|
||||
from matplotlib import pyplot as plt
|
||||
from mpl_toolkits.basemap import Basemap
|
||||
import numpy as np
|
||||
|
||||
# Set up a projection
|
||||
bm = Basemap(projection='ortho', lon_0=0, lat_0=0,
|
||||
resolution='l', area_thresh=10000)
|
||||
|
||||
# Load the data and make them into matrices
|
||||
data = np.loadtxt(sys.argv[1], unpack=True)
|
||||
shape = (int(sys.argv[2]), int(sys.argv[3]))
|
||||
lon = data[0].reshape(shape)
|
||||
lat = data[1].reshape(shape)
|
||||
glon, glat = bm(lon, lat)
|
||||
|
||||
plt.figure(figsize=(14, 12))
|
||||
for i, value in enumerate(data[3:]):
|
||||
plt.subplot(3, 4, i + 1)
|
||||
plt.title("Column %d" % (i + 4))
|
||||
bm.drawcoastlines()
|
||||
bm.drawmapboundary()
|
||||
bm.contourf(glon, glat, value.reshape(shape), 15, cmap=plt.cm.RdBu_r)
|
||||
plt.colorbar(orientation="horizontal", pad=0, aspect=30)
|
||||
plt.tight_layout()
|
||||
plt.savefig('output.png')
|
12
cookbook/simple_tess/simple_tess.bat
Executable file
@@ -0,0 +1,12 @@
|
||||
:: Generate a regular grid, pipe it to all the computation programs,
|
||||
:: and write the result to output.txt
|
||||
|
||||
tessgrd -r-45/45/-45/45 -b101/101 -z260e03 | ^
|
||||
tesspot model.txt | ^
|
||||
tessgx model.txt | tessgy model.txt | tessgz model.txt | ^
|
||||
tessgxx model.txt | tessgxy model.txt | ^
|
||||
tessgxz model.txt | tessgyy model.txt | ^
|
||||
tessgyz model.txt | tessgzz model.txt -v -llog.txt > output.txt
|
||||
|
||||
:: Make a plot with the columns of output.txt
|
||||
python plot.py output.txt 101 101
|
BIN
cookbook/simple_tess/simple_tess.png
Executable file
After Width: | Height: | Size: 389 KiB |
14
cookbook/simple_tess/simple_tess.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Generate a regular grid, pipe it to all the computation programs,
|
||||
# and write the result to output.txt
|
||||
|
||||
tessgrd -r-45/45/-45/45 -b101/101 -z260e03 | \
|
||||
tesspot model.txt | \
|
||||
tessgx model.txt | tessgy model.txt | tessgz model.txt | \
|
||||
tessgxx model.txt | tessgxy model.txt | \
|
||||
tessgxz model.txt | tessgyy model.txt | \
|
||||
tessgyz model.txt | tessgzz model.txt -v -llog.txt > output.txt
|
||||
|
||||
# Make a plot with the columns of output.txt
|
||||
python plot.py output.txt 101 101
|
32
cookbook/tess2prism/plot.py
Executable file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
Plot the columns of the output files
|
||||
"""
|
||||
import sys
|
||||
import pylab
|
||||
from mpl_toolkits.basemap import Basemap
|
||||
|
||||
# Set up a projection
|
||||
bm = Basemap(projection='ortho', lon_0=-80, lat_0=-40,
|
||||
resolution='l', area_thresh=10000)
|
||||
|
||||
data = pylab.loadtxt(sys.argv[1], unpack=True)
|
||||
shape = (int(sys.argv[2]), int(sys.argv[3]))
|
||||
lon = pylab.reshape(data[0], shape)
|
||||
lat = pylab.reshape(data[1], shape)
|
||||
glon, glat = bm(lon, lat)
|
||||
|
||||
for i, value in enumerate(data[3:]):
|
||||
value = pylab.reshape(value, shape)
|
||||
pylab.figure(figsize=(4, 3))
|
||||
pylab.title("Column %d" % (i + 4))
|
||||
bm.drawcoastlines()
|
||||
#bm.fillcontinents(color='coral',lake_color='aqua')
|
||||
#bm.drawmapboundary(fill_color='aqua')
|
||||
bm.drawmapboundary()
|
||||
bm.drawparallels(pylab.arange(-90.,120.,30.))
|
||||
bm.drawmeridians(pylab.arange(0.,420.,60.))
|
||||
#bm.bluemarble()
|
||||
bm.pcolor(glon, glat, value)
|
||||
pylab.colorbar()
|
||||
#bm.contour(glon, glat, value, 12, linewidth=3)
|
||||
pylab.savefig('column%d.png' % (i + 4))
|
134
cookbook/tess2prism/result.svg
Executable file
@@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="1088.5714"
|
||||
height="1122.8572"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.2 r9819"
|
||||
sodipodi:docname="result.svg"
|
||||
inkscape:export-filename="/home/leo/src/tesseroids/dev/cookbook/tess2prism/tess2prism.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.35"
|
||||
inkscape:cx="182.14285"
|
||||
inkscape:cy="492.85716"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1680"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(165.71428,783.35211)">
|
||||
<image
|
||||
y="-509.06641"
|
||||
x="522.85712"
|
||||
id="image3026"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column7.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="-234.78065"
|
||||
x="522.85712"
|
||||
id="image3059"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column10.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="39.505058"
|
||||
x="522.85712"
|
||||
id="image3092"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column13.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="-783.35211"
|
||||
x="179.99997"
|
||||
id="image2993"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column4.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="-509.06641"
|
||||
x="179.99997"
|
||||
id="image3015"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column6.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="-234.78065"
|
||||
x="179.99997"
|
||||
id="image3048"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column9.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="39.505058"
|
||||
x="179.99997"
|
||||
id="image3081"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column12.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="-509.06641"
|
||||
x="-165.71428"
|
||||
id="image3004"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column5.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="-234.78065"
|
||||
x="-165.71428"
|
||||
id="image3037"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column8.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
<image
|
||||
y="39.505058"
|
||||
x="-165.71428"
|
||||
id="image3070"
|
||||
xlink:href="file:///home/leo/src/tesseroids/dev/cookbook/tess2prism/column11.png"
|
||||
height="300"
|
||||
width="400" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.9 KiB |
11
cookbook/tess2prism/sample-prism-model.txt
Executable file
@@ -0,0 +1,11 @@
|
||||
# Prisms converted from tesseroid model with tess2prism 1.1dev
|
||||
# local time: Wed May 16 14:34:47 2012
|
||||
# tesseroids file: stdin
|
||||
# conversion type: equal mass|spherical coordinates
|
||||
# format: dx dy dz density lon lat r
|
||||
# Test tesseroid model file
|
||||
221766.31696055 169882.854778591 50000 499.977196258595 -76 -40 6378137
|
||||
221766.31696055 169882.854778591 50000 499.977196258595 -78 -40 6378137
|
||||
221766.31696055 169882.854778591 50000 499.977196258595 -80 -40 6378137
|
||||
221766.31696055 169882.854778591 50000 499.977196258595 -82 -40 6378137
|
||||
221766.31696055 169882.854778591 50000 499.977196258595 -84 -40 6378137
|
6
cookbook/tess2prism/tess-model.txt
Executable file
@@ -0,0 +1,6 @@
|
||||
# Test tesseroid model file
|
||||
-77 -75 -41 -39 0 -50000 500
|
||||
-79 -77 -41 -39 0 -50000 500
|
||||
-81 -79 -41 -39 0 -50000 500
|
||||
-83 -81 -41 -39 0 -50000 500
|
||||
-85 -83 -41 -39 0 -50000 500
|
21
cookbook/tess2prism/tess2prism.bat
Executable file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
:: Generate a prism model from a tesseroid model.
|
||||
:: Prisms will have the same mass as the tesseroids and
|
||||
:: associated spherical coordinates of the center of
|
||||
:: the top of the tesseroid.
|
||||
|
||||
tess2prism.exe < tess-model.txt > prism-model.txt
|
||||
|
||||
:: Generate a regular grid in spherical coordinates,
|
||||
:: pipe the grid to the computation programs,
|
||||
:: and dump the result on output.txt
|
||||
:: prismpots calculates the potential in spherical
|
||||
:: coordinates, prismgs calculates the full
|
||||
:: gravity vector, and prismggts calculates the full
|
||||
:: gravity gradient tensor.
|
||||
|
||||
tessgrd -r-160/0/-80/0 -b100/100 -z250e03 | ^
|
||||
prismpots prism-model.txt | ^
|
||||
prismgs prism-model.txt | ^
|
||||
prismggts prism-model.txt -v > output.txt
|
BIN
cookbook/tess2prism/tess2prism.png
Executable file
After Width: | Height: | Size: 888 KiB |
21
cookbook/tess2prism/tess2prism.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Generate a prism model from a tesseroid model.
|
||||
# Prisms will have the same mass as the tesseroids and
|
||||
# associated spherical coordinates of the center of
|
||||
# the top of the tesseroid.
|
||||
|
||||
tess2prism < tess-model.txt > prism-model.txt
|
||||
|
||||
# Generate a regular grid in spherical coordinates,
|
||||
# pipe the grid to the computation programs,
|
||||
# and dump the result on output.txt
|
||||
# prismpots calculates the potential in spherical
|
||||
# coordinates, prismgs calculates the full
|
||||
# gravity vector, and prismggts calculates the full
|
||||
# gravity gradient tensor.
|
||||
|
||||
tessgrd -r-160/0/-80/0 -b100/100 -z250e03 | \
|
||||
prismpots prism-model.txt | \
|
||||
prismgs prism-model.txt | \
|
||||
prismggts prism-model.txt -v > output.txt
|
25
cookbook/tess2prism_flatten/plot.py
Executable file
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
Plot the columns of the output files
|
||||
"""
|
||||
import sys
|
||||
import pylab
|
||||
|
||||
data = pylab.loadtxt(sys.argv[1], unpack=True)
|
||||
shape = (int(sys.argv[2]), int(sys.argv[3]))
|
||||
lon = pylab.reshape(data[0], shape)*0.001
|
||||
lat = pylab.reshape(data[1], shape)*0.001
|
||||
xmin, xmax = lon.min(), lon.max()
|
||||
ymin, ymax = lat.min(), lat.max()
|
||||
for i, value in enumerate(data[3:]):
|
||||
value = pylab.reshape(value, shape)
|
||||
pylab.figure(figsize=(4, 3))
|
||||
pylab.title("Column %d" % (i + 4))
|
||||
pylab.axis('scaled')
|
||||
pylab.pcolor(lon, lat, value)
|
||||
pylab.colorbar()
|
||||
pylab.contour(lon, lat, value, 12, color='k')
|
||||
#pylab.xlabel("Longitude")
|
||||
#pylab.ylabel("Latitude")
|
||||
pylab.xlim(xmin, xmax)
|
||||
pylab.ylim(ymin, ymax)
|
||||
pylab.savefig('column%d.png' % (i + 4))
|
9
cookbook/tess2prism_flatten/sample-prism-model.txt
Executable file
@@ -0,0 +1,9 @@
|
||||
# Prisms converted from tesseroid model with tess2prism 1.1dev
|
||||
# local time: Tue May 8 14:55:02 2012
|
||||
# tesseroids file: stdin
|
||||
# conversion type: flatten
|
||||
# format: x1 x2 y1 y2 z1 z2 density
|
||||
# Test tesseroid model file
|
||||
1111100 1666650 1111100 1666650 0 30000 487.534658568521
|
||||
-1111100 1111100 -1666650 -1111100 0 50000 198.175508383774
|
||||
-1777760 -1111100 -1666650 555550 0 30000 -291.9029748328
|
4
cookbook/tess2prism_flatten/tess-model.txt
Executable file
@@ -0,0 +1,4 @@
|
||||
# Test tesseroid model file
|
||||
10 15 10 15 0 -30000 500
|
||||
-15 -10 -10 10 0 -50000 200
|
||||
-15 5 -16 -10 0 -30000 -300
|
21
cookbook/tess2prism_flatten/tess2prism_flatten.bat
Executable file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
:: Generate a prism model from a tesseroid model by
|
||||
:: flattening the tesseroids (1 degree = 111.11 km).
|
||||
:: This way the converted prisms can be used
|
||||
:: with the prism* programs in Cartesian coordinates.
|
||||
|
||||
tess2prism --flatten < tess-model.txt > prism-model.txt
|
||||
|
||||
:: Generate a regular grid in Cartesian coordinates,
|
||||
:: pipe the grid to the computation programs,
|
||||
:: and dump the result on output.txt
|
||||
|
||||
tessgrd -r-3e06/3e06/-3e06/3e06 -b50/50 -z250e03 | ^
|
||||
prismpot prism-model.txt | ^
|
||||
prismgx prism-model.txt | ^
|
||||
prismgy prism-model.txt | ^
|
||||
prismgz prism-model.txt | ^
|
||||
prismgxx prism-model.txt | prismgxy prism-model.txt | ^
|
||||
prismgxz prism-model.txt | prismgyy prism-model.txt | ^
|
||||
prismgyz prism-model.txt | prismgzz prism-model.txt > output.txt
|
BIN
cookbook/tess2prism_flatten/tess2prism_flatten.png
Executable file
After Width: | Height: | Size: 575 KiB |
21
cookbook/tess2prism_flatten/tess2prism_flatten.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Generate a prism model from a tesseroid model by
|
||||
# flattening the tesseroids (1 degree = 111.11 km).
|
||||
# This way the converted prisms can be used
|
||||
# with the prism* programs in Cartesian coordinates.
|
||||
|
||||
tess2prism --flatten < tess-model.txt > prism-model.txt
|
||||
|
||||
# Generate a regular grid in Cartesian coordinates,
|
||||
# pipe the grid to the computation programs,
|
||||
# and dump the result on output.txt
|
||||
|
||||
tessgrd -r-3e06/3e06/-3e06/3e06 -b50/50 -z250e03 | \
|
||||
prismpot prism-model.txt | \
|
||||
prismgx prism-model.txt | \
|
||||
prismgy prism-model.txt | \
|
||||
prismgz prism-model.txt | \
|
||||
prismgxx prism-model.txt | prismgxy prism-model.txt | \
|
||||
prismgxz prism-model.txt | prismgyy prism-model.txt | \
|
||||
prismgyz prism-model.txt | prismgzz prism-model.txt > output.txt
|
BIN
cookbook/tesslayers/layers.png
Executable file
After Width: | Height: | Size: 45 KiB |
1683
cookbook/tesslayers/layers.txt
Executable file
34
cookbook/tesslayers/makelayers.py
Executable file
@@ -0,0 +1,34 @@
|
||||
import numpy as np
|
||||
import fatiando as ft
|
||||
|
||||
shape = (41, 41)
|
||||
x, y = ft.grd.regular((-10, 10, 30, 50), shape)
|
||||
height = 800 - 1000*ft.utils.gaussian2d(x, y, 3, 1, x0=0, y0=37)
|
||||
rel = -7000*ft.utils.gaussian2d(x, y, 3, 5, x0=0, y0=40)
|
||||
thick = height - rel
|
||||
dens = 1900*np.ones_like(thick)
|
||||
data = np.transpose([x, y, height, thick, dens])
|
||||
with open('layers.txt', 'w') as f:
|
||||
f.write("# Synthetic layer model of sediments and topography\n")
|
||||
f.write("# Columns are:\n")
|
||||
f.write("# lon lat height thickness density\n")
|
||||
np.savetxt(f, data, fmt='%g')
|
||||
ft.vis.figure(figsize=(4, 3))
|
||||
ft.vis.title('Depth of sediments [m]')
|
||||
ft.vis.axis('scaled')
|
||||
ft.vis.pcolor(x, y, rel, shape)
|
||||
ft.vis.colorbar()
|
||||
ft.vis.savefig('depth.png')
|
||||
ft.vis.figure(figsize=(4, 3))
|
||||
ft.vis.title('Topography [m]')
|
||||
ft.vis.axis('scaled')
|
||||
ft.vis.pcolor(x, y, height, shape)
|
||||
ft.vis.colorbar()
|
||||
ft.vis.savefig('topography.png')
|
||||
ft.vis.figure(figsize=(4, 3))
|
||||
ft.vis.title('Thickness of sediment layer [m]')
|
||||
ft.vis.axis('scaled')
|
||||
ft.vis.pcolor(x, y, thick, shape)
|
||||
ft.vis.colorbar()
|
||||
ft.vis.savefig('thickness.png')
|
||||
ft.vis.show()
|
20
cookbook/tesslayers/plot.py
Executable file
@@ -0,0 +1,20 @@
|
||||
"""
|
||||
Plot the columns of the output files
|
||||
"""
|
||||
import sys
|
||||
import pylab
|
||||
|
||||
data = pylab.loadtxt(sys.argv[1], unpack=True)
|
||||
shape = (int(sys.argv[2]), int(sys.argv[3]))
|
||||
lon = pylab.reshape(data[0], shape)
|
||||
lat = pylab.reshape(data[1], shape)
|
||||
for i, value in enumerate(data[3:]):
|
||||
value = pylab.reshape(value, shape)
|
||||
pylab.figure(figsize=(4, 3))
|
||||
pylab.axis('scaled')
|
||||
pylab.title("Column %d" % (i + 4))
|
||||
pylab.pcolor(lon, lat, value)
|
||||
pylab.colorbar()
|
||||
pylab.xlim(lon.min(), lon.max())
|
||||
pylab.ylim(lat.min(), lat.max())
|
||||
pylab.savefig('column%d.png' % (i + 4))
|
1684
cookbook/tesslayers/sample-tessmodel.txt
Executable file
13
cookbook/tesslayers/tesslayers.bat
Executable file
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
:: Convert the layer grids in layers.txt to tesseroids.
|
||||
:: The grid spacing passed to -s is used as the size of the tesseroids,
|
||||
:: so be careful!
|
||||
tesslayers.exe -s0.5/0.5 -v < layers.txt > tessmodel.txt
|
||||
|
||||
:: Now calculate the gz and tensor effect of this model at 100km height
|
||||
tessgrd -r-8/8/32/48 -b50/50 -z100000 | ^
|
||||
tessgz tessmodel.txt | ^
|
||||
tessgxx tessmodel.txt | tessgxy tessmodel.txt | ^
|
||||
tessgxz tessmodel.txt | tessgyy tessmodel.txt | ^
|
||||
tessgyz tessmodel.txt | tessgzz tessmodel.txt -v > output.txt
|
BIN
cookbook/tesslayers/tesslayers.png
Executable file
After Width: | Height: | Size: 154 KiB |
13
cookbook/tesslayers/tesslayers.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Convert the layer grids in layers.txt to tesseroids.
|
||||
# The grid spacing passed to -s is used as the size of the tesseroids,
|
||||
# so be careful!
|
||||
tesslayers -s0.5/0.5 -v < layers.txt > tessmodel.txt
|
||||
|
||||
# Now calculate the gz and tensor effect of this model at 100km height
|
||||
tessgrd -r-8/8/32/48 -b50/50 -z100000 | \
|
||||
tessgz tessmodel.txt | \
|
||||
tessgxx tessmodel.txt | tessgxy tessmodel.txt | \
|
||||
tessgxz tessmodel.txt | tessgyy tessmodel.txt | \
|
||||
tessgyz tessmodel.txt | tessgzz tessmodel.txt -v > output.txt
|