initial upload
This commit is contained in:
32
cookbook/tess2prism/plot.py
Executable file
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
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
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
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
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
BIN
cookbook/tess2prism/tess2prism.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 888 KiB |
21
cookbook/tess2prism/tess2prism.sh
Executable file
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
|
Reference in New Issue
Block a user