<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6995266693478416926</id><updated>2012-02-18T08:31:22.484-05:00</updated><title type='text'>JParkCodes</title><subtitle type='html'>JParkCodes is an expedient for me to disseminate information about computer codes used by the Yale University Seismology Group. It will take me some time to post useful code for folks in Yale and colleagues worldwide. Send email with queries, and add comments to posted programs and shell-scripts to flag bugs and suggest improvements.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>69</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6471746661096844739</id><published>2011-06-14T09:58:00.001-04:00</published><updated>2011-06-14T10:01:32.143-04:00</updated><title type='text'>GMT script to generate Figure 4 of Park and Royer (2011)</title><content type='html'>&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #008423"&gt;#!/bin/csh&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;gmtset ANNOT_FONT_SIZE &lt;span style="color: #2f2fd1"&gt;12&lt;/span&gt;p LABEL_FONT_SIZE &lt;span style="color: #2f2fd1"&gt;15&lt;/span&gt;p HEADER_FONT_SIZE &lt;span style="color: #2f2fd1"&gt;15&lt;/span&gt;p&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;gmtset ANNOT_FONT Times-Roman LABEL_FONT Times-Roman HEADER_FONT Times-Roman&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;awk &lt;span style="color: #d42722"&gt;'{print $1, $2, $3/1000}'&lt;/span&gt; out_ppdf_control.dat &amp;gt;! blob.dat&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;surface blob.dat -R0&lt;span style="color: #2f2fd1"&gt;.2&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;10.6&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.025&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.135&lt;/span&gt; -I0&lt;span style="color: #2f2fd1"&gt;.4&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.01&lt;/span&gt; -Gblobg -T0&lt;span style="color: #2f2fd1"&gt;.25&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;grdimage blobg -JX3/&lt;span style="color: #2f2fd1"&gt;2&lt;/span&gt; -Cppdf.cpt -R -Ba2f1:&lt;span style="color: #d42722"&gt;'CO@-2@- Sensitivity (degC)'&lt;/span&gt;:/&lt;span style="color: #2f2fd1"&gt;0.02&lt;/span&gt;:&lt;span style="color: #d42722"&gt;'ACT'&lt;/span&gt;::&lt;span style="color: #d42722"&gt;'.Fraction of ModelRuns within 3-@~s@~'&lt;/span&gt;:/SWen -X1&lt;span style="color: #2f2fd1"&gt;.0&lt;/span&gt; -Y1&lt;span style="color: #2f2fd1"&gt;.0&lt;/span&gt; -K &amp;gt;! aaplot&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;awk &lt;span style="color: #d42722"&gt;'{print $1, $5, $6/1000}'&lt;/span&gt; out_ppdf_control.dat &amp;gt;! blob.dat&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;surface blob.dat -R0&lt;span style="color: #2f2fd1"&gt;.2&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;10.6&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.15&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.85&lt;/span&gt; -I0&lt;span style="color: #2f2fd1"&gt;.4&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.05&lt;/span&gt; -Gblobg -T0&lt;span style="color: #2f2fd1"&gt;.25&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;grdimage blobg -JX3/&lt;span style="color: #2f2fd1"&gt;2&lt;/span&gt; -Cppdf.cpt -R -Ba2f1:&lt;span style="color: #d42722"&gt;'CO@-2@- Sensitivity (degC)'&lt;/span&gt;:/&lt;span style="color: #2f2fd1"&gt;0.1&lt;/span&gt;:&lt;span style="color: #d42722"&gt;'FERT'&lt;/span&gt;::&lt;span style="color: #d42722"&gt;'.Fraction of ModelRuns within 3-@~s@~'&lt;/span&gt;:/SWen -X0&lt;span style="color: #2f2fd1"&gt;.0&lt;/span&gt; -Y3&lt;span style="color: #2f2fd1"&gt;.5&lt;/span&gt; -K -O &amp;gt;&amp;gt; aaplot&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;awk &lt;span style="color: #d42722"&gt;'{print $1, $8, $9/1000}'&lt;/span&gt; out_ppdf_control.dat &amp;gt;! blob.dat&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;surface blob.dat -R0&lt;span style="color: #2f2fd1"&gt;.2&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;10.6&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.05&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.55&lt;/span&gt; -I0&lt;span style="color: #2f2fd1"&gt;.4&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.025&lt;/span&gt; -Gblobg -T0&lt;span style="color: #2f2fd1"&gt;.25&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;grdimage blobg -JX3/&lt;span style="color: #2f2fd1"&gt;2&lt;/span&gt; -Cppdf.cpt -R -Ba2f1:&lt;span style="color: #d42722"&gt;'CO@-2@- Sensitivity (degC)'&lt;/span&gt;:/&lt;span style="color: #2f2fd1"&gt;0.1&lt;/span&gt;:&lt;span style="color: #d42722"&gt;'LIFE'&lt;/span&gt;::&lt;span style="color: #d42722"&gt;'.Fraction of ModelRuns within 3-@~s@~'&lt;/span&gt;:/SWen -X4&lt;span style="color: #2f2fd1"&gt;.0&lt;/span&gt; -Y0&lt;span style="color: #2f2fd1"&gt;.0&lt;/span&gt; -K -O &amp;gt;&amp;gt; aaplot&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;awk &lt;span style="color: #d42722"&gt;'{print $1, $11, $12/1000}'&lt;/span&gt; out_ppdf_control.dat &amp;gt;! blob.dat&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;surface blob.dat -R0&lt;span style="color: #2f2fd1"&gt;.2&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;10.6&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.45&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;1.25&lt;/span&gt; -I0&lt;span style="color: #2f2fd1"&gt;.4&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.05&lt;/span&gt; -Gblobg -T0&lt;span style="color: #2f2fd1"&gt;.25&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;grdimage blobg -JX3/&lt;span style="color: #2f2fd1"&gt;2&lt;/span&gt; -Cppdf.cpt -R -Ba2f1:&lt;span style="color: #d42722"&gt;'CO@-2@- Sensitivity (degC)'&lt;/span&gt;:/&lt;span style="color: #2f2fd1"&gt;0.2&lt;/span&gt;:&lt;span style="color: #d42722"&gt;'GYM'&lt;/span&gt;::&lt;span style="color: #d42722"&gt;'.Fraction of ModelRuns within 3-@~s@~'&lt;/span&gt;:/SWen -X0&lt;span style="color: #2f2fd1"&gt;.0&lt;/span&gt; -Y-&lt;span style="color: #2f2fd1"&gt;3.5&lt;/span&gt; -K -O &amp;gt;&amp;gt; aaplot&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;psscale -D3&lt;span style="color: #2f2fd1"&gt;.5&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;1&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;2&lt;/span&gt;/&lt;span style="color: #2f2fd1"&gt;0.25&lt;/span&gt;c -Cppdf.cpt -Ba0&lt;span style="color: #2f2fd1"&gt;.2f0.1&lt;/span&gt;:&lt;span style="color: #d42722"&gt;'.Fraction &amp;lt;3-@~s@~'&lt;/span&gt;: -O &amp;gt;&amp;gt; aaplot&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"&gt;gv aaplot &amp;amp;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6471746661096844739?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.ajsonline.org/cgi/content/abstract/311/1/1' title='GMT script to generate Figure 4 of Park and Royer (2011)'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6471746661096844739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6471746661096844739&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6471746661096844739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6471746661096844739'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2011/06/gmt-script-to-generate-figure-4-of-park.html' title='GMT script to generate Figure 4 of Park and Royer (2011)'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-1222746783754636472</id><published>2011-06-14T09:35:00.003-04:00</published><updated>2011-06-14T09:56:43.829-04:00</updated><title type='text'>CO2 proxy data set for Park and Royer (2011)</title><content type='html'>&lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;&lt;div&gt;http://earth.geology.yale.edu/~jjpark/Code/co2proxy_2010.dat&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;carbon dioxide proxy data set used by &lt;/div&gt;&lt;div&gt;&lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;&lt;br /&gt;&lt;/big&gt;&lt;/span&gt;&lt;/big&gt;&lt;/div&gt;Park, J., and D. L. Royer, &lt;a href="http://www.ajsonline.org/cgi/content/abstract/311/1/1"&gt;Geologic constraints on the glacial amplification of Phanerozoic climate sensitivity&lt;/a&gt;, &lt;span style="font-weight: bold;"&gt;American J. Science&lt;/span&gt;,    &lt;/big&gt;&lt;/span&gt;&lt;/big&gt;  &lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;311&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;, 1-26, doi:10.2475/01.2011.01, 2011&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;/big&gt;&lt;/span&gt;&lt;/big&gt;&lt;div&gt;&lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;&lt;br /&gt;&lt;/big&gt;&lt;/span&gt;&lt;/big&gt;&lt;/div&gt;&lt;div&gt;&lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;The sources of data are enumerated in the reference list.  The dataset is an updated version of the data compilation reported by&lt;/big&gt;&lt;/span&gt;&lt;/big&gt;&lt;/div&gt;&lt;div&gt;&lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;&lt;br /&gt;&lt;/big&gt;&lt;/span&gt;&lt;/big&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="  white-space: pre-wrap; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;Royer DL. 2006. CO2-forced climate thresholds during the Phanerozoic. Geochimica et Cosmochimica Acta, 70: 5665-5675.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;big&gt;&lt;span style="font-family:Times New Roman,Times,serif;font-size:-1;"&gt;&lt;big&gt;&lt;pre wrap=""&gt;&lt;/pre&gt;&lt;pre wrap=""&gt;&lt;/pre&gt;&lt;/big&gt;&lt;/span&gt;&lt;/big&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-1222746783754636472?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/co2proxy_2010.dat' title='CO2 proxy data set for Park and Royer (2011)'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/1222746783754636472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=1222746783754636472&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1222746783754636472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1222746783754636472'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2011/06/co2-proxy-data-set-for-park-and-royer.html' title='CO2 proxy data set for Park and Royer (2011)'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3378174874647934868</id><published>2011-06-14T08:29:00.003-04:00</published><updated>2011-06-14T09:34:42.342-04:00</updated><title type='text'>CO2 Proxy data set from Royer et al 2007</title><content type='html'>Carbon dioxide proxy data set for the Phanerozoic used by &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:13px;"&gt;&lt;span style="font-weight: normal; "&gt;Royer, D. L., R. A. Berner, and J. Park, &lt;a href="http://www.nature.com/nature/journal/v446/n7135/abs/nature05699.html" style="color: blue; text-decoration: underline; "&gt;Climate sensitivity constrained by carbon dioxide concentrations over the last 420 million years&lt;/a&gt;, &lt;/span&gt;&lt;b&gt;Nature&lt;/b&gt;&lt;span style="font-weight: normal; "&gt;, &lt;/span&gt;&lt;b&gt;v446&lt;/b&gt;&lt;span style="font-weight: normal; "&gt;, 530-532, 2007.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:13px;"&gt;&lt;span style="font-weight: normal; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:13px;"&gt;&lt;span style="font-weight: normal; "&gt;data compilation described in &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:13px;"&gt;&lt;span style="font-weight: normal; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:13px;"&gt;&lt;span style="font-weight: normal; "&gt;&lt;pre wrap=""&gt;Royer DL. 2006. CO2-forced climate thresholds during the Phanerozoic. Geochimica et Cosmochimica Acta, 70: 5665-5675.  &lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:13px;"&gt;&lt;span style="font-weight: normal; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3378174874647934868?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/co2proxy_2007.dat' title='CO2 Proxy data set from Royer et al 2007'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3378174874647934868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3378174874647934868&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3378174874647934868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3378174874647934868'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2011/06/co2-proxy-data-set-from-royer-et-al.html' title='CO2 Proxy data set from Royer et al 2007'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-1838616984080007597</id><published>2011-06-14T07:57:00.000-04:00</published><updated>2011-06-14T07:59:09.367-04:00</updated><title type='text'>post-processing of GEOCARBSULFvolc simulation results</title><content type='html'>&lt;div&gt;c  program gcsv_ppdf.f&lt;/div&gt;&lt;div&gt;c  5/30/10 JJP&lt;/div&gt;&lt;div&gt;c  f77 -o /Users/jjpark/bin/gcsv_ppdf gcsv_ppdf.f &lt;/div&gt;&lt;div&gt;c  program to read variance reduction matrices for gcsfdata_export/search&lt;/div&gt;&lt;div&gt;c  reads relative variance residual for CO2-proxy datafit to ndat*10000 &lt;/div&gt;&lt;div&gt;c  geocarb model runs &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-1838616984080007597?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/gcsv_ppdf.f' title='post-processing of GEOCARBSULFvolc simulation results'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/1838616984080007597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=1838616984080007597&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1838616984080007597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1838616984080007597'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2011/06/post-processing-of-geocarbsulfvolc.html' title='post-processing of GEOCARBSULFvolc simulation results'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6306770819433237213</id><published>2011-06-14T07:50:00.003-04:00</published><updated>2011-06-14T07:57:09.770-04:00</updated><title type='text'>GEOCARBSULFvolc carbon-cycle simulation code</title><content type='html'>http://earth.geology.yale.edu/~jjpark/Code/gcsv10_export.f&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;c program gcsv10_export.f  &lt;/div&gt;&lt;div&gt;c fortran version of bob berner's GEOCARBSULF BASIC code &lt;/div&gt;&lt;div&gt;c gcsv10 stands for GeoCarbSulfVolc algorithm for 2010&lt;/div&gt;&lt;div&gt;c  THIS CODE CAN READ EITHER THE 2006/7 proxy-CO2 data file&lt;/div&gt;&lt;div&gt;c  OR THE 2010 DATA FILE.&lt;/div&gt;&lt;div&gt;c  8/17/2010 --  confirmed the VNV parameter as 4, though Berner asked for 5, &lt;/div&gt;&lt;div&gt;c  as motivated by Aaron Taylors thesis -- but other Taylor source is vnv=3&lt;/div&gt;&lt;div&gt;c  this code developed in MacOS 10.4, using gcc compiler, &lt;/div&gt;&lt;div&gt;c  takes 90minutes to run on a 2006-vintage Macbook Pro with 2 GHz Intel Core Duo processor&lt;/div&gt;&lt;div&gt;c  takes 45minutes to run on a 2009-vintage Macbook Pro with 2.53 GHz Intel Core 2 Duo processor&lt;/div&gt;&lt;div&gt;c  -- looped over range of input parameters, set up to fit proxy data for CO2 ppm&lt;/div&gt;&lt;div&gt;c  11/22/06 JJP&lt;/div&gt;&lt;div&gt;c  proxy data has uncertainties that are sometimes large.  To make the data-fitting robust, &lt;/div&gt;&lt;div&gt;c  compute chi-squared using an uncertainty in the log-domain.  &lt;/div&gt;&lt;div&gt;c  xf77 -o /Users/jjpark/bin/gcsv10_export gcsv10_export.f /Users/jjpark/Plotxy/plotlib.a&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c   code uses plotit, a standalone fortran/C plotting subroutine in Xwindows&lt;/div&gt;&lt;div&gt;c  this code can be found on JPark's website http://earth.geology.yale.edu/~jjpark/Code/plotit.tar&lt;/div&gt;&lt;div&gt;c  instructions for PLOTIT at http://earth.geology.yale.edu/~jjpark/Code/plotit.html&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  code updated from the code used for the paper&lt;/div&gt;&lt;div&gt;c  &lt;/div&gt;&lt;div&gt;c  Royer, D. L., Berner, R. A., and Park, J., 2007, Climate sensitivity constrained by carbon &lt;/div&gt;&lt;div&gt;c  dioxide concentrations over the last 420 million years: Nature, v.446, p.530-532.&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  and used for this paper&lt;/div&gt;&lt;div&gt;c   &lt;/div&gt;&lt;div&gt;c  Park, J., and D. L. Royer, Geologic constraints on the glacial amplification of Phanerozoic &lt;/div&gt;&lt;div&gt;c  climate sensitivity, American J. Science, V.311, 2011, P. 1-26, DOI 10.2475/01.2011.01&lt;/div&gt;&lt;div&gt;c  &lt;/div&gt;&lt;div&gt;c  there are many test computations in Park and Royer (2011) that were effected &lt;/div&gt;&lt;div&gt;c  with modified versions of this gcsv10_export.f code&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Output of this code is written to two files&lt;/div&gt;&lt;div&gt;c  outoutout.dat is a simple table of CO2proxy data values averaged in 10My intervals&lt;/div&gt;&lt;div&gt;c  out_gcsv10.dat is a large ASCII file (&amp;gt;50 Mb) that contains the GEOCARB carbon-cycle simulations&lt;/div&gt;&lt;div&gt;c  for all parameter choices.  This allows the user to examine the statistical behavior of the&lt;/div&gt;&lt;div&gt;c  carbon-cycle simulations offline this code (e.g. in gcsv_ppdf.f)&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  code converted from BASIC to run grid search over parameters&lt;/div&gt;&lt;div&gt;c  Newton-Raphson damping applied here, to avoid NaN.&lt;/div&gt;&lt;div&gt;c  divergent transition over 380-350My is interpolated better, &lt;/div&gt;&lt;div&gt;c  correcting earlier convergence error&lt;/div&gt;&lt;div&gt;c  the code reads a file proxydata.txt that contains proxy CO2 PPM data&lt;/div&gt;&lt;div&gt;c  the GEOCARBSULF carbon-cycle model is computed at time steps of 1-My from 570Ma to present&lt;/div&gt;&lt;div&gt;c  the proxy data ranges only from 420Ma to the present&lt;/div&gt;&lt;div&gt;c  &lt;/div&gt;&lt;div&gt;c  Five nested loops comprise the heart of the code, from outermost to innermost&lt;/div&gt;&lt;div&gt;c  DeltaT = temp increase with CO2 doubling&lt;/div&gt;&lt;div&gt;c  ACT = dimensionless activation-energy for silicate weathering&lt;/div&gt;&lt;div&gt;c  FERT = plant CO2-fertilization coefficient&lt;/div&gt;&lt;div&gt;c  LIFE = liverwort-based weathering factor -- less than vascular plants&lt;/div&gt;&lt;div&gt;c  GYM = gymnosperm-based weathering factor (1=angiosperm weathering parameter)&lt;/div&gt;&lt;div&gt;c  gymnosperms (e.g. conifers) might be better at weathering than angiosperms&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  for each choice of parameters, we compute the carbon flux balance between terms &lt;/div&gt;&lt;div&gt;c  that depend on silicate weathering (fBBS) and carbon burial/degassing (fB), &lt;/div&gt;&lt;div&gt;c  each normalized with common factors derived by Bob Berner many years ago&lt;/div&gt;&lt;div&gt;c  The carbon-cycle balance depends on CO2 level, &lt;/div&gt;&lt;div&gt;c  because the weathering of silicates accelerates with warmer temps induced by greenhouse gases&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  the code solves for the CO2 level that achieves the balance of carbon fluxes&lt;/div&gt;&lt;div&gt;c  The CO2-dependent parameter fB is calculated at each time step from carbon and&lt;/div&gt;&lt;div&gt;c  carbon isotope mass balance and values of all other parameters, based on&lt;/div&gt;&lt;div&gt;c  geological and biological data, that affect the carbon cycle. Then the value of&lt;/div&gt;&lt;div&gt;c  RCO2 (CO2 concentration normalized to the mean value for the past 1 million&lt;/div&gt;&lt;div&gt;c  years = 250 ppm) is calculated by inversion from a complex expression for fB based on the&lt;/div&gt;&lt;div&gt;c  greenhouse effect, CO2 fertilization of plant weathering, solar evolution, and&lt;/div&gt;&lt;div&gt;c  changes in land temperature).&lt;/div&gt;&lt;div&gt;c  &lt;/div&gt;&lt;div&gt;c  for detailed exposition of the theoretical GEOCARB models, see&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Berner, R. A., The Phanerozoic Carbon Cycle: CO2 and O2, 150pp. Oxford University Press, 2004.&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  and a collection of GEOCARB and GEOCARBSULF papers published over the past decade by&lt;/div&gt;&lt;div&gt;c  Berner and Colleagues.&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Berner, R. A., 2006a, GEOCARBSULF: A combined model for Phanerozoic atmospheric O2 and CO2: &lt;/div&gt;&lt;div&gt;c  Geochimica et Cosmochimica Acta, v.70, p.5653-5664. &lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Berner, R. A., 2006b, Inclusion of the weathering of volcanic rocks in the GEOCARBSULF model: &lt;/div&gt;&lt;div&gt;c  American Journal of Science, v.306, p.295-302, doi:10.2475/052006.01. &lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Berner, R. A., 2008, Addendum to Inclusion of the weathering of volcanic rocks in the &lt;/div&gt;&lt;div&gt;c  GEOCARBSULF model (Berner, R. A., 2006, v.306, p.295-302) American Journal of Science, &lt;/div&gt;&lt;div&gt;c  v.308, p.100-103, doi:10.2475/01.2008.04. &lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Berner, R. A., 2009, Phanerozoic atmospheric oxygen: New results using the GEOCARBSULF Model: &lt;/div&gt;&lt;div&gt;c  American Journal of Science, v.309, p.603-606, doi:10.2475/07.2009.03. &lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  The code computes the aggregate data fit of GEOCARBSULF for each choice &lt;/div&gt;&lt;div&gt;c  of the combined parameters, expressed as the fractional variance residual when expressed&lt;/div&gt;&lt;div&gt;c  in the log domain without uncertainty weighting.  &lt;/div&gt;&lt;div&gt;c  description of the proxy data can be found in &lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;div&gt;c  Royer et al, CO2 as a primary driver of Phanerozoic climate, GSA Today, March 2004.&lt;/div&gt;&lt;div&gt;c&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6306770819433237213?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/gcsv10_export.f' title='GEOCARBSULFvolc carbon-cycle simulation code'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6306770819433237213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6306770819433237213&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6306770819433237213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6306770819433237213'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2011/06/geocarbsulfvolc-carbon-cycle-simulation.html' title='GEOCARBSULFvolc carbon-cycle simulation code'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8656331773842177870</id><published>2011-06-14T07:36:00.001-04:00</published><updated>2011-06-14T07:38:11.824-04:00</updated><title type='text'>Reminder for the Fortran plotting subroutine PLOTIT</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Times; font-size: medium; "&gt;&lt;a href="http://earth.geology.yale.edu/%7Ejjpark/Code/plotit.tar"&gt;http://earth.geology.yale.edu/~jjpark/Code/plotit.tar&lt;/a&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;information README at &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;http://earth.geology.yale.edu/~jjpark/Code/plotit.html&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8656331773842177870?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/plotit.tar' title='Reminder for the Fortran plotting subroutine PLOTIT'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8656331773842177870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8656331773842177870&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8656331773842177870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8656331773842177870'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2011/06/reminder-for-fortran-plotting.html' title='Reminder for the Fortran plotting subroutine PLOTIT'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6856922752878001203</id><published>2009-11-11T21:22:00.002-05:00</published><updated>2009-11-11T21:32:56.691-05:00</updated><title type='text'>Disclaimer and Free Software Statement</title><content type='html'>&lt;http://www.gnu.org/licenses&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;The computer codes that I post to the JParkCodes blog are provided as free software. &lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;You can redistribute the codes and/or modify them 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.&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;    This program is distributed in the hope that it will be useful,&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;    but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;    GNU General Public License for more details.&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;    You may obtain a copy of the GNU General Public License&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;    along with these program at the link above.  If not active, see http://www.gnu.org/licenses/.&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/http://www.gnu.org/licenses&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6856922752878001203?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.gnu.org/licenses/' title='Disclaimer and Free Software Statement'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6856922752878001203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6856922752878001203&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6856922752878001203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6856922752878001203'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/11/disclaimer-and-free-software-statement.html' title='Disclaimer and Free Software Statement'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8673727959001675574</id><published>2009-11-05T11:32:00.003-05:00</published><updated>2009-11-05T11:41:39.686-05:00</updated><title type='text'>grn_propzon.f -- code to compute greensfunctions for zonally-symmetric earth models.</title><content type='html'>c  program grn_propzon -- three-component gfcts&lt;br /&gt;c  for zonally-symmetric earth models&lt;br /&gt;c  f77 -o /Users/jjpark/bin/grn_propzon grn_propzon.f  /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/grn_propzon grn_propzon.f /Users/jjpark/Plotxy/plotlib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c  the code reads a special compressed hybrid eigenvector file&lt;br /&gt;c  produced by program propzon. &lt;br /&gt;c  This routine does a coupling calculation in frequency intervals, storing all&lt;br /&gt;c  hybrid singlets in a central interval of the coupling bandwidth.&lt;br /&gt;c  the trick is to read the coupling partners for each block, calculate&lt;br /&gt;c  receiver and source scalars, then read the eigenvectors one by one.&lt;br /&gt;&lt;br /&gt;As with the spherical-earth greensfunction code, this code creates waveforms for a source-receiver geometry stored in the SAC header of a common seismic data file.  Unlike the sph-earth code, the output is tied to geographic coordinates (east/north), not radial/transverse.  The code syndat.f takes the greensfunctions and sums with a source mechanism to form synthetic seismograms.&lt;br /&gt;&lt;br /&gt;sample input:&lt;br /&gt;&lt;br /&gt;0                             --&gt; # of point to compute, 0=same number as in the data file&lt;br /&gt;ffc.lhz --&gt; data file for source-receiver-station info&lt;br /&gt;gzB0.05_ffc  --&gt; filename root for greenfct files, code will append ".lhz" ".lhe" ".lhn" &lt;br /&gt;../Vary/ymodel10_B0.05.zon20  --&gt; input file of hybrid singlets, computed with zonchn.f&lt;br /&gt;/Users/jjpark/Mineos/Models/premiss  --&gt; earth model (isotropic PREM in this case)&lt;br /&gt;/Users/jjpark/Mineos/sphnl --&gt; N,L file of spheroidal mode parameters&lt;br /&gt;/Users/jjpark/Mineos/sphe --&gt; direct-access Fortran file of spheroidal modal eigenfunctions&lt;br /&gt;/Users/jjpark/Mineos/tornl --&gt; N,L file of toroidal mode parameters&lt;br /&gt;/Users/jjpark/Mineos/tore --&gt; direct-access Fortran file of toroidal modal eigenfunctions&lt;br /&gt;stop&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8673727959001675574?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/grn_propzon.f' title='grn_propzon.f -- code to compute greensfunctions for zonally-symmetric earth models.'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8673727959001675574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8673727959001675574&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8673727959001675574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8673727959001675574'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/11/grnpropzonf-code-to-compute.html' title='grn_propzon.f -- code to compute greensfunctions for zonally-symmetric earth models.'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4205587156322567401</id><published>2009-11-05T11:22:00.001-05:00</published><updated>2009-11-05T11:31:46.086-05:00</updated><title type='text'>zonsubs.f -- the subroutines needed to make zonchn.f work</title><content type='html'>This set of subroutines serves zonchn.f, see the earlier post.  The first routine yread reads the parameters of the zonally symmetric model  example file here&lt;br /&gt;&lt;br /&gt;1 1    !  useless parameters for option I never implemented&lt;br /&gt;0.0 0.05 0.0 0.0 0.0   A,B,C,D,E relative perts to the Backus anisotropy parameters for azim anisotropy with an axis of symmetry.&lt;br /&gt;1 152 181     ! lithosphere in model premiss&lt;br /&gt;10     !  k=10 wavenumber on the sphere&lt;br /&gt;&lt;br /&gt;Some relevant passages of code are the following:&lt;br /&gt;&lt;br /&gt;c  angint is original theta integral for cos{(l+1/2)\theta} structure&lt;br /&gt;c  angint2 uses 3-j tricks to speed up the calculation&lt;br /&gt;c  angint2X uses 3-j tricks, but for either spherical cap or equatorial band&lt;br /&gt;c  angint2XX is s=20 expansion of equatorial band model, no discontinuites&lt;br /&gt;c          call angint2(l1,l2,ls(kii),angi)&lt;br /&gt;         call angint2X(l1,l2,ls(kii),angi)&lt;br /&gt;c          call angint2XX(l1,l2,ls(kii),angi)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;c  combine isotropic and anisotropic parts, use b,c,e &amp; a,d&lt;br /&gt;c  **************************** note that code can incorporate only&lt;br /&gt;c ***************************** one aspherical wavenumber, despite &lt;br /&gt;c ***************************** the do loops&lt;br /&gt;c  NOTE: some lines have alternate versions for phi and theta as axis of sym&lt;br /&gt;          if(ick.eq.3) then                  ! tor-tor&lt;br /&gt;            do j=1,nom &lt;br /&gt;              coup(j)=coup(j)&lt;br /&gt;     x               +angi(3,j)*(c*ysc(1,1)+e*ysc(2,1))     ! anisotropic&lt;br /&gt;c     x           -angi(5,j)*e*ysc(3,1)-angi(6,j)*c*ysc(1,1) ! anisotropic-phi&lt;br /&gt;     x           +angi(5,j)*e*ysc(3,1)-angi(6,j)*c*ysc(1,1) ! anisotropic-theta&lt;br /&gt;     x           +angi(2,j)*d*ysc(3,1)+angi(3,j)*d*ysc(2,1) ! isotropic&lt;br /&gt;            end do&lt;br /&gt;&lt;br /&gt;comment or uncomment the phi and theta terms as you wish, but dont comment both or uncomment both.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4205587156322567401?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/zonsubs.f' title='zonsubs.f -- the subroutines needed to make zonchn.f work'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4205587156322567401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4205587156322567401&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4205587156322567401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4205587156322567401'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/11/zonsubsf-subroutines-needed-to-make.html' title='zonsubs.f -- the subroutines needed to make zonchn.f work'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7097965260008205373</id><published>2009-11-05T10:13:00.002-05:00</published><updated>2009-11-05T11:15:09.674-05:00</updated><title type='text'>zonchn.f  --  code to couple free oscillations for a zonally symmetric earth model</title><content type='html'>zonchn.f is a code to couple together free oscillations of Earth for a set of highly restricted aspherical earth models.  The models are zonally symmetric, dependent only on co-latitude.  The code has subroutines that integrate the modes against two types of models (1) a model that depends on a single wavenumber k, and (2) a model that is an equatorial band or a symmetric spherical cap.  The first model type was used to examine the wavenumber behavior of surface-wave coupling, and the second type simulates the interaction of surface waves with a sharp boundary.  The paper that describes the code's workings is&lt;br /&gt;&lt;br /&gt; Park, J., The sensitivity of seismic free oscillations to upper mantle anisotropy I. Zonal symmetry, J. Geophys. Res., v98, 19933-19949, 1993.&lt;br /&gt;&lt;br /&gt;Zonal symmetry in the model allows the coupling to vanish for all free-oscillation singlets with differing azimuthal numbers m, m'.  In this manner, if there are two modes nSl and n'Sl' with a total of 2l'+1+2l+1 = 2(l+l'+1) singlets, the coupling problem splits apart into (for l'&gt;l) 2l+1 2x2 coupling matrices, and l'-l uncoupled singlets.  As a result of this symmetry, zonchn can readily accept a large number of modes in a narrow frequency band without breaking the computer memory or the CPU.  The general scheme is to march up in frequency in steps of df and Df:  All modes in a half-bandwidth Df about some fiducial frequency fo are coupled, but only those hybrid modes in a narrower bandwidth df about fo are saved.  The code increases fo by 2*df and iterates up to some cutoff frequency.  The user specifies how many overtones n are included.  The uploaded version of zonchn.f has been tested with 0.2.le.f.le.20 mHz and df=0.1 mHz, Df=0.5 mHz and n-max=5.&lt;br /&gt;&lt;br /&gt;The code depends on a set of subroutines in the file zonsubs.f, which are posted next in this blog.&lt;br /&gt;&lt;br /&gt;The code reads from an input file "phzonchn" that contains&lt;br /&gt;&lt;br /&gt;      print *,'open(15,file=phzonchn,form=formatted)'&lt;br /&gt;      open(15,file='phzonchn',form='formatted')&lt;br /&gt;      call yread&lt;br /&gt;      print *,'output chain file '&lt;br /&gt;      read(15,102)namchn&lt;br /&gt;      print *,namchn&lt;br /&gt;  102 format(80a)&lt;br /&gt;      print *,'initial open of output file in append mode (0=no) '&lt;br /&gt;      read(15,*) iappend&lt;br /&gt;      print *,'iappend= ',iappend&lt;br /&gt;      print *,'enter inner freq halfwidth, outer freq halfwidth (mHz)'&lt;br /&gt;c  outer band is modes that couple, inner band contains modes that are saved&lt;br /&gt;      read(15,*) hfin,hfout&lt;br /&gt;      print *,hfin,hfout&lt;br /&gt;      print *,'enter freq band for hybrid modes (mHz)'&lt;br /&gt;      read(15,*) fb1,fb2&lt;br /&gt;      print *,fb1,fb2&lt;br /&gt;      fb1=dmax1(fb1,0.25d0)&lt;br /&gt;      print *,'enter max overtone branch to consider'&lt;br /&gt;      read(15,*) nbrmax&lt;br /&gt;&lt;br /&gt;The option of writing the output file in "append" mode is an artifact of slow computers of the 1990s, in which one might need to stop and restart a long computation.  I doubt that the user will need this option in 2009, though my test calculation required the greater part of an hour to complete.  &lt;br /&gt;&lt;br /&gt;example for phzonchn:&lt;br /&gt;&lt;br /&gt;ymodel10_B0.05                            --&gt; aspherical model file&lt;br /&gt;ymodel10_B0.05.zon20                --&gt; output file of hybrid modes (linear comb of sph-earth modes, new frequencies)&lt;br /&gt;0                                                        --&gt; dont open output file in append mode (usual case)&lt;br /&gt;0.1 0.5                                             --&gt; inner band contains modes that are saved, outer band is modes that couple (mHz)&lt;br /&gt;0.2 20                                              --&gt; frequency band to compute (mHz)&lt;br /&gt;5                                                        --&gt;  max number of overtones&lt;br /&gt;/Users/jjpark/Mineos/Models/premiss   --&gt;  earth model (isotropic PREM in this case)&lt;br /&gt;/Users/jjpark/Mineos/sphnl                      --&gt; N,L file of spheroidal mode parameters&lt;br /&gt;/Users/jjpark/Mineos/sphe                       --&gt; direct-access Fortran file of spheroidal modal eigenfunctions&lt;br /&gt;/Users/jjpark/Mineos/tornl                       --&gt; N,L file of toroidal mode parameters&lt;br /&gt;/Users/jjpark/Mineos/tore                         --&gt; direct-access Fortran file of toroidal modal eigenfunctions&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The model file is based on the A,B,C,D,E Backus parameterization of hexagonally-symmetric anisotropy.  A and D are isotropic P and S wavespeed perturbations (peak2peak variation: A=0.05 implies 5%).  B is the 2\phi azimuthal Vp term, C is the 4\phi azimuthal Vp term, and E is the 2\phi azimuthal Vs term.  The input, as explained in the post for zonsubs.f iare the values of the ABCDE and the wavenumber k of a corrugation in colatitude.  The code does not allow the user to choose the equatorial band model on input.  You must change a subroutine call and recompile the code.  I may fix this soon, as it is cumbersome.  Similarly, there is a slight alteration in the coupling formulas that switches the cases for an anisotropic symmetry axis w-hat aligned with theta-hat, or with phi-hat, that is, with colatitude and longitude, respectively.  Due to symmetry restrictions, only w-hat parallel to theta-hat or phi-hat is allowed by this code.  No tilted axes of symmetry, no general azimuthal angle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7097965260008205373?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/zonchn.f' title='zonchn.f  --  code to couple free oscillations for a zonally symmetric earth model'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7097965260008205373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7097965260008205373&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7097965260008205373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7097965260008205373'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/11/zonchnf-code-to-couple-free.html' title='zonchn.f  --  code to couple free oscillations for a zonally symmetric earth model'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-1321932597927332200</id><published>2009-10-30T10:11:00.002-04:00</published><updated>2009-10-30T10:27:21.704-04:00</updated><title type='text'>syndat.f -- sum greens functions with moment tensor and centroid time correction</title><content type='html'>This code is a version of the old sac_syndat.f that incorporates the IRIS-suppied EVRESP subroutine to compute and apply instrument response correction to convert displacement to instrument counts.&lt;br /&gt;&lt;br /&gt;c  f77 -o /Users/jjpark/bin/syndat syndat.f /Users/jjpark/Ritz/libevresp.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/syndat syndat.f /Users/jjpark/Ritz/libevresp.a /Users/jjpark/Plotxy/plotlib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c   program to make synthetics using green fcts&lt;br /&gt;c  the greenfcts are raw displacement in meters.  This code applies the instrument&lt;br /&gt;c  response in the frequency domain with a FFT --&gt; multiply by H(f) --&gt; IFFT process.&lt;br /&gt;&lt;br /&gt;program asks for the centroid time delay, which is applied with a phase-ramp in the frequency domain&lt;br /&gt;The centroid time delay occurs because the start time of a large event is typically not the best time to place the stepfunction onset of the long-period course.  If moment release occurs over T seconds, then a better fit to data is found by delaying the synthetic onset by T/2 seconds.  (Assuming a symmetric source time function, natch).&lt;br /&gt;&lt;br /&gt;      print *,'enter time delay e.g. centroid-time correction'&lt;br /&gt;      read(5,*) tconst&lt;br /&gt;   40 print *,'do you want to use strike,dip and rake (0=no) '&lt;br /&gt;      read(5,*) ick&lt;br /&gt;      if(ick.ne.0) then&lt;br /&gt;        call fault(sol)&lt;br /&gt;      else&lt;br /&gt;        print *,'enter f(x6) : '&lt;br /&gt;        read(5,*) (sol(i),i=1,6)&lt;br /&gt;      endif&lt;br /&gt;      print *,'routine expects the gfct filename to start with g'&lt;br /&gt;      print *,'the code substitutes s for g in the output filename'&lt;br /&gt;  30  print *,'green fns file name(&lt;stop&gt;=stop) : '&lt;br /&gt;&lt;br /&gt;The program will read a succession of greensfct files, one per station-component, until it reads 'stop' e.g.&lt;br /&gt;&lt;br /&gt;0  --&gt; zero centroid time delay&lt;br /&gt;1  --&gt; read strike,dip,slip&lt;br /&gt;329 8 110  --&gt; strike dip slip&lt;br /&gt;400             --&gt; seismic moment (units of 10**27 dyne-cm/10**20 nt-m)&lt;br /&gt;/Users/jjpark/Synth/gsph_ffc.lhz     --&gt; greensfct file&lt;br /&gt;/Users/jjpark/Synth/gsph_ffc.lhr&lt;br /&gt;/Users/jjpark/Synth/gsph_ffc.lht&lt;br /&gt;stop                                                    &lt;br /&gt;&lt;br /&gt;There are PLOTIT calls within the code (commented out for now) that allow the user to view his/her handiwork, testing the causality of the instrument response, etc.&lt;br /&gt;&lt;br /&gt;The EVRESP routine is found in the libevresp.a library that you can create from the IRIS EVALRESP software distribution.  For reasons only the DMC programmers know, the latest versions of the EVALRESP distribution hide the libevresp.a library in a subdirectory ".lib" that wont show up in a "ls" command unless you are looking for it.  Just another convenience feature, I guess.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-1321932597927332200?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/syndat.f' title='syndat.f -- sum greens functions with moment tensor and centroid time correction'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/1321932597927332200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=1321932597927332200&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1321932597927332200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1321932597927332200'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/10/syndatf-sum-greens-functions-with.html' title='syndat.f -- sum greens functions with moment tensor and centroid time correction'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8153083535568366985</id><published>2009-10-30T09:33:00.002-04:00</published><updated>2009-10-30T09:50:27.958-04:00</updated><title type='text'>Evalresp follies</title><content type='html'>The IRIS-supplied instrument response software was not straightforward to incorporate into our codes.  The key C-subroutine EVRESP is built for incorporating into Fortran codes, but seems to have developed a bug over its past revisions, and no one may have complained of it.  The subroutine generates the filename of a RESP file, nominally output by rdseed.  In previous versions of the subroutine I have used (circa 2005) the routine opens the file, reads the contents and generates a frequency domain instrument response for convolving synthetics or deconvolving data.  The 2008-9 versions of EVRESP cant seem to find the file whose name they create (seemingly correctly) and the program fails.  Diddling with the SEEDRESP environmental variable does not seem to help.  The fix that I found was to feed EVRESP the RESP.*  filename explicitly, by generating the filename myself from the same group of character-string variables that EVRESP uses.  To wit:&lt;br /&gt;&lt;br /&gt;      file='RESP.'//net//'.'//sta//'.'//locid//'.'//cha&lt;br /&gt;      print *,file&lt;br /&gt;c  remove blank spaces&lt;br /&gt;      do i=30,7,-1&lt;br /&gt;        if(file(i:i).eq.' ') file=file(1:i-1)//file(i+1:80)//' '&lt;br /&gt;      end do&lt;br /&gt;      print *,file&lt;br /&gt;      print *,'entering evresp'&lt;br /&gt;      print *,sta,cha,net,locid,datime,unts,nscan,npad,nha&lt;br /&gt;      iflag=evresp(sta,cha,net,locid,datime,unts,file,freq,nha,resp,&lt;br /&gt;     x                rtyp,vbs,start_stage,stop_stage,stdio_flag)&lt;br /&gt;      print *,'done evresp'&lt;br /&gt;&lt;br /&gt;The character string "file" is passed to the routine and the code looks for it successfully, if the file is there!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8153083535568366985?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8153083535568366985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8153083535568366985&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8153083535568366985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8153083535568366985'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/10/evalresp-follies.html' title='Evalresp follies'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4035435077312929695</id><published>2009-10-29T12:19:00.005-04:00</published><updated>2009-10-30T09:33:22.439-04:00</updated><title type='text'>sacread.f -- subroutines to read and write SAC-format files -- adjusted to write 6-component greens functions</title><content type='html'>sacread.f &lt;br /&gt;&lt;br /&gt;subroutines to read and write SAC-format files -- adjusted to write 6-component greens functions.  The routines provided by SAC are fine, of course, but I use a hydrid file format for greens-function files.  These files contain six displacement traces rather than one, one for each independent component of the seismic moment tensor.  There is a flag in the SAC header that I took over for indicating that six traces need to be read instead of one.  &lt;br /&gt;&lt;br /&gt;      if(chead(145).ne.' GRN'.and.chead(145).ne.' grn') then&lt;br /&gt;        nword=nscan+158&lt;br /&gt;        nrec=(nword-1)/128+1&lt;br /&gt;        last=nword-128*(nrec-1)&lt;br /&gt;      else       &lt;br /&gt;        print *,'reading greens functions' &lt;br /&gt;        nword=6*nscan+158&lt;br /&gt;        nrec=(nword-1)/128+1&lt;br /&gt;        last=nword-128*(nrec-1)&lt;br /&gt;      endif&lt;br /&gt;&lt;br /&gt;The subroutines are sacread, sacout, sacread_swap and sacout_swap.  The last two routines swap big-endian and little-endian data.  You will be happier if you never need to swap bytes, but they are there for when you are painted into that corner.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4035435077312929695?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/sacread.f' title='sacread.f -- subroutines to read and write SAC-format files -- adjusted to write 6-component greens functions'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4035435077312929695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4035435077312929695&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4035435077312929695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4035435077312929695'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/10/sacreadf-subroutines-to-read-and-write.html' title='sacread.f -- subroutines to read and write SAC-format files -- adjusted to write 6-component greens functions'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-2386777600109382512</id><published>2009-10-29T12:14:00.002-04:00</published><updated>2009-10-29T12:18:52.169-04:00</updated><title type='text'>csolve.f -- solve a system of equations with complex coefficients</title><content type='html'>csolve.f  is a subroutine for doing Gaussian elimination with partial pivoting to solve a system of linear equations A.x=y with complex matrix A and vector y.  Useful in several routines.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-2386777600109382512?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/csolve.f' title='csolve.f -- solve a system of equations with complex coefficients'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/2386777600109382512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=2386777600109382512&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/2386777600109382512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/2386777600109382512'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/10/csolvef-solve-system-of-equations-with.html' title='csolve.f -- solve a system of equations with complex coefficients'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7752164515839923373</id><published>2009-10-28T14:04:00.001-04:00</published><updated>2009-10-28T14:05:27.578-04:00</updated><title type='text'>Snow Leopard transition: Fortran</title><content type='html'>Just an informational item regarding Snow Leopard's treatment of Fortran.  The first comment is that programmers need to install XCode from the Snow Leapard install DVD.  I bulled ahead without checking this and ran into a roadblock in trying to compile a Fortran program -- the computer could not find the unix command "as" which assembles object files.  Once I loaded the XCodes package from the Install disk, this problem went away, and others cropped up.&lt;br /&gt;&lt;br /&gt;The innovation of Snow Leopard (and Leopard, I think, Im not exactly sure when the transition occurred relative to Tiger (MacOS 10.4)) is the full utilization of 64-bit chip architecture.  The Snow Leopard gcc compiler creates object files that are 64bit, but the Fortran compiler g77 does not.  If you try to assemble Fortran and C routines into one archive or a single program, the computer balks.  You can tell the nature of the object file with the command "file *.o".  I sampled the internets for hints on solving this problem.  The simplest solution, and the one Im adopting for now, is to force the gcc compiler to generate a 32-bit object file, rather than a 64bit version, with the "-m32" runtime option.  Less powerful than 64bit,  and Im still getting warnings from the compiler when I create large codes, but the executables seem to work OK.&lt;br /&gt;&lt;br /&gt;The "gfortran" option, rather than "g77" for the Fortran compiler, might work with the 64bit option, but the internets are not unanimous on its success.  There are compilers available for download from the HPC site (http://hpc.sourceforge.net/) that claim to vectorize gcc (version 4.4) in Snow Leopard.  I read comments from programmers that full-optimization of the compiler has bugs, so buyer beware.  I  might try it later, though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7752164515839923373?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7752164515839923373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7752164515839923373&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7752164515839923373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7752164515839923373'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/10/snow-leopard-transition-fortran.html' title='Snow Leopard transition: Fortran'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8738755990685300726</id><published>2009-10-20T11:49:00.008-04:00</published><updated>2009-10-29T12:35:01.749-04:00</updated><title type='text'>Code for computing greens function for synthetic seismograms using summed free oscillations for spherical earth models</title><content type='html'>The task of computing synthetic seismograms from summed free oscillations for an aspherical earth model is typically accomplished in two or three steps.  The first step computes the hybrid free-oscillations for a chosen earth model, comprised of the "simple" spherical-earth modes whose particle motions follow single vector spherical harmonics.  The second step takes those hybrid modes and computes greens functions for particle motion at a given source location (allowing six different time series, one for each component of the seismic moment tensor) and station location (for a given sensor and three time series for three components: vertical/horizontal).  The last step is the computation of a synthetic seismogram by summing the six time series for each motion component by weighting with the components of the moment tensor.  &lt;br /&gt;&lt;br /&gt;Historically, I have used the greens function routine as the location for adding the instrument response, but I have reconsidered this choice.  Computers are fast enough for the FFTs an instrument response to be computed on the fly in the last step.  This also avoids the problem of updating the instrument response codes (notoriously unstable, owing to the various formats for instrument responses) in multiple greensfunction codes.  My final code (sac_syndat.f) is used for all, and should be the place where instrument response either is (or is not) applied.   The output of this routine has units of displacement in meters.&lt;br /&gt;&lt;br /&gt;So, for making these codes more public, lets start with the simple code for synthetic seismograms on a spherical earth model.&lt;br /&gt;The code is grn_sph.f, which has existed in one form or another for over 20 years (this explains the dead code inside it).  &lt;br /&gt;&lt;br /&gt;      print *,'typical input for this program:'&lt;br /&gt;      print *,'0 20 --&gt; freq interval to sum (mHz)'&lt;br /&gt;      print *,'/home/jjpark/Mineos/Models/premiss --&gt; 1-D earth model'&lt;br /&gt;      print *,'/home/jjpark/Mineos/premissnl  --&gt; spheroidal info'&lt;br /&gt;      print *,'/home/jjpark/Mineos/premiss_eig  --&gt; spheroidal modes'&lt;br /&gt;      print *,'/home/jjpark/Mineos/premistnl  --&gt; toroidal info'&lt;br /&gt;      print *,'/home/jjpark/Mineos/premist_eig  --&gt; toroidal modes'&lt;br /&gt;      print *,'1000 --&gt; # of overtone branches (here: all of them)'&lt;br /&gt;      print *,'0 --&gt; # of data points to synthesize (0-&gt; #=data: NPTS)'&lt;br /&gt;      print *,'/park/nobackup/Sumatra/VH/PET.VHZ --&gt; data file'&lt;br /&gt;      print *,'.....'&lt;br /&gt;      print *,'. . . more data files'&lt;br /&gt;      print *,'.....'&lt;br /&gt;      print *,'stop'&lt;br /&gt;      print *,' '&lt;br /&gt;      print *,'The format of the greens fct files is impure SAC-format'&lt;br /&gt;      print *,'readable only by sac_syndat and related JPark codes'&lt;br /&gt;      print *,'It has a SAC header with one ASCII variable set to GRN'&lt;br /&gt;      print *,'and six*NPTS data values that follow the header'&lt;br /&gt;      print *,'NPTS for each component of the source moment tensor'&lt;br /&gt;      print *,'The greens-function file names are created from your input file'&lt;br /&gt;      print *,'by prepending gsph_ to the input filename'&lt;br /&gt;      print *,'and replacing the last character with z,r,t'&lt;br /&gt;&lt;br /&gt;This code reads files full of free-oscillation displacement functions for a standard earth model, computes the strain of the mode at the desired source depth, and sums 6 traces for surface displacement at a specified distance from the source.  Because the earth model is a spherical-earth model, only the source depth and source-receiver distance affect the waveforms that represent oscillatory displacement.  The code, however, takes a data file to specify the source and receiver locations and creates synthetics for the geometry.  A subsequent processing step (syndat.f) will take the greens function file, sum with the components of a moment tensor, and apply the instrument responses appropriate to the station's sensors and channel.&lt;br /&gt;&lt;br /&gt;The start time for the earthquake determines where the decaying sinusoids begin.  Older versions of green-fct codes used an explicit time that the user had to supply.  This version assumes that the information is in the omarker time in the SAC header.  There is also a bmarker time that is used in case the start time of the record does not correspond to the reference time in the data header.  &lt;br /&gt;c  the reference time of the file could be before or after the first data point&lt;br /&gt;c  the ymdhmsec parameters define the reference time&lt;br /&gt;c  the origin quake of the quake and start of record are wrt reference time&lt;br /&gt;      origin=ahead(8)   ! event start is the omarker in sac header&lt;br /&gt;      recstart=ahead(6)   ! record start is the bmarker in sac header&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8738755990685300726?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/grn_sph.f' title='Code for computing greens function for synthetic seismograms using summed free oscillations for spherical earth models'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8738755990685300726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8738755990685300726&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8738755990685300726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8738755990685300726'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2009/10/code-for-computing-greens-function-for.html' title='Code for computing greens function for synthetic seismograms using summed free oscillations for spherical earth models'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-5822327888674546971</id><published>2008-08-01T13:04:00.005-04:00</published><updated>2008-08-01T13:22:17.817-04:00</updated><title type='text'>Rayleigh Wave Dispersion Code</title><content type='html'>This a a computer code that performs the 1D layered-media reflectivity method to compute Rayleigh-wave dispersion. Was an exercise for me when adapting the computational scheme of the GJI paper by Xiaofei Chen (1993) for layered anisotropic media. Uses model files in the same format used by the anisotropic surface-wave code aniprop.f and the anisotropic body-wave codes anirec.f and related. The read statements read the anisotropic parameters into dummy variables and ignore them.  The code only plots dispersion curves for phase velocity CVEL, but does not compute GVEL, the group velocity. The values of CVEL are *not* written out for later use.  You can modify the code yourself to write out cvel values.&lt;br /&gt;&lt;br /&gt;c  chenray - to calculate propagating Rayleigh modes of layered structure &lt;br /&gt;c    revised to calculate dispersion curves 7/7/95, debugged 7/27/08&lt;br /&gt;c  9/2/94  - cannibalized from aniprop to test its structure&lt;br /&gt;c  xf77 -o /home/jjpark/bin/chenray chenray.f /home/jjpark/Plotxy/plotlib.a /home/jjpark/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/chenray chenray.f /Users/jjpark/Plotxy/plotlib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c&lt;br /&gt;c  will calculate Rayleigh wave dispersion &amp; eigenfunctions using formulas&lt;br /&gt;c  of Chen (1993)&lt;br /&gt;c  max is 100 layers over a halfspace&lt;br /&gt;c  model is read from file 'model'&lt;br /&gt;c  reads nl=#_of_layers, then depth_i,rho_i,alpha_i,beta_i, i=1,nl+1&lt;br /&gt;c  ee, e1 and e2 are 4x4 matrices that get partitioned into 2x2 submatricies to &lt;br /&gt;c  separate out the reflection and transmission of waves at an interface.&lt;br /&gt;c &lt;br /&gt;c  rt(j) is generalized reflection coef \tilde{R}_du at jth interface&lt;br /&gt;c  tt(j) is generalized transmission coef \tilde{T}_d at jth interface&lt;br /&gt;c  rt0 is gnrlzd refl coef \tilde{R}_ud^(0) at free surface (0th interface)&lt;br /&gt;c  rtm(*,*,j) is matrix of modified R/T coefs at the jth interface&lt;br /&gt;c  rtm0(2,2) is matrix of modified R/T coefs at free surface - 0th interface&lt;br /&gt;c&lt;br /&gt;c  OUTPUT: makes plots of dispersion, but does not write phase velocity (cvel) to a file&lt;br /&gt;c  or compute the group velocity (gvel).  The code has not worked in 1994, and I chose to &lt;br /&gt;c push on to the general anisotropic surface wave code aniprop.f, rather than to debug this&lt;br /&gt;c  Rayleigh-wave code.  This code was revived and debugged in 2008(!) by JPark&lt;br /&gt;c&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-5822327888674546971?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/chenray.f' title='Rayleigh Wave Dispersion Code'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/5822327888674546971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=5822327888674546971&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5822327888674546971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5822327888674546971'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/08/rayleigh-wave-dispersion-code.html' title='Rayleigh Wave Dispersion Code'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3357885929802248987</id><published>2008-08-01T12:34:00.003-04:00</published><updated>2008-08-01T13:04:08.887-04:00</updated><title type='text'>Love-Wave Dispersion  Code</title><content type='html'>This a a computer code that performs the 1D layered-media reflectivity method to compute Love-wave dispersion.  Was an exercise for me when adapting the computational scheme of the GJI paper by Xiaofei Chen (1993) for layered anisotropic media.  Uses model files in the same format used by the anisotropic surface-wave code aniprop.f and the anisotropic body-wave codes anirec.f and related.   The read statements read the anisotropic parameters into dummy variables and ignore them.&lt;br /&gt;&lt;br /&gt;c  will calculate love wave dispersion &amp; eigenfunctions using formulas&lt;br /&gt;c  of Chen (1993)&lt;br /&gt;c  max is 100 layers over a halfspace&lt;br /&gt;c  model is read from file 'model'&lt;br /&gt;c  reads nl=#_of_layers, then depth_i,rho_i,alpha_i,beta_i, i=1,nl+1&lt;br /&gt;c  the variables:&lt;br /&gt;c  c(j,1) are C_d; c(j,2) are the C_u from Chen (1993) for the jth layer&lt;br /&gt;c  c(nlayer+1,*) are coefs in the halfspace.&lt;br /&gt;c  rt(j) is generalized reflection coef \tilde{R}_du at jth interface&lt;br /&gt;c  tt(j) is generalized transmission coef \tilde{T}_d at jth interface&lt;br /&gt;c  rt0 is gnrlzd refl coef \tilde{R}_ud^(0) at free surface (0th interface)&lt;br /&gt;c  rtm(*,*,j) is matrix of modified R/T coefs at the jth interface&lt;br /&gt;c  rtm0(2,2) is matrix of modified R/T coefs at free surface - 0th interface&lt;br /&gt;c&lt;br /&gt;c  OUTPUT: makes plots of dispersion, and also writes phase velocity (cvel) &lt;br /&gt;c  group velocity (gvel) and three integration scalars that are used in the variational &lt;br /&gt;c  computation of group velocity from phase velocity&lt;br /&gt;c           do the sum&lt;br /&gt;c              ... &lt;br /&gt;c              ci1=ci1+rho(il)*(dci1+dci2)&lt;br /&gt;c              ci2=ci2+xmu(il)*(dci1+dci2)&lt;br /&gt;c              ci4=ci4+xmu(il)*(dci1-dci2)*xnu(il)**2&lt;br /&gt;c            end do&lt;br /&gt;c            gvel=ci2/(cvel*ci1)&lt;br /&gt;c&lt;br /&gt;c&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3357885929802248987?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/chenlove.f' title='Love-Wave Dispersion  Code'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3357885929802248987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3357885929802248987&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3357885929802248987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3357885929802248987'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/08/love-wave-dispersion-code.html' title='Love-Wave Dispersion  Code'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6280057483670658367</id><published>2008-07-01T15:31:00.003-04:00</published><updated>2008-07-01T16:00:36.472-04:00</updated><title type='text'>Viewing the output of the sacw_corr_many code</title><content type='html'>The code agu.f (guess where I wrote it!) reads the cvel_YYYY.DDD.HH files and generates some plots of the phase-velocity as fct of period using a collection of algorithms: weighted sum, trimmed weighted sum, median.     Version posted can process up to 100 cvel files.  You can expand the arrays for more.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;input:&lt;br /&gt;&lt;br /&gt;cvel_2006.175.02  --&gt; input file (one per event , just "ls cvel_20* &gt;! c_agu"&lt;br /&gt;cvel_2006.225.10&lt;br /&gt;cvel_2006.225.19&lt;br /&gt;cvel_2006.240.22&lt;br /&gt;stop                         --------------------&gt; end of input files&lt;br /&gt;3                              --------------------&gt; make a plot&lt;br /&gt;4                              --------------------&gt; make a plot and write to PS file&lt;br /&gt;cvel_eastwest.ps   ---------&gt; PS plotfile&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6280057483670658367?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/agu.f' title='Viewing the output of the sacw_corr_many code'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6280057483670658367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6280057483670658367&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6280057483670658367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6280057483670658367'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/07/viewing-output-of-sacwcorrmany-code.html' title='Viewing the output of the sacw_corr_many code'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-9166974043726107585</id><published>2008-07-01T14:34:00.006-04:00</published><updated>2008-07-01T15:31:04.334-04:00</updated><title type='text'>Using the wavelet-based surface wave code</title><content type='html'>sacw_corr_many.f does a 2-station estimation of phase velocity.&lt;br /&gt;&lt;br /&gt;sacw --&gt; sac-format data, analyzed with wavelets&lt;br /&gt;&lt;br /&gt;corr --&gt; cross-correlation is used to estimated phase shits and phase velocity&lt;br /&gt;&lt;br /&gt;many --&gt;  code is set up to run a series of data-record pairs.  &lt;br /&gt;&lt;br /&gt;The posted code is designed for 10 sps data, and computes Slepian wavelets in 16 banks logarithmically spaced between 8 and 56 second center-period.  Three complex-valued Slepian wavelets are used, in order to estimate phased cross-correlations with 2 and 4 degrees of freedom.  The phase of the cross-correlation is scaled with the center-period of the wavelet to compute a phase-delay. This phase delay is computed at evenly spaced points in the seismogram.   The station locations and the back-azimuth of the earthquake are used to estimate a phase velocity from the phase delay, but only at the time point where the maximum wavelet spectrum is found.   The wavelet spectrum is computed only from the first Slepian wavelet, because experience demonstrates that this affords a more stable determination of the max-amplitude arrival time. &lt;br /&gt;&lt;br /&gt;The input is at the terminal, so the command&lt;br /&gt;&lt;br /&gt;sacw_corr_many &lt; c_files_process&lt;br /&gt;&lt;br /&gt;will be standard analysis method.  This command file has the form (for stations PIIR and VOLR)&lt;br /&gt;&lt;br /&gt;2003.325.04.12.54.PIIR.DHZ&lt;br /&gt;2003.325.04.12.56.VOLR.DHZ&lt;br /&gt;3                                                              ---&gt; plot to screen, could be "0" to skip plotting&lt;br /&gt;4                                                              ---&gt; plot to screen and write output to PS file (also could skip plotting  with "0")&lt;br /&gt;2003.325.ps                                         ---&gt; name of the PS file for phase-velocity graph&lt;br /&gt;2004.024.13.05.37.PIIR.DHZ&lt;br /&gt;2004.024.13.05.40.VOLR.DHZ&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;2004.024.ps&lt;br /&gt;stop                                                       ----&gt;  end of data input&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The data files must have a common start time (despite the differing numbers in the filenames in this example)  In practice, one can use SAC commands to achieve this easily. It is convenient to drop the minutes and seconds entries in the filenames, saving the year/julianday/hour filename format, because these parameters will match for different stations, and the minutes/seconds wont..   For instance, if you have a file "infiles" of the filename pairs to analyze, then&lt;br /&gt;&lt;br /&gt;ls 20*VOLR*DHZ | sed 's/\./ /g' | awk '{print "read " $1 "." $2 "." $3 "*HZ;synch;write over;cuterr fillz;cut 0 e; read; write over; cut off"}' &gt;! c_synch&lt;br /&gt;&lt;br /&gt;will generate the SAC macro to synchronize and cut to a common start point:&lt;br /&gt;&lt;br /&gt;read 2003.325.04*HZ;synch;write over;cuterr fillz;cut 0 e; read; write over; cut off&lt;br /&gt;read 2004.009.19*HZ;synch;write over;cuterr fillz;cut 0 e; read; write over; cut off&lt;br /&gt;read 2004.024.13*HZ;synch;write over;cuterr fillz;cut 0 e; read; write over; cut off&lt;br /&gt;read 2004.038.21*HZ;synch;write over;cuterr fillz;cut 0 e; read; write over; cut off&lt;br /&gt;&lt;br /&gt;and so on . . . .&lt;br /&gt;&lt;br /&gt;The code writes a small ASCII file of phase-vel information, cvel_YYYY.DDD.HH, which looks like this&lt;br /&gt;&lt;br /&gt; cat cvel_2004.339.10&lt;br /&gt;    56.00        1.547        1.858        13.76        236.6        341.4        7.340    &lt;br /&gt;    49.18        4.596        12.74        13.76        236.6        342.0        2.470    &lt;br /&gt;    43.20        2.893        1.626        13.76        236.6        319.2        3.925    &lt;br /&gt;    37.93        4.331        1.237        13.76        236.6        321.0        2.621    &lt;br /&gt;    33.32        3.411       0.3311        13.76        236.6        322.8        3.328    &lt;br /&gt;    29.27        3.258       0.9897E-01    13.76        236.6        334.8        3.484    &lt;br /&gt;    25.70        2.934       0.2715        13.76        236.6        334.8        3.869    &lt;br /&gt;    22.58        2.948       0.1586        13.76        236.6        347.4        3.850    &lt;br /&gt;    19.83        2.939       0.2432        13.76        236.6        358.2        3.863    &lt;br /&gt;    17.42        2.759        1.053        13.76        236.6        372.0        4.114    &lt;br /&gt;    15.30        3.739        2.711        13.76        236.6        370.2        3.036    &lt;br /&gt;    13.43        5.761        2.135        13.76        236.6        417.6        1.971    &lt;br /&gt;    11.80        4.417       0.4976        13.76        236.6        456.0        2.570    &lt;br /&gt;    10.37        1.556       0.1375        13.76        236.6        559.2        7.295    &lt;br /&gt;    9.100        2.039       0.4498        13.76        236.6        725.4        5.568    &lt;br /&gt;    8.000       -27.40        99.12        13.76        236.6        995.4      -0.4143    &lt;br /&gt;&lt;br /&gt;period         cvel             d(cvel)        gcarc       baz       timeOcorrelation    delay-time&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-9166974043726107585?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/9166974043726107585/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=9166974043726107585&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/9166974043726107585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/9166974043726107585'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/07/using-wavelet-based-surface-wave-code.html' title='Using the wavelet-based surface wave code'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-307171893253402165</id><published>2008-07-01T14:27:00.002-04:00</published><updated>2008-07-01T14:34:04.321-04:00</updated><title type='text'>Code for surface-wave phase-velocity estimation</title><content type='html'>c  program sacw_corr_many&lt;br /&gt;c  JJP 04/13/07  updated 7/24/07  updated 12/11/07, again 6/25/08&lt;br /&gt;c  compute phase delays as function of frequency using the multiwavelet transform&lt;br /&gt;c  input two fil,es, typically BHZ components at different stations&lt;br /&gt;c  cross-correlate the wavelet transforms&lt;br /&gt;c  output is a colormap of time and frequency dependent time delay&lt;br /&gt;c  plotted with the wavelet transform of the two time series&lt;br /&gt;c&lt;br /&gt;c  f77 -o /park/backup/bin/sacw_corr_many sacw_corr.f /park/backup/Ritz/eislib.a /park/backup/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /park/backup/bin/sacw_corr_many sacw_corr.f /park/backup/Plotxy/plotlib.a /park/backup/Ritz/eislib.a /park/backup/Ritz/jlib.a&lt;br /&gt;c  f77 -o /Users/jjpark/bin/sacw_corr_many sacw_corr.f /Users/jjpark/Ritz/eislib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/sacw_corr_many sacw_corr_many.f /Users/jjpark/Plotxy/plotlib.a /Users/jjpark/Ritz/eislib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c&lt;br /&gt;c  to read SAC-format data, filename.bh? &lt;-- routine subs e,n,z for "?"&lt;br /&gt;c&lt;br /&gt;c  generates wavelets with eigenvector decomposition + interpolation&lt;br /&gt;c  calculate padded FFT of data for convolution with wavelet FFTs&lt;br /&gt;c  general use - calculates set of wavelets for a specified number of points&lt;br /&gt;c  interpolates and fft other lengths on the fly&lt;br /&gt;c  max=12 real-wavelets max = 6 complex-valued wavelets&lt;br /&gt;c&lt;br /&gt;c  code is based on the algorithms described in &lt;br /&gt;c&lt;br /&gt;c  Lilly, J., and J. Park, Multiwavelet spectral and polarization analysis &lt;br /&gt;c  of seismic records, Geophysical J. International, v122, 1001-1021, 1995.&lt;br /&gt;c&lt;br /&gt;c  Park, J. and M. E. Mann, Interannual temperature events and shifts in &lt;br /&gt;c  global temperature: A multiwavelet correlation approach, Earth Interactions, &lt;br /&gt;c  v. 4, online paper 4-001, 2000.&lt;br /&gt;c&lt;br /&gt;C  SEE ALSO:&lt;br /&gt;c  Bear, L. K., and G. L. Pavlis, Estimation of slowness vectors and&lt;br /&gt;c  their uncertainties using multi-wavelet seismic array processing, &lt;br /&gt;c  Bull. Seismol. Soc. Am., v87, 755--769, 1997.&lt;br /&gt;c&lt;br /&gt;c  this code generates 2-D arrays of spectra, polarization and statistical stuff&lt;br /&gt;c  it writes GMT scripts to display these arrays in dazzling color&lt;br /&gt;c&lt;br /&gt;c  for an input filename sacfile.bh?  the GMT scripts are written to&lt;br /&gt;c  GMD_sacfile.bh&lt;br /&gt;c&lt;br /&gt;c  &lt;br /&gt;c  the ASCII files to plot are named &lt;br /&gt;c  cpt_nilcut.sh   spw_nilcut.sh1  spw_nilcut.sh2&lt;br /&gt;c  dat_nilcut.sh   &lt;br /&gt;c  cpd_nilcut.sh   del_nilcut.sh  &lt;br /&gt;c&lt;br /&gt;c  dat_* is data to plot&lt;br /&gt;c  cpt_* and cohere.cpt are colorfiles for GMT&lt;br /&gt;c  del_* dep_* and dem_* are the time delay arrays&lt;br /&gt;c  spw_* wavelet spectra&lt;br /&gt;c&lt;br /&gt;c  you can fill a lot of disk space if you are not tidy with old files!&lt;br /&gt;c&lt;br /&gt;c  user must make scripts executable ("chmod +x GM*_sacfile.bh"),&lt;br /&gt;c  execute the scripts and display the postscript files&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-307171893253402165?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/sacw_corr_many.f' title='Code for surface-wave phase-velocity estimation'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/307171893253402165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=307171893253402165&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/307171893253402165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/307171893253402165'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/07/code-for-surface-wave-phase-velocity.html' title='Code for surface-wave phase-velocity estimation'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-5369777498009781354</id><published>2008-05-27T22:09:00.003-04:00</published><updated>2008-05-27T22:27:19.478-04:00</updated><title type='text'>changes in the inverse FFT in recfunk codes</title><content type='html'>After some comparison runs, Vadim Levin convinced me that the "improvement" I made to the inverse FFT in the recfunk*, rfmig* codes was a bad innovation.  The original RF-estimation codes applied a cos^2 factor to the frequency-domain RFs H_R(f) and H_T(f) with weighting unity at the f=0 point, decreasing to zero at f_max while following a cos-squared dependence.  I changed all codes to have a sharper bandpass (I was unhappy that the half-amplitude point occurred at f_max/2!) with unit factor from f=0 to f=0.5*f_max, then a cos-squared rolloff within (0.5*f_max , f_max).  This sharper bandpass led to small negative sidelobes at the flanks of sharp Ps pulses.  Although one can live with this, the temptation to interpret a wiggle could be strong, so it is safer to use the original weighting of H(f) before inverse FFT to obtain the time-domain RF.  The sidelobes do not disappear completely, but are far smaller.  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;These codes have been updated on the website:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_pick.f"&gt;recfunk_pick.f&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_estack.f"&gt;recfunk_estack&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/rfmigrate_estack.f"&gt;rfmigrate_estack&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/rfmigrate.f"&gt;rfmigrate&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_svd.f"&gt;recfunk_svd&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_mwm.f"&gt;recfunk_mwm&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_mwmj.f"&gt;recfunk_mwmj&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_mwms.f"&gt;recfunk_mwms&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/rfmig_boot.f"&gt;rfmig_boot&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/rfmig_mboot.f"&gt;rfmig_mboot&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/rfmig_cboot.f"&gt;rfmig_cboot&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/rfmig_mcboot.f"&gt;rfmig_mcboot&lt;/a&gt;.f&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-5369777498009781354?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/5369777498009781354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=5369777498009781354&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5369777498009781354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5369777498009781354'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/05/changes-in-inverse-fft-in-recfunk-codes.html' title='changes in the inverse FFT in recfunk codes'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-343567045115403066</id><published>2008-05-27T00:38:00.004-04:00</published><updated>2008-05-27T00:45:05.851-04:00</updated><title type='text'>Update of anirec_synth.f and anirec_synth_circle.f</title><content type='html'>A small amount of random noise was added to synthetics to prevent zero-divide errors (in cases where the recfunk codes tries to compute an RF for an interval of x=0 data).  In the update, this bit of noise was made smaller, and explicitly zero-mean.  There were some low-frequency artifacts cropping up in synthetic RFs.  The updated versions seem to avoid this problem:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/anirec_synth.f"&gt;anirec_synth.f&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/anirec_synth_circle.f"&gt;anirec_synth_circle.f&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;for info see  &lt;a href="http://jparkcodes.blogspot.com/2007/12/anirecsynthf-code-to-compute-synthetic.html"&gt;link&lt;/a&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-343567045115403066?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/343567045115403066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=343567045115403066&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/343567045115403066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/343567045115403066'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/05/update-of-anirecsynthf-and.html' title='Update of anirec_synth.f and anirec_synth_circle.f'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7344466674005485254</id><published>2008-03-24T18:46:00.003-04:00</published><updated>2008-03-24T18:50:12.266-04:00</updated><title type='text'>The erstwhile version of aniprop.f has had a bugfix</title><content type='html'>The erstwhile version of aniprop.f that was (is?) available on my website has been superceded by an all-in-one version that computes dispersion curves and synthetic seismograms all in one program. Adapted and debugged on an Intel Mac in gnu fortran. &lt;br /&gt;&lt;br /&gt;http://earth.geology.yale.edu/~jjpark/Code/aniprop_072307.f&lt;br /&gt;&lt;br /&gt;after a bugfix is now&lt;br /&gt;&lt;br /&gt;http://earth.geology.yale.edu/~jjpark/Code/aniprop_032408.f&lt;br /&gt;&lt;br /&gt;The code computes surface wave modes at evenly-spaced frequency points between 0 and 0.5 Hz. You can change this by tinkering with the code. It computes synthetics for a source at a specified downrange distance and depth, and plots them using PLOTIT. The dispersion values are output to files out_cvel and out_gvel (phase and group velocities, natch), and the synthetics are written out to SAC-format files.&lt;br /&gt;&lt;br /&gt;The bugfix concerned a LU-decomposition with partial pivoting that could fail in cases where the radial and transverse components of motion in a layered structure were totally uncoupled e.g., isotropic media, or media in which the axis of symmetry for anisotropy had strike angle phi=0.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7344466674005485254?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/aniprop_032408.f' title='The erstwhile version of aniprop.f has had a bugfix'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7344466674005485254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7344466674005485254&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7344466674005485254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7344466674005485254'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2008/03/erstwhile-version-of-anipropf-has-had.html' title='The erstwhile version of aniprop.f has had a bugfix'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8709002888927086641</id><published>2007-12-06T12:49:00.001-05:00</published><updated>2007-12-06T12:50:40.041-05:00</updated><title type='text'>plotting script for rfmig_cboot.f and rfmig_mcboot.f output WITH UNCERTAINTIES</title><content type='html'># ./Plotj_cexp outr_cexp.grid outr1_cexp.grid outr2_cexp.grid  outt_cexp.grid outt1_cexp.grid  outt2_cexp.grid 0.15 KEG&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;# rfmig_cboot.f or rfmig_mcboot.f&lt;br /&gt;# Input - $1 - mean R+T $2 lower R+T $3 upper R+T $4 mean R-T $5 lower R-T $6 upper R-T $7 scale  $8 TITLE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8709002888927086641?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/Plotj_cexp' title='plotting script for rfmig_cboot.f and rfmig_mcboot.f output WITH UNCERTAINTIES'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8709002888927086641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8709002888927086641&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8709002888927086641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8709002888927086641'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/plotting-script-for-rfmigcbootf-and_06.html' title='plotting script for rfmig_cboot.f and rfmig_mcboot.f output WITH UNCERTAINTIES'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-482409246228422716</id><published>2007-12-06T12:47:00.000-05:00</published><updated>2007-12-06T12:48:40.343-05:00</updated><title type='text'>plotting script for rfmig_boot.f and rfmig_mboot.f output WITH UNCERTAINTIES</title><content type='html'># ../Plotj_bexp outr_bexp.grid outr1_bexp.grid outr2_bexp.grid outt_bexp.grid outt1_bexp.grid outt2_bexp.grid  0.3 title&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;# rfmig_cboot.f or rfmig_mcboot.f&lt;br /&gt;# Input - $1 - mean R $2 lower R $3 upper R $4 mean T $5 lower T $6 upper T $7 scale $8 TITLE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-482409246228422716?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/Plotj_bexp' title='plotting script for rfmig_boot.f and rfmig_mboot.f output WITH UNCERTAINTIES'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/482409246228422716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=482409246228422716&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/482409246228422716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/482409246228422716'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/plotting-script-for-rfmigbootf-and_06.html' title='plotting script for rfmig_boot.f and rfmig_mboot.f output WITH UNCERTAINTIES'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6838953972291884388</id><published>2007-12-06T12:46:00.000-05:00</published><updated>2007-12-06T12:47:09.550-05:00</updated><title type='text'>plotting script for rfmig_cboot.f and rfmig_mcboot.f output</title><content type='html'>#../Plot_cexp outr_cexp.grid outt_cexp.grid 0.15  KEG&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;# rfmig_cboot.f or rfmig_mcboot.f&lt;br /&gt;#Input - $1 - file name $2 file name $3 - scale   $4 TITLE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6838953972291884388?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/Plot_cexp' title='plotting script for rfmig_cboot.f and rfmig_mcboot.f output'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6838953972291884388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6838953972291884388&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6838953972291884388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6838953972291884388'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/plotting-script-for-rfmigcbootf-and.html' title='plotting script for rfmig_cboot.f and rfmig_mcboot.f output'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6021499785274237385</id><published>2007-12-06T12:43:00.000-05:00</published><updated>2007-12-06T12:46:10.479-05:00</updated><title type='text'>plotting script for rfmig_boot.f and rfmig_mboot.f output</title><content type='html'>#../Plot_bexp outr_bexp.grid outt_bexp.grid 0.15 KEG &lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;# rfmig_boot.f or rfmig_mboot.f&lt;br /&gt;#Input - $1 - file name $2 file name $3 - scale   $4 TITLE&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6021499785274237385?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/Plot_bexp' title='plotting script for rfmig_boot.f and rfmig_mboot.f output'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6021499785274237385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6021499785274237385&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6021499785274237385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6021499785274237385'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/plotting-script-for-rfmigbootf-and.html' title='plotting script for rfmig_boot.f and rfmig_mboot.f output'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6552701784725028973</id><published>2007-12-04T23:57:00.000-05:00</published><updated>2007-12-04T23:59:36.167-05:00</updated><title type='text'>rfmig_mcboot.f -- code to compute complex-valued RF harmonic expansion in back-azimuth, moving-window moveout correction</title><content type='html'>c  computes moving-window moveout correction for MTC receiver functions &lt;br /&gt;c  applied in the frequency domain.&lt;br /&gt;c  requires a stacking model in the anirec format&lt;br /&gt;c  such a model may have anisotropy parameters, &lt;br /&gt;c  but migration code only uses the isotropic velocities. &lt;br /&gt;c&lt;br /&gt;c  code computes frequency-domain stacks of receiver functions that follow a harmonic expansion in baz&lt;br /&gt;c  for both radial and transverse RFs there are constant terms and sin/cos terms for 2- and 4-lobed&lt;br /&gt;c  amplitude dependence.  The constant term should be zero for the transverse RF.  &lt;br /&gt;c  The 2-lobed terms govern dipping interface effects and tilted symmetry-axis ansotropy. &lt;br /&gt;c  The 4-lobed term is anisotropy with a horizontal axis&lt;br /&gt;c    The code regresses for the harmonic expansion, using combined radial/transverse stack&lt;br /&gt;c   bootstrap-resamples the data to estimate the &lt;br /&gt;c    uncertainty of the harmonic terms.&lt;br /&gt;c  &lt;br /&gt;c   output files are  out[rt]_cexp.grid  -- harmonic-expansions of the RFs, in time domain&lt;br /&gt;c        out[rt]1_cexp.grid  -- harmonic-expansion RFs plus bootstrap uncertainty&lt;br /&gt;c        out[rt]2_cexp.grid  -- harmonic-expansion RFs minus bootstrap uncertainty&lt;br /&gt;c        out[rt]_bbaz.grid  -- harmonic-expansion RFs computed for ordered baz values&lt;br /&gt;c&lt;br /&gt;c  has kluge to cheat the pre-event noise for synthetic records  3/12/00 JJP&lt;br /&gt;c  check to see if the kluge is commented out&lt;br /&gt;c&lt;br /&gt;c  this version of the RF code reads a file of data filenames &lt;br /&gt;c  you have two choices: either read the time intervals in the filename file&lt;br /&gt;c  or read them in the sac header&lt;br /&gt;c  the data must be binary SAC format&lt;br /&gt;c  horizontals must be rotated to radial and transverse&lt;br /&gt;&lt;br /&gt;nboot=0:  compute simple regression, no bootstrap computation  of variance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6552701784725028973?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/rfmig_mcboot.f' title='rfmig_mcboot.f -- code to compute complex-valued RF harmonic expansion in back-azimuth, moving-window moveout correction'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6552701784725028973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6552701784725028973&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6552701784725028973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6552701784725028973'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/rfmigmcbootf-code-to-compute-complex.html' title='rfmig_mcboot.f -- code to compute complex-valued RF harmonic expansion in back-azimuth, moving-window moveout correction'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8212690744280437872</id><published>2007-12-04T23:54:00.000-05:00</published><updated>2007-12-04T23:57:19.097-05:00</updated><title type='text'>rfmig_mboot.f -- code to compute RF harmonic expansion in back-azimuth, moving-window moveout correction</title><content type='html'>c  program rfmig_mboot&lt;br /&gt;c  10/12/04 JJP -- adapted from rfmigrate&lt;br /&gt;c&lt;br /&gt;c  xf77 -o /park/backup/bin/rfmig_mboot rfmig_mboot.f /park/backup/Plotxy/plotlib.a /park/backup/Ritz/eislib.a /park/backup/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/rfmig_mboot rfmig_mboot.f /Users/jjpark/Plotxy/plotlib.a /Users/jjpark/Ritz/eislib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c&lt;br /&gt;c  computes moving-window moveout correction for MTC receiver functions &lt;br /&gt;c  applied in the frequency domain.&lt;br /&gt;c  requires a stacking model in the anirec format&lt;br /&gt;c  such a model may have anisotropy parameters, &lt;br /&gt;c  but migration code only uses the isotropic velocities. &lt;br /&gt;c&lt;br /&gt;c   nboot=0 -- only compute a single regression for RF harmonic expansion --&gt; no bootstrap uncertainty estimate&lt;br /&gt;c&lt;br /&gt;c  code computes frequency-domain stacks of receiver functions that follow a harmonic expansion in baz&lt;br /&gt;c  for both radial and transverse RFs there are constant terms and sin/cos terms for 2- and 4-lobed&lt;br /&gt;c  amplitude dependence.  The constant term should be zero for the transverse RF.  &lt;br /&gt;c  The 2-lobed terms govern dipping interface effects and tilted symmetry-axis ansotropy. &lt;br /&gt;c  The 4-lobed term is anisotropy with a horizontal axis&lt;br /&gt;c    The code regresses for the harmonic expansion, and bootstrap-resamples the data to estimate the &lt;br /&gt;c    uncertainty of the harmonic terms.&lt;br /&gt;c  &lt;br /&gt;c   output files are  out[rt]_bexp.grid  -- harmonic-expansions of the RFs, in time domain&lt;br /&gt;c        out[rt]1_bexp.grid  -- harmonic-expansion RFs plus bootstrap uncertainty&lt;br /&gt;c        out[rt]2_bexp.grid  -- harmonic-expansion RFs minus bootstrap uncertainty&lt;br /&gt;c        out[rt]_bbaz.grid  -- harmonic-expansion RFs computed for ordered baz values&lt;br /&gt;c&lt;br /&gt;c  has kluge to cheat the pre-event noise for synthetic records  3/12/00 JJP&lt;br /&gt;c  check to see if the kluge is commented out&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8212690744280437872?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/rfmig_mboot.f' title='rfmig_mboot.f -- code to compute RF harmonic expansion in back-azimuth, moving-window moveout correction'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8212690744280437872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8212690744280437872&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8212690744280437872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8212690744280437872'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/rfmigmbootf-code-to-compute-rf-harmonic.html' title='rfmig_mboot.f -- code to compute RF harmonic expansion in back-azimuth, moving-window moveout correction'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4564515085504654062</id><published>2007-12-02T22:31:00.000-05:00</published><updated>2007-12-02T22:34:37.480-05:00</updated><title type='text'>rfmig_cboot.f  -- code to compute harmonic expansion of RFs with back-azimuth</title><content type='html'>c  code computes frequency-domain stacks of receiver functions that follow a harmonic expansion in baz&lt;br /&gt;c  for both radial and transverse RFs there are constant terms and sin/cos terms for 2- and 4-lobed&lt;br /&gt;c  amplitude dependence.  The constant term should be zero for the transverse RF.  &lt;br /&gt;c  The 2-lobed terms govern dipping interface effects and tilted symmetry-axis ansotropy. &lt;br /&gt;c  The 4-lobed term is anisotropy with a horizontal axis&lt;br /&gt;c    The code regresses for the harmonic expansion, and bootstrap-resamples the data to estimate the &lt;br /&gt;c    uncertainty of the harmonic terms.&lt;br /&gt;c  &lt;br /&gt;c   output files are  out[rt]_cexp.grid  -- harmonic-expansions of the RFs, in time domain&lt;br /&gt;c        out[rt]1_cexp.grid  -- harmonic-expansion RFs plus bootstrap uncertainty&lt;br /&gt;c        out[rt]2_cexp.grid  -- harmonic-expansion RFs minus bootstrap uncertainty&lt;br /&gt;c        out[rt]_bbaz.grid  -- harmonic-expansion RFs computed for ordered baz values&lt;br /&gt;c&lt;br /&gt;c  migrates MTC receiver functions in the frequency domain.&lt;br /&gt;c  requires a stacking model in the anirec format&lt;br /&gt;c  such a model may have anisotropy parameters, &lt;br /&gt;c  but migration code only uses the isotropic velocities. &lt;br /&gt;&lt;br /&gt;c  the output of this program is a least-square regression of RFs in the freq&lt;br /&gt;c  domain, with complex-valued coefficients for the &lt;br /&gt;c  constant, cos(baz)R+sin(baz)T, cos(baz)R-sin(baz)T,&lt;br /&gt;c           cos(2*baz)R+sin(2*baz)T, cos(2*baz)R-sin(2*baz)T variations&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4564515085504654062?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/rfmig_cboot.f' title='rfmig_cboot.f  -- code to compute harmonic expansion of RFs with back-azimuth'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4564515085504654062/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4564515085504654062&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4564515085504654062'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4564515085504654062'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/rfmigcbootf-code-to-compute-harmonic.html' title='rfmig_cboot.f  -- code to compute harmonic expansion of RFs with back-azimuth'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-2879598472103038687</id><published>2007-12-01T21:14:00.000-05:00</published><updated>2007-12-01T21:19:41.578-05:00</updated><title type='text'>rfmig_boot.f -- code to estimate harmonic expansion of RFs in back azimuth</title><content type='html'>c  code computes frequency-domain stacks of receiver functions that follow a harmonic expansion in baz&lt;br /&gt;c  for both radial and transverse RFs there are constant terms and sin/cos terms for 2- and 4-lobed&lt;br /&gt;c  amplitude dependence.  The constant term should be zero for the transverse RF.  &lt;br /&gt;c  The 2-lobed terms govern dipping interface effects and tilted symmetry-axis ansotropy. &lt;br /&gt;c  The 4-lobed term is anisotropy with a horizontal axis&lt;br /&gt;c    The code regresses for the harmonic expansion, and bootstrap-resamples the data to estimate the &lt;br /&gt;c    uncertainty of the harmonic terms.  The posted version only &lt;br /&gt;c  &lt;br /&gt;c   output files are  out[rt]_bexp.grid  -- harmonic-expansions of the RFs, in time domain&lt;br /&gt;c        out[rt]1_bexp.grid  -- harmonic-expansion RFs plus bootstrap uncertainty&lt;br /&gt;c        out[rt]2_bexp.grid  -- harmonic-expansion RFs minus bootstrap uncertainty&lt;br /&gt;c        out[rt]_bbaz.grid  -- harmonic-expansion RFs computed for ordered baz values&lt;br /&gt;c&lt;br /&gt;c  migrates MTC receiver functions in the frequency domain. &lt;br /&gt;c  requires a stacking model in the anirec format  (see previous posts on codes that apply &lt;br /&gt;c  a frequency-domain moveout correction for the variation of Ps delay time with epicentral distance.)&lt;br /&gt;c  such a model may have anisotropy parameters, &lt;br /&gt;c  but migration code only uses the isotropic velocities. &lt;br /&gt;c&lt;br /&gt;c  has kluge to cheat the pre-event noise for synthetic records  3/12/00 JJP&lt;br /&gt;c  check to see if the kluge is commented out&lt;br /&gt;c&lt;br /&gt;c  this version of the RF code reads a file of data filenames &lt;br /&gt;c  you have two choices: either read the time intervals in the filename file&lt;br /&gt;c  or read them in the sac header&lt;br /&gt;c  the data must be binary SAC format&lt;br /&gt;c  horizontals must be rotated to radial and transverse&lt;br /&gt;c&lt;br /&gt;c  for start times in the file:&lt;br /&gt;c  the file is "in_recfunk" and has lines of the form:&lt;br /&gt;c&lt;br /&gt;c  1997.070.19.33.bh?  &lt;-- code replaces ? with r,t,z&lt;br /&gt;c  57 52         &lt;-- start time of analysis window, window duration (sec)&lt;br /&gt;c  1997.076.08.15.bh?&lt;br /&gt;c  62 62 &lt;br /&gt;c  ...&lt;br /&gt;c  ...&lt;br /&gt;c  ...&lt;br /&gt;c  stop                &lt;-- tells code that data is finished, 799 events max&lt;br /&gt;c&lt;br /&gt;c&lt;br /&gt;c  for start times in the SAC header&lt;br /&gt;c  reads seismic record start times from the sac header&lt;br /&gt;c  will search the SAC header for specific markers of P phases&lt;br /&gt;c  T1 - P, Pdiff    ahead(12)&lt;br /&gt;c  T2 - PKP,PKIKP   ahead(13)&lt;br /&gt;c  T3 - PP          ahead(14)&lt;br /&gt;c  T1=T2=T3=0 ==&gt; use original A-marker ahead(9)&lt;br /&gt;c&lt;br /&gt;c   code does NOT combine data with different sample rates&lt;br /&gt;c  data files limited to 99K pnts. To increase, see common block /datastuff/&lt;br /&gt;c&lt;br /&gt;c   many intermediate quantities are plotted with PLOTIT as the code proceeds.&lt;br /&gt;c  other intermediate quantities can be plotted by uncommenting calls to PLOTIT&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-2879598472103038687?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/rfmig_boot.f' title='rfmig_boot.f -- code to estimate harmonic expansion of RFs in back azimuth'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/2879598472103038687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=2879598472103038687&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/2879598472103038687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/2879598472103038687'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/rfmigbootf-code-to-estimate-harmonic.html' title='rfmig_boot.f -- code to estimate harmonic expansion of RFs in back azimuth'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7340642982947689408</id><published>2007-12-01T21:11:00.000-05:00</published><updated>2007-12-01T21:12:57.864-05:00</updated><title type='text'>anirec_synth_circle.f -- make P-coda synthetics at evenly-spaced back azimuth and constant epicentral distance</title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7340642982947689408?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/anirec_synth_circle.f' title='anirec_synth_circle.f -- make P-coda synthetics at evenly-spaced back azimuth and constant epicentral distance'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7340642982947689408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7340642982947689408&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7340642982947689408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7340642982947689408'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/anirecsynthcirclef-make-p-coda.html' title='anirec_synth_circle.f -- make P-coda synthetics at evenly-spaced back azimuth and constant epicentral distance'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3399457055356736210</id><published>2007-12-01T21:03:00.000-05:00</published><updated>2007-12-01T21:14:29.303-05:00</updated><title type='text'>anirec_synth.f   --- a code to compute synthetic P coda from a collection of SAC-format data</title><content type='html'>c  anirec_synth - anirec to compute synthetics for a specified model and&lt;br /&gt;c  a specified collection of seismic records (read from in_recpick-format file of filenames)&lt;br /&gt;c  modified to accept SACfiles with start time info in the header, in A-marker (ahead(9)) &lt;br /&gt;c  because the timing information is not used, the value of A-marker is not important.&lt;br /&gt;c  However, in the synthetics, the A-marker and the T1-marker (or T2) variables in the header are set to 5.0 seconds&lt;br /&gt;c  for easy analysis by recfunk codes that use the header information for timing.&lt;br /&gt;c  code divides between T1 (P) or T2 (PKP) markers based on epicentral distance, with 120 degrees the divide&lt;br /&gt;c  the synthetic files are s_filename.bh[zrt], where filename is the name of the datafile.&lt;br /&gt;c  the code writes in_recpick_synth, a list of the filenames for recfunk_pick and other recfunk codes that&lt;br /&gt;c  expect the start time in the SAC header&lt;br /&gt;c&lt;br /&gt;&lt;br /&gt;The goal of this code is to generate P-coda form a specified model to replicate the earthquake distribution of a real data set.  This allows the analyst to test whether the oddities in an RF sweep are likely caused by an imperfect data distribution, or by a shortcoming of his/her model.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3399457055356736210?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/anirec_synth.f' title='anirec_synth.f   --- a code to compute synthetic P coda from a collection of SAC-format data'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3399457055356736210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3399457055356736210&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3399457055356736210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3399457055356736210'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/12/anirecsynthf-code-to-compute-synthetic.html' title='anirec_synth.f   --- a code to compute synthetic P coda from a collection of SAC-format data'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-5939746699184836236</id><published>2007-08-22T11:28:00.000-04:00</published><updated>2007-08-22T11:54:29.088-04:00</updated><title type='text'>recfunk_mwms.f  --  moving-window migration that splices together a long RF from a series of target depths</title><content type='html'>This code can be accessed by clicking the title link&lt;br /&gt;&lt;br /&gt;recfunk_mwms.f generates a succession of RF estimates for a succession of migration target depths.  It splices together the results into a long RF.  I have used this code to reconstruct BAZ-sweeps of RFs from 0 to 75-s delay, encompassing the crust to the 660-km discontinuity.&lt;br /&gt;&lt;br /&gt;This code will warm your laptop.  For a splice from 0 to 680 depth, targeted every 40 km with 524 events, my Macbook Pro required 15 minutes of run time.&lt;br /&gt;&lt;br /&gt;INPUT      &lt;br /&gt;'velocity model for stacking (blank = stack_model)'&lt;br /&gt;'depth range and inc for the RFs (km) (dep1,dep2,ddep)'&lt;br /&gt;'enter fmax (Hz)' &lt;br /&gt;'time intervals in file (0) or in SAC-header (1)'&lt;br /&gt;'file of seismic records to read? (space-ret: in_recpick)' &lt;br /&gt;'duration of data windows for analysis'&lt;br /&gt;'minimum number of events in a binsum (eg 1 or 2)'&lt;br /&gt;'rotate to LQT coordinates to isolate P and SV? (0=no)'&lt;br /&gt;&lt;br /&gt;---&gt;&gt; then the first pass through the seismic data -- typically for target depth = 0 km.&lt;br /&gt;&lt;br /&gt;'change baz-interval or baz-spacing? (1=yes)'&lt;br /&gt;'enter back-azimuth range: bazmax, bazmin, bazinc'&lt;br /&gt;&lt;br /&gt;---&gt;&gt; compute the BAZ-interval binsums&lt;br /&gt;&lt;br /&gt;'compute RFs binned with epicentral distance: enter back-azimuth limits ib1,ib2 (integers!)'&lt;br /&gt;' do you want to change 'epicentral spacing? (1=yes)'&lt;br /&gt;'enter delta range and spacing (ep1,ep2,dep)'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then Computer code takes off, remembering the binsum parameters for successive target depths.&lt;br /&gt;&lt;br /&gt;OUTPUT&lt;br /&gt;&lt;br /&gt;grid files for short interval of time around each target depth  NNN-km&lt;br /&gt;&lt;br /&gt;out[rt]_baz_NNN.grid, out[rt]_epi_NNN.grid&lt;br /&gt;&lt;br /&gt;grid file for spliced baz- and epicen-sweeps&lt;br /&gt;&lt;br /&gt;ous[rt]_baz.grid, ous[rt]_epi.grid&lt;br /&gt;&lt;br /&gt;You can plot these files with the posted GMT scripts, after adjusting the BOX variable to change plot limits.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-5939746699184836236?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/recfunk_mwms.f' title='recfunk_mwms.f  --  moving-window migration that splices together a long RF from a series of target depths'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/5939746699184836236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=5939746699184836236&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5939746699184836236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5939746699184836236'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/blog-post_22.html' title='recfunk_mwms.f  --  moving-window migration that splices together a long RF from a series of target depths'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3747843664728101354</id><published>2007-08-20T15:54:00.000-04:00</published><updated>2007-08-20T15:57:58.215-04:00</updated><title type='text'>recfunk_mwmj.f -- moving-window moveout RF estimation with jackknife uncertainty on the bin-sums</title><content type='html'>c  program recfunk_mwmj&lt;br /&gt;c  6/3/04 JJP  --- UPDATED 08/20/07 JJP&lt;br /&gt;c  MIGRATION/MOVEOUT variant to compute cross-correlation in a moving time window&lt;br /&gt;c  This version performs a jackknife uncertainty estimate of bin-summed RFs&lt;br /&gt;c&lt;br /&gt;c  you tell the program the depth at which you want to focus the cross-correlation&lt;br /&gt;c  and it computes the moving-window delay from an input model&lt;br /&gt;c  using the epicentral distance to look up the horizontal slowness&lt;br /&gt;&lt;br /&gt;c  the code writes the BAZ- and EPICEN-dependent RFs to files&lt;br /&gt;c  in a format easily digested by GMT (traces are separated by "&gt;" lines)&lt;br /&gt;c&lt;br /&gt;c  filenames: out[rt]_baz_NNN.grid out[rt]_epi_NNN.grid &lt;br /&gt;c  where NNN corresponds to the target depth in kilometers&lt;br /&gt;c  jackknife uncertainty envelope (lower) out[rt]1_baz_NNN.grid out[rt]1_epi_NNN.grid&lt;br /&gt;c  jackknife uncertainty envelope (upper) out[rt]2_baz_NNN.grid out[rt]2_epi_NNN.grid&lt;br /&gt;c&lt;br /&gt;c  these files are overwritten everytime you run the program&lt;br /&gt;c  so rename them to save them&lt;br /&gt;c&lt;br /&gt;c use the GMT scripts in the previous few blog posts for plotting these files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3747843664728101354?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/recfunk_mwmj.f' title='recfunk_mwmj.f -- moving-window moveout RF estimation with jackknife uncertainty on the bin-sums'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3747843664728101354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3747843664728101354&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3747843664728101354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3747843664728101354'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/blog-post.html' title='recfunk_mwmj.f -- moving-window moveout RF estimation with jackknife uncertainty on the bin-sums'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4731554874756281952</id><published>2007-08-20T15:38:00.000-04:00</published><updated>2007-08-20T15:40:07.229-04:00</updated><title type='text'>GMT shellscript syntax that is not showing up in the blog posts  CAVEAT EMPTOR</title><content type='html'>NOTE -- there is a bit of shellscript syntax that is not showing up in the blog post.  There is a shell command&lt;br /&gt;&lt;br /&gt;process leftangle-leftangle END rightangle-rightangle plot.ps&lt;br /&gt;&lt;br /&gt;that instructs "process" to read the succeeding lines of data until it reaches a line that contains just "END"&lt;br /&gt;In my blog posts the phrase "leftangle-leftangle END rightangle-rightangle" is printing as "leftangle-rightangle"&lt;br /&gt;&lt;br /&gt;So you must correct these lines for the shellscripts to work&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4731554874756281952?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4731554874756281952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4731554874756281952&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4731554874756281952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4731554874756281952'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/gmt-shellscript-syntax-that-is-not.html' title='GMT shellscript syntax that is not showing up in the blog posts  CAVEAT EMPTOR'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3673440866482527635</id><published>2007-08-20T14:59:00.001-04:00</published><updated>2007-08-20T15:35:03.090-04:00</updated><title type='text'>GMT script for the moving-window with jackknife uncertainty -- epicentral bin-sums</title><content type='html'>NOTE -- there is a bit of shellscript syntax that is not showing up in the blog post.  There is a shell command&lt;br /&gt;&lt;br /&gt;process leftangle-leftangle END rightangle-rightangle plot.ps&lt;br /&gt;&lt;br /&gt;that instructs "process" to read the succeeding lines of data until it reaches a line that contains just "END"&lt;br /&gt;In my blog posts the phrase "leftangle-leftangle END rightangle-rightangle" is printing as "leftangle-rightangle"&lt;br /&gt;&lt;br /&gt;So you must correct these lines for the shellscripts to work&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/csh -f&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;#spectral coherence code of JP, arranged by BAZ&lt;br /&gt;#Input - $1 $2 $3 - radial RF filenames $4 $5 $6 transverse RF filenames $7 - scale $8 title&lt;br /&gt;# filenames are for mean RF estimate, and lower and upper jackknife uncertainty bounds on the RF estimate&lt;br /&gt;# the script uses PS wiggle to draw a green envelope that represents the uncertainty range&lt;br /&gt;# Then plots the mean RF estimate within the green uncertainty&lt;br /&gt;# two calls to pswiggle for each jackknife file allow the "certain" RF excursion to be red or blue&lt;br /&gt;&lt;br /&gt;echo "EDIT PLOTTING PARAMETERS TO SUIT YOUR DATA"&lt;br /&gt;set BOX = -R-12/12/0/180&lt;br /&gt;set FRAME = -JX3/7.5&lt;br /&gt;set FRAME_BIG = -JX3/9.4&lt;br /&gt;&lt;br /&gt;/bin/rm plot.ps&lt;br /&gt;&lt;br /&gt;set scale = $7&lt;br /&gt;&lt;br /&gt;set title = $8&lt;br /&gt;&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G200/255/200 -Ba4f1/f30\SWen -P -K &gt; plot.ps&lt;br /&gt;pswiggle $3 $FRAME $BOX -Z$scale -M -G200/255/200 -N -Ba4f1/f30\Swen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;pswiggle $3 $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/f30\SWen -P -K -O &gt;&gt; plot.ps&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/f30\Swen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 CT $1 scale $7 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 180&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 180&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 180&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;pswiggle $5 $FRAME $BOX -Z$scale -M -G200/255/200 -Ba4f1/f30\SwEn -P -O -K -X3.5 &gt;&gt; plot.ps&lt;br /&gt;pswiggle $6 $FRAME $BOX -Z$scale -M -G200/255/200 -N -Ba4f1/f30\SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;pswiggle $6 $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/f30\SwEn -P -O -K &gt;&gt; plot.ps&lt;br /&gt;pswiggle $5 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/f30\SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle $4 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 CT $4 scale $7 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;echo -2.5 2.7 24 0 5 LT $8 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 180&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 180&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 180&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O  &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;echo gv is JPark's alias for ghostscript&lt;br /&gt;gv plot.ps&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3673440866482527635?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3673440866482527635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3673440866482527635&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3673440866482527635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3673440866482527635'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/gmt-script-for-moving-window-with_20.html' title='GMT script for the moving-window with jackknife uncertainty -- epicentral bin-sums'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7563940032108061412</id><published>2007-08-20T14:50:00.000-04:00</published><updated>2007-08-20T14:59:12.782-04:00</updated><title type='text'>GMT script for the moving-window with jackknife uncertainty -- back-azimuth bin-sums</title><content type='html'>#!/bin/csh -f&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;#spectral coherence code of JP, arranged by BAZ&lt;br /&gt;#Input - $1 $2 $3 - radial RF filenames $4 $5 $6 transverse RF filenames $7 - scale $8 title&lt;br /&gt;# filenames are for mean RF estimate, and lower and upper jackknife uncertainty bounds on the RF estimate&lt;br /&gt;# the script uses PS wiggle to draw a green envelope that represents the uncertainty range&lt;br /&gt;# Then plots the mean RF estimate within the green uncertainty&lt;br /&gt;# two calls to pswiggle for each jackknife file allow the "certain" RF excursion to be red or blue&lt;br /&gt;&lt;br /&gt;echo "EDIT PLOTTING PARAMETERS TO SUIT YOUR DATA"&lt;br /&gt;set BOX = -R-12/12/-5/365&lt;br /&gt;set FRAME = -JX3/7.5&lt;br /&gt;set FRAME_BIG = -JX3/9.4&lt;br /&gt;&lt;br /&gt;/bin/rm plot.ps&lt;br /&gt;&lt;br /&gt;set scale = $7&lt;br /&gt;&lt;br /&gt;set title = $8&lt;br /&gt;gmtset ANOT_FONT Times-Roman HEADER_FONT Times-Roman LABEL_FONT Times-Roman &lt;br /&gt;&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G200/255/200 -Ba4f1/f30\SWen -P -K &gt; plot.ps&lt;br /&gt;pswiggle $3 $FRAME $BOX -Z$scale -M -G200/255/200 -N -Ba4f1/f30\Swen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;pswiggle $3 $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/f30\SWen -P -K -O &gt;&gt; plot.ps&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/f30\Swen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 CT $1 scale $7 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 380&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;pswiggle $5 $FRAME $BOX -Z$scale -M -G200/255/200 -Ba4f1/f30\SwEn -P -O -K -X3.5 &gt;&gt; plot.ps&lt;br /&gt;pswiggle $6 $FRAME $BOX -Z$scale -M -G200/255/200 -N -Ba4f1/f30\SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;pswiggle $6 $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/f30\SwEn -P -O -K &gt;&gt; plot.ps&lt;br /&gt;pswiggle $5 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/f30\SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle $4 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 CT $4 scale $7 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;echo -2.5 2.7 24 0 5 LT $8 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O  &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 380&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;echo gv is JPark's alias for ghostview&lt;br /&gt;gv plot.ps $&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7563940032108061412?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7563940032108061412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7563940032108061412&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7563940032108061412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7563940032108061412'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/gmt-script-for-moving-window-with.html' title='GMT script for the moving-window with jackknife uncertainty -- back-azimuth bin-sums'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6352759513205693861</id><published>2007-08-20T13:41:00.000-04:00</published><updated>2007-08-20T13:43:57.846-04:00</updated><title type='text'>stacking model example</title><content type='html'>stacking model example (used for GSN Station RAYN) 4 layers over a halfspace&lt;br /&gt;4&lt;br /&gt;50 145&lt;br /&gt;5000 5500 -0.06 0 3070 -0.06 2700&lt;br /&gt;0 0&lt;br /&gt;8000 6350 0 0 3494 0 2700&lt;br /&gt;0 0 &lt;br /&gt;21000 6420 0.02 0 3510 0.02 2700&lt;br /&gt;0 0 &lt;br /&gt;40000 6930 0.03 0 3804 0.03 2700&lt;br /&gt;0 0&lt;br /&gt;220000 7900 -0.15 0 4300 -0.15 3350&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6352759513205693861?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6352759513205693861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6352759513205693861&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6352759513205693861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6352759513205693861'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/stacking-model-example.html' title='stacking model example'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8616842245865060904</id><published>2007-08-20T13:26:00.000-04:00</published><updated>2007-08-20T13:27:24.303-04:00</updated><title type='text'>GMT script for plotting epicentral RF sweep from moving-window-moveout grid files</title><content type='html'>#!/bin/csh -f&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;#spectral coherence code of JP, arranged by EPI&lt;br /&gt;#Input - $1: radialRF filename; $2: tranvRF filename; $3: scale;  $4: TITLE&lt;br /&gt;# e.g.    ./Plot_epi outr_epi.grid outt_epi.grid  0.5  RAYN_2.0Hz&lt;br /&gt;# the scale parameter has inverse dependence -- larger scale = smaller wiggles&lt;br /&gt;#  The first bit of business is to re-order the traces&lt;br /&gt;&lt;br /&gt;/bin/rm wigtab? tmp?  plot.ps&lt;br /&gt;&lt;br /&gt;echo standard usage&lt;br /&gt;echo  "./Plot_epi outr_epi.grid outt_epi.grid  0.5  RAYN_2.0Hz"&lt;br /&gt;echo "EDIT PLOTTING PARAMETERS TO SUIT YOUR DATA"&lt;br /&gt;set BOX = -R-10/10/0/180&lt;br /&gt;set FRAME = -JX3/7.5&lt;br /&gt;set FRAME_BIG = -JX3/9.4&lt;br /&gt;&lt;br /&gt;awk '{print $2}' $1 | sort -u -n &gt; bazlist&lt;br /&gt;foreach i ( `cat bazlist` )&lt;br /&gt;echo working on $i&lt;br /&gt;awk '$2 == A &amp;&amp; $1 &gt;= -10' A=$i $1 &gt;&gt; wigtabR&lt;br /&gt;awk '$2 == A &amp;&amp; $1 &gt;= -10' A=$i $2 &gt;&gt; wigtabT&lt;br /&gt;&lt;br /&gt;#in case you decide to demean...&lt;br /&gt;#awk '$2 == A &amp;&amp; $1 &gt;= -2' A=$i $1 &gt; tmp1&lt;br /&gt;#set mean = `awk '{a+=$3} END {print a/NR}' tmp1 `&lt;br /&gt;#echo baz $i mean $mean &lt;br /&gt;#awk '{print $1,$2,$3-mn}' mn=$mean tmp1 &gt;&gt; wigtab&lt;br /&gt;&lt;br /&gt;echo "&gt;" &gt;&gt; wigtabR&lt;br /&gt;echo "&gt;" &gt;&gt; wigtabT&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;set scale = $3&lt;br /&gt;pswiggle wigtabR $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/a30/SWen -P -K &gt; plot.ps&lt;br /&gt;pswiggle wigtabR $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/a30f15/SWen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle wigtabR $FRAME $BOX -Z$scale -W1p/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 6 $1 scale $3 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 180&lt;br /&gt;END&lt;br /&gt;# psxy dipping_6.5_3.6_43_15_20.dat -: $FRAME $BOX -W1.5p/255/0/0 -O -K  &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;pswiggle wigtabT $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/a30/SwEn -P -O -K -X3.5 &gt;&gt; plot.ps&lt;br /&gt;pswiggle wigtabT $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/a30f15/SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle wigtabT $FRAME $BOX -Z$scale -W1p/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 6 $2 scale $3 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;echo -2.5 2.7 24 0 5 LT $4 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O  &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;gv plot.ps &amp;&lt;br /&gt;echo  gv is aliased by JPark to ghostview&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8616842245865060904?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8616842245865060904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8616842245865060904&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8616842245865060904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8616842245865060904'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/gmt-script-for-plotting-epicentral-rf.html' title='GMT script for plotting epicentral RF sweep from moving-window-moveout grid files'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-325916435838357389</id><published>2007-08-20T13:22:00.000-04:00</published><updated>2007-08-20T13:24:45.301-04:00</updated><title type='text'>GMT script for plotting backazimuthal RF sweep from moving-window-moveout grid files</title><content type='html'>#!/bin/csh -f&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;#spectral coherence code of JP, arranged by BAZ&lt;br /&gt;#Input - $1: radialRF filename; $2: tranvRF filename; $3: scale;  $4: TITLE&lt;br /&gt;# e.g.    ./Plot_baz outr_baz.grid outt_baz.grid  0.5  RAYN_2.0Hz&lt;br /&gt;# the scale parameter has inverse dependence -- larger scale = smaller wiggles&lt;br /&gt;&lt;br /&gt;echo "EDIT PLOTTING PARAMETERS TO SUIT YOUR DATA"&lt;br /&gt;# set BOX = -R25/65/-5/365&lt;br /&gt;set BOX = -R-10/10/-5/365&lt;br /&gt;set FRAME = -JX3/7.5&lt;br /&gt;set FRAME_BIG = -JX3/9.4&lt;br /&gt;&lt;br /&gt;/bin/rm plot.ps&lt;br /&gt;&lt;br /&gt;set scale = $3&lt;br /&gt;&lt;br /&gt;set title = $4&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -M -G0/0/255  -P -K &gt; plot.ps&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/30/SWen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 CT $1 scale $3 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 380&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G0/0/255 -P -O -K -X3.5 &gt;&gt; plot.ps&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/30/SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 CT $2 scale $3 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;echo -1.25 2.7 24 0 5 CT $4 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O  &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 380&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;gv plot.ps &amp;  &lt;br /&gt;echo  gv is aliased by JPark to ghostview&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-325916435838357389?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/325916435838357389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=325916435838357389&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/325916435838357389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/325916435838357389'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/gmt-script-for-plotting-backazimuthal.html' title='GMT script for plotting backazimuthal RF sweep from moving-window-moveout grid files'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6961559671276396780</id><published>2007-08-20T13:03:00.000-04:00</published><updated>2007-08-20T13:22:38.685-04:00</updated><title type='text'>recfunk_mwm.f -- moving-window moveout</title><content type='html'>click the title of the post to access the code.&lt;br /&gt;&lt;br /&gt;This code applies a moveout correction by shifting the time window of the horizontal-component time series before DFT and multiple-taper spectral correlation.  The code prompts the user to specify a stacking model in the anirec format, and a target depth.  The code uses the phase type (P,PP or PKP) and epicentral distance to compute a predicted time that a Ps phase from the target depth should arrive.  The horizontal time series is shifted by this time, so that the RF at t=0 is the Ps pulse at the target depth.  The zero-time pulse on the radial RF associated with the direct P wave is shifted to negative times, and will often lose focus in back-azimuthal stacks.  The GMT script for plotting is similar to that used for other recfunk codes, but has a shifted X-axis to focus the eye on the signals at Ps delay-times both before and after the target Ps arrival.&lt;br /&gt;&lt;br /&gt;The code writes output files that flag the target depth:&lt;br /&gt;&lt;br /&gt;outr_baz_040.grid,outt_baz_040.grid,outr_epi_040.grid,outt_epi_040.grid&lt;br /&gt;&lt;br /&gt;where the integer 040 stands for a target depth of 40 km in the stacking model.  GMT scripts for plotting are executed this way:&lt;br /&gt;&lt;br /&gt;./Plot_baz outr_baz_040.grid outt_baz_040.grid 1. RAYN_mwm&lt;br /&gt;&lt;br /&gt;./Plot_epi outr_epi_040.grid outt_epi_040.grid 1. RAYN_mwm&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6961559671276396780?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/recfunk_mwm.f' title='recfunk_mwm.f -- moving-window moveout'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6961559671276396780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6961559671276396780&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6961559671276396780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6961559671276396780'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/recfunkmwmf-moving-window-moveout.html' title='recfunk_mwm.f -- moving-window moveout'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-248741862496542406</id><published>2007-08-19T21:11:00.000-04:00</published><updated>2007-08-19T21:16:59.216-04:00</updated><title type='text'>rfmigrate.f --  recfunk version with migration</title><content type='html'>Click the title of the post to access the code.&lt;br /&gt;&lt;br /&gt;Version of MTC RF estimation  that computes single-station RFs with 3 2.5-pi Slepian eigentapers, similar to recfunk_pick.f.  This code uses a migration scheme to align Ps pulses to the time expected for Ps from a vertical-incidence wave.  See comments for the rfmigrate_estack code, posted yesterday (August 18, 2007).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-248741862496542406?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/rfmigrate.f' title='rfmigrate.f --  recfunk version with migration'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/248741862496542406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=248741862496542406&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/248741862496542406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/248741862496542406'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/rfmigratef-recfunk-version-with.html' title='rfmigrate.f --  recfunk version with migration'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3172593792474840888</id><published>2007-08-19T09:07:00.000-04:00</published><updated>2007-08-19T09:17:31.455-04:00</updated><title type='text'>recfunk_svd.f  version of recfunk with SVD in the inner loop</title><content type='html'>click the title of post to obtain the code&lt;br /&gt;&lt;br /&gt;From unpublished manuscript on RF estimation:&lt;br /&gt;&lt;br /&gt;Receiver Functions from Multiple-Taper Spectral Correlation:&lt;br /&gt;Statistics, Single-Station Migration, and Jackknife Uncertainty&lt;br /&gt;J. Park and V. Levin, submitted to GJI&lt;br /&gt;&lt;br /&gt;RF-computation suggests that the coherence between P and SH-converted energy in the P coda is comparable to the coherence between P and SV-converted energy. Because aggregate coherence C(f)&lt; 0.5, one can question whether the SV and SH converted phases are mutually correlated. The alternative hypothesis is that SV and SH scattering arise from statistically distinct portions of the incoming P wave. Poor correlation between SV and SH scattering can be tested by simultaneous cross-correlation of all three particle-motion components, computed via the singular-value decomposition (SVD). Define a K ×3 matrix A(f) of eigenspectral estimates in the P-SV -SH coordinate system (in our application K = 3):&lt;br /&gt;&lt;br /&gt;For noise-free, perfectly correlated data, the matrix A(f) = u (f) &lt;outerproduct&gt; v(f), a single dyad in which the 3-component vector v(f) contains the correlation coefficients between components and the K-component vector u(f) describes the spectral signature of the correlated signal in a narrow frequency band about f. The receiver functions HSV (f),HSH(f) correspond to the component ratios vSV /vP and vSH/vP , where v(f) = [vP , vSV , vSH]. For real noisy data, we associate the SVD receiver function with the singular vectors of A that correspond to the largest singular value, similar to the ”pure state” filtering algorithm (Samson, 1983). We SVD decompose A(f). The uncertainty of the SVD receiver function can be estimated by analogy to uncertainties of RF computed from complex cross-correlation and coherence. &lt;br /&gt;&lt;br /&gt;In tests with real data, the added sophistication of the SVD receiver function algorithm leads only to small changes in the estimated RFs.  We infer that P-SV conversion and P-SH conversion in the P coda are co-dependent, in a statistical sense. It should therefore be feasible to estimate HSV (f) and HSH(f) jointly. On the other hand, our experiments suggest that the ordinary pairwise MTC RF estimator is adequate in practice. The SVD-based RF estimator may have utility in complex situations, such as the estimation of S receiver functions for S-to-P converted energy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3172593792474840888?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/recfunk_svd.f' title='recfunk_svd.f  version of recfunk with SVD in the inner loop'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3172593792474840888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3172593792474840888&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3172593792474840888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3172593792474840888'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/recfunksvdf-version-of-recfunk-with-svd.html' title='recfunk_svd.f  version of recfunk with SVD in the inner loop'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-5852041577453830312</id><published>2007-08-18T10:14:00.000-04:00</published><updated>2007-08-18T10:19:35.013-04:00</updated><title type='text'>rfmigrate_estack.f -- code to migrate the RFs in the frequency domain</title><content type='html'>Click the link to access the code.&lt;br /&gt;&lt;br /&gt;Long-time window event-stacking of RFs.  This code takes three swipes at the data.  First it does a normal event-stack without migration in back-azimuth bins (output files out[rt]_baz.grid).  Then a normal event-stack without migration in epicentral bins (output files out[rt]_epi.grid).   Lastly it does an event-stack with migration in back-azimuth bins (output files oum[rt]_baz.grid).&lt;br /&gt;For GMT scripts to plot these output files, see blog posts from July.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-5852041577453830312?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/rfmigrate_estack.f' title='rfmigrate_estack.f -- code to migrate the RFs in the frequency domain'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/5852041577453830312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=5852041577453830312&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5852041577453830312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5852041577453830312'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/rfmigrateestackf-code-to-migrate-rfs-in.html' title='rfmigrate_estack.f -- code to migrate the RFs in the frequency domain'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-1061327875853084295</id><published>2007-08-18T10:09:00.001-04:00</published><updated>2007-08-18T10:14:28.663-04:00</updated><title type='text'>ttimes_PKP.dat  -- accessory file for RF migration and moveout corrections</title><content type='html'>This file is used by RF migration and moveout codes (soon to be posted). It uses IASPEI traveltimes to scale the expected Ps traveltime delay as a function of epicentral distance for PKP/PKIKP. Numbers massaged from ttimes, the public code available from IRIS.  Click the title to access the file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-1061327875853084295?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/ttimes_PKP.dat' title='ttimes_PKP.dat  -- accessory file for RF migration and moveout corrections'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/1061327875853084295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=1061327875853084295&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1061327875853084295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1061327875853084295'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/ttimespkpdat-accessory-file-for-rf.html' title='ttimes_PKP.dat  -- accessory file for RF migration and moveout corrections'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7029842932164924487</id><published>2007-08-18T09:56:00.000-04:00</published><updated>2007-08-18T10:02:40.043-04:00</updated><title type='text'>ttimes_P.dat -- accessory file for receiver function moveout correction</title><content type='html'>This file is used by RF migration and moveout codes (soon to be posted).  It uses IASPEI traveltimes to scale the expected Ps traveltime delay as a function of epicentral distance for P and Pdiff.  Numbers massaged from ttimes, the public code available from IRIS.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7029842932164924487?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/ttimes_P.dat' title='ttimes_P.dat -- accessory file for receiver function moveout correction'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7029842932164924487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7029842932164924487&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7029842932164924487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7029842932164924487'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/ttimespdat-accessory-file-for-receiver.html' title='ttimes_P.dat -- accessory file for receiver function moveout correction'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6561507657338597696</id><published>2007-08-17T14:19:00.000-04:00</published><updated>2007-08-18T09:55:56.524-04:00</updated><title type='text'>recfunk_estack.f -- an event-stacking algorithm for RF with long delay times</title><content type='html'>Click the title to access the Fortran code.&lt;br /&gt;&lt;br /&gt;recfunk_estack is a version of the multiple taper correlation receiver-function estimator that allows the time-domain RF to extend to times longer than (roughly) T/10, where T is the duration of the analysis window.  Recfunk_estack does NOT apply a moveout or migration correction, so the ability to resolve Ps from deeper interfaces is limited.  Other codes to be posted soon will have these properties.&lt;br /&gt;&lt;br /&gt;The major shortcoming of the MTC RF estimator of Park &amp;  Levin (2000) is its difficulty retrieving Ps conversions at long delay times.  Receiver function studies of upper mantle structure at the base of the lithosphere and the transition zone involve Ps converted phases with delay times between 20 and 70 seconds (e.g., Bostock, 1998; Sheehan et al 2000), but the frequency averaging properties of the Slepian data tapers with time-bandwidth product p\ge 2 tends to limit typical RFs to delay times \tau&lt;20 s.&lt;br /&gt;&lt;br /&gt;Frequency averaging affords the MTC algorithm desirable statistical properties, especially for single-event RF estimates.  We can achieve a narrower frequency average for the retrieval of Ps from interfaces deeper than 100 km if we sum single spectral estimates over K seismic events, rather than K eigenspectra from one event, in the RF cross-correlation formulas (2) and(3).  Using only one spectrum estimate per component for each P wave, we estimate the spectra with a Slepian taper of time-bandwidth p=1, that is, the "one-\pi-prolate" taper. This taper averages local frequency information over a central bandwidth similar to the simple boxcar taper, but is optimized for spectral leakage resistance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6561507657338597696?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/recfunk_estack.f' title='recfunk_estack.f -- an event-stacking algorithm for RF with long delay times'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6561507657338597696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6561507657338597696&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6561507657338597696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6561507657338597696'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/recfunkestackf-event-stacking-algorithm.html' title='recfunk_estack.f -- an event-stacking algorithm for RF with long delay times'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8089896852318048494</id><published>2007-08-16T23:07:00.000-04:00</published><updated>2007-08-17T09:07:09.175-04:00</updated><title type='text'>Modified recfunk_pick_through.f</title><content type='html'>More options for specifying the start time of the data record are recognised.&lt;br /&gt;&lt;br /&gt;c  program recfunk_pick_through&lt;br /&gt;c  version of recfunk_pick that reads seismic record start times from&lt;br /&gt;c  the sac header, and writes to in_recpick the filenames that have been picked&lt;br /&gt;c  using EITHER the A-marker or the T1, T2, or T3 markers in the SAC header, placed by running plotpk&lt;br /&gt;c  within SAC.   Set by pressing "T" and 1,2 or 3 in plotpk sequentially&lt;br /&gt;c  10/13/05 JJP&lt;br /&gt;c  input file: in_recpick_raw&lt;br /&gt;c  output file: in_recpick&lt;br /&gt;c&lt;br /&gt;c  xf77 -o /park/backup/bin/recfunk_pick_through recfunk_pick_through.f /park/backup/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/recfunk_pick_through recfunk_pick_through.f /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c&lt;br /&gt;......implicit real*4(a-h,o-z)&lt;br /&gt;......real*8 ar,ai,el(12),aaa&lt;br /&gt;......complex*8 zc,zero&lt;br /&gt;......complex*8 afft,rf,rfs&lt;br /&gt;......character*80 name,subtext,string&lt;br /&gt;......character*28 title(2)&lt;br /&gt;......character*10 cmps(3)&lt;br /&gt;......character comp(3)&lt;br /&gt;......common/nnaamm/iwflag&lt;br /&gt;......common/npiprol/anpi&lt;br /&gt;......common/datastuff/a(99000,3),pdat(16400),tdat(16400),drf(4100,2)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension iah(158),chead(158),fr(3),tt(3),ttt(3)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead)&lt;br /&gt;......data comp/'r','t','z'/&lt;br /&gt;......print *,'This code reads start of interval from sac header' &lt;br /&gt;......print *,'it writes filenames of those files that have been picked'&lt;br /&gt;......open(10,file='in_recpick_raw',form='formatted')&lt;br /&gt;......open(11,file='in_recpick',form='formatted')&lt;br /&gt;   10 print *,'enter filename e.g. 1998.361.bhz'&lt;br /&gt;......read(10,101) name&lt;br /&gt;  101 format(a)&lt;br /&gt;......if(name(1:4).eq.'stop') go to 111&lt;br /&gt;......subtext=name&lt;br /&gt;c  we assume that the last character is either 'r','t',or 'z'&lt;br /&gt;......do i=80,1,-1&lt;br /&gt;......if(name(i:i).ne.' ') then&lt;br /&gt;......namlen=i&lt;br /&gt;......go to 98&lt;br /&gt;......endif&lt;br /&gt;......end do&lt;br /&gt;......print *,name&lt;br /&gt;......print *,'no filename?'&lt;br /&gt;......stop&lt;br /&gt;   98 continue&lt;br /&gt;......do kcmp=3,3&lt;br /&gt;......name(namlen:namlen)=comp(kcmp)&lt;br /&gt;......print *,name&lt;br /&gt;......call sacread(name,a(1,kcmp),ierr)&lt;br /&gt; ......if(ierr.eq.1) stop&lt;br /&gt;......dt=ahead(1) &lt;br /&gt;......tt(1)=0.&lt;br /&gt;......tt(2)=dt&lt;br /&gt;......tt(3)=dt&lt;br /&gt;......nscan=iah(80)&lt;br /&gt;......if(nscan.gt.99000) then&lt;br /&gt;......print *,'Careful! data length greater than 99000:', nscan&lt;br /&gt;......pause&lt;br /&gt;......endif&lt;br /&gt;......end do&lt;br /&gt;c  end kluge&lt;br /&gt;c      if(baz.lt.70) then&lt;br /&gt;c        call plotit_axes(0.,0.,0.,0.)&lt;br /&gt;c        call manyplot(99000,1,nscan,3,tt,a,1.1,name,'time(sec)',' ')&lt;br /&gt;c      endif&lt;br /&gt;c  plot kluge&lt;br /&gt;c  KLUGE: CHANGES FOR READING TIME INTERVAL FROM SAC HEADER&lt;br /&gt;c  ahead(9) is SAC's A parameter, for arrival time.  Set by pressing A in plotpk&lt;br /&gt;c  ahead(12,13,14) are SAC's T1,T2,T3 parameters, for arrival time.  Set by pressing "T" and "N" in plotpk&lt;br /&gt;......if(ahead(9).gt.1.0.or.ahead(12).gt.1.0.or.ahead(13).gt.1.0.&lt;br /&gt;......x or.ahead(14).gt.1.0)  write(11,101) subtext &lt;br /&gt;......pstart=ahead(9)-ahead(6)-3.&lt;br /&gt;......print *,'sach params b and a, pstart',ahead(6),ahead(9),pstart,&lt;br /&gt;......x (ahead(n),n=12,14)&lt;br /&gt;......go to 10&lt;br /&gt;  111 write(11,101) name&lt;br /&gt;......close(10)&lt;br /&gt;......close(11)&lt;br /&gt;......stop&lt;br /&gt;......end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8089896852318048494?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8089896852318048494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8089896852318048494&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8089896852318048494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8089896852318048494'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/modified-recfunkpickthroughf.html' title='Modified recfunk_pick_through.f'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-7848530401907016662</id><published>2007-08-16T22:29:00.001-04:00</published><updated>2007-08-16T22:30:36.460-04:00</updated><title type='text'>test case</title><content type='html'>test case&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-7848530401907016662?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://earth.geology.yale.edu/~jjpark/Code/aniprop_downrange.f' title='test case'/><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/7848530401907016662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=7848530401907016662&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7848530401907016662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/7848530401907016662'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/test-case.html' title='test case'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3879402296952544290</id><published>2007-08-16T22:03:00.000-04:00</published><updated>2007-08-16T22:55:12.306-04:00</updated><title type='text'>recfunk_pick.f -- update to allow the identification of P phase in the SAC header</title><content type='html'>Update suggested by Vadim Levin&lt;br /&gt;&lt;br /&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/recfunk_pick.f"&gt;http://earth.geology.yale.edu/~jjpark/Code/recfunk_pick.f&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;c  program recfunk_pick -- UPDATED&lt;br /&gt;c  reads seismic record start times from the sac header&lt;br /&gt;c  will search the SAC header for specific markers of P phases&lt;br /&gt;c  T1 - P, Pdiff        ahead(12)&lt;br /&gt;c  T2 - PKP,PKIKP   ahead(13)&lt;br /&gt;c  T3 - PP               ahead(14)&lt;br /&gt;c  T1=T2=T3=0 ==&gt; use original A-marker ahead(9)&lt;br /&gt;c&lt;br /&gt;c  08/16/07 JJP&lt;br /&gt;&lt;br /&gt;This code also asks the user whether he/she wishes to apply the LQT coordinates (not everyone does!)&lt;br /&gt;&lt;br /&gt;When you prepare P-wave files using the previously blogged procedures, or with your own algorithm, you can select "T" &amp; "1" at the start of a P wave or Pdiff, "T" &amp; "2" at the start of a PKP/PKIKP window, and "T" &amp; "3" at the start of a PP window.  The code change for recfunk_pick creates an epicentral distance variable to determine the LQ-rotation angle and (in other codes) the moveout/migration parameters.  GCARC --&gt; GCARC/2 for the PP phase, because PP has two equal P-phase legs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3879402296952544290?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3879402296952544290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3879402296952544290&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3879402296952544290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3879402296952544290'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/recfunkpickf-update-to-allow.html' title='recfunk_pick.f -- update to allow the identification of P phase in the SAC header'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6841627965369922295</id><published>2007-08-03T14:27:00.000-04:00</published><updated>2007-08-03T14:29:59.407-04:00</updated><title type='text'>Vadim Levin links to RF codes</title><content type='html'>From my good friend and colleague Vadim Levin:&lt;br /&gt;&lt;br /&gt;hey, cool blog :)&lt;br /&gt;why don't you put a plug for my version of the RF software there,&lt;br /&gt;it's at &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.ldeo.columbia.edu/~vadim/RF/RF-manual.html"&gt;http://www.ldeo.columbia.edu/~vadim/RF/RF-manual.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6841627965369922295?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6841627965369922295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6841627965369922295&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6841627965369922295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6841627965369922295'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/08/vadim-levin-links-to-rf-codes.html' title='Vadim Levin links to RF codes'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4902942609830137274</id><published>2007-07-23T14:52:00.000-04:00</published><updated>2007-08-03T14:31:17.353-04:00</updated><title type='text'>aniprop_downrange.f -- version of aniprop to emulate a linear array of seismometers</title><content type='html'>c  aniprop_downrange - program to calculate propagating modes of anisotropic layer&lt;br /&gt;c  writes a file of dispersion curves at evenly-spaced freq points in files out_cvel out_gvel&lt;br /&gt;c  also writes a set of SAC_Format data files SYN_nn.BH[ZNE] for downrange distances of&lt;br /&gt;c  75km 150 225 300 ...  1200 1275 1350 1424 1500km downrange&lt;br /&gt;c  E-component is the x component (radial) and N-component is the y component (transverse)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://earth.geology.yale.edu/~jjpark/Code/aniprop_downrange.f"&gt;http://earth.geology.yale.edu/~jjpark/Code/aniprop_downrange.f&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4902942609830137274?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4902942609830137274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4902942609830137274&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4902942609830137274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4902942609830137274'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/anipropdownrangef-version-of-aniprop-to.html' title='aniprop_downrange.f -- version of aniprop to emulate a linear array of seismometers'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-60013158853510637</id><published>2007-07-23T14:05:00.001-04:00</published><updated>2008-03-24T18:51:40.095-04:00</updated><title type='text'>aniprop.f -- a standalone program to generate surface waves in layered anisotropic structures</title><content type='html'>Sportsfans,&lt;br /&gt;&lt;br /&gt;The erstwhile version of aniprop.f that was (is?) available on my website has been superceded by an all-in-one version that computes dispersion curves and synthetic seismograms all in one program.  Adapted and debugged on an Intel Mac in gnu fortran.  &lt;br /&gt;&lt;br /&gt;http://earth.geology.yale.edu/~jjpark/Code/aniprop_072307.f&lt;br /&gt;&lt;br /&gt;(after a 24 March 2008 bugfix is now  http://earth.geology.yale.edu/~jjpark/Code/aniprop_032408.f)&lt;br /&gt;&lt;br /&gt;The code computes surface wave modes at evenly-spaced frequency points between 0 and 0.5 Hz. You can change this by tinkering with the code.    It computes synthetics for a source at a specified downrange distance and depth, and plots them using PLOTIT.  The dispersion values are output to files out_cvel and out_gvel (phase and group velocities, natch), and the synthetics are written out to SAC-format files.&lt;br /&gt;&lt;br /&gt;c  aniprop - program to calculate propagating modes of anisotropic layer&lt;br /&gt;c  writes a file of dispersion curves at evenly-space freq points&lt;br /&gt;c&lt;br /&gt;c reads a layered model like the following file (ignore the "c "s)&lt;br /&gt;c&lt;br /&gt;c  K&amp;H SoCal model, deep crust horizontal anisotropy TITLE&lt;br /&gt;c  3       # OF LAYERS OVER HSPACE&lt;br /&gt;c  45 45     THETA,PHI ORIENTATION ANGLES&lt;br /&gt;c  4000 5500 0.06 0.00 3175 0.03 2600  FOR SYMMETRY AXIS&lt;br /&gt;c  0 0     &lt;br /&gt;c  27400 6300 0.00 0.00 3637 0.00 2800  DEPTH (M), VP (M/S), "B", "C",&lt;br /&gt;c  90 45      VS (M/S), "E" &lt;br /&gt;c  32400 6800 0.04 0.00 3925 0.02 2900  B,C,E ARE ANISOTROPIC PARAMETERS&lt;br /&gt;c  0 0&lt;br /&gt;c  60000 7800 0.00 0.00 4500 0.00 3200  NOTE: HSPACE MUST BE ISOTROPIC&lt;br /&gt;c&lt;br /&gt;&lt;br /&gt;One quirk of this code is misbehavior for isotropic models.  The code solves for Rayleigh and Love dispersion simultaneously, because the two polarizations are hybridized in anisotropic models.  Paradox: for a perfectly isotropic model, the rootfinder sometimes misses roots, typically at occasions where the Rayleigh and Love dispersion curves cross.  The bookkeeping for solutions is not very rigorous, so loss of a mode can happen.  With anisotropy, the hybridization of Rayleigh/Love motion seems to repel the roots and keep some minimal separation.  As far as I can tell, the total effect on actual synthetic seismograms is negligible.&lt;br /&gt;&lt;br /&gt;Wave propagation in a truly 1-D lossless model leads to some interesting reverbarations that one rarely sees in nature.  With all the overtones included, you can see a succession of bouncing S waves that precede the main surface wave pulse.  In Earth's crust, such phases would scatter away their high frequency energy from surface topography and sedimentary layers.  There is a loop for mode-summing that can be altered to eliminate the overtones, leaving the fundamental Love and Rayleigh waves:  (lines 681-3)&lt;br /&gt;&lt;br /&gt;c  loop over overtones at a certain frequency&lt;br /&gt;        do iov=1,maxbr&lt;br /&gt;c        do iov=1,2    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Notes on the angle conventions for w-hat, the axis of symmetry:&lt;br /&gt;&lt;br /&gt;In the anisotropic reflectivity code, subroutine zzget *assumes* a coordinate system in which z is down (anti-vertical), x is the radial direction, and y is anti-transverse. Therefore, the position angles theta,phi for w-hat are tilt relative to down, and azimuth defined as a rotation from x towards y. This rotation is CCW if viewed from below, and CW if viewed from above. Since w-hat and -(w-hat) define the same axis of symmetry, the position angles *also* can be defined as theta=(tilt from vertical) and phi=(rotation from anti-x (anti-radial) towards anti-y (transverse)). Viewed from above, this phi rotation is CW, and defines the strike of w-hat relative to the arrival azimuth of the wave.&lt;br /&gt;&lt;br /&gt;In order to compute seismograms for a variety of back-azimuths, the synthetic code genrecd_az.f accepts a layered model with w-hat position angles defined as theta=(tilt from vertical) phi=(strike CW from N). For an event at back-azimuth psi (CW from N), the code rotates w-hat from geographic coordinates to ray-based coordinates before passing it to subroutine zzget. If a wave arrives at back-azimuth psi, the strike of the axis of symmetry w-hat relative to its arrival azimuth is phi'=phi-psi. The code performs this rotation with this code in subroutine matget, for w-hat azimuth "az":&lt;br /&gt;&lt;br /&gt;caz=dcosd(az)&lt;br /&gt;&lt;br /&gt;saz=-dsind(az) ! sin(-az)&lt;br /&gt;&lt;br /&gt;do n=1,nlp&lt;br /&gt;&lt;br /&gt;ww(3)=w(3,n)&lt;br /&gt;&lt;br /&gt;ww(1)=w(1,n)*caz-w(2,n)*saz&lt;br /&gt;&lt;br /&gt;ww(2)=w(1,n)*saz+w(2,n)*caz&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;In this manner, the axes of symmetry of the model, saved in array w(.,.), are never modified.&lt;br /&gt;&lt;br /&gt;Journal Reference:&lt;br /&gt;&lt;br /&gt;Park, J., Surface waves in layered anisotropic structures, Geophys. J. Int. v126, 173-184, 1996.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-60013158853510637?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/60013158853510637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=60013158853510637&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/60013158853510637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/60013158853510637'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/anipropf-standalone-program-to-generate.html' title='aniprop.f -- a standalone program to generate surface waves in layered anisotropic structures'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-9081532316706649680</id><published>2007-07-21T16:40:00.000-04:00</published><updated>2007-07-21T16:49:42.403-04:00</updated><title type='text'>GMT script for plotting epicentral RF sweep from recfunk *.grid files</title><content type='html'>GMT script for plotting epicentral RF sweep from recfunk *.grid files&lt;br /&gt;&lt;br /&gt;Anyone planning to use this post should know what GMT commands are. If not, google "Generic Mapping Tools"&lt;br /&gt;This shell script is based on an Ur-script written by Vadim Levin&lt;br /&gt;&lt;br /&gt;#!/bin/csh -f&lt;br /&gt;&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;#spectral coherence code of JP, arranged by EPI&lt;br /&gt;#Input - $1: radialRF filename; $2: tranvRF filename; $3: scale;  $4: TITLE&lt;br /&gt;# e.g.    ./Plot_epi outr_epi.grid outt_epi.grid  0.5  RAYN_2.0Hz&lt;br /&gt;# the scale parameter has inverse dependence -- larger scale = smaller wiggles&lt;br /&gt;#  The first bit of business is to re-order the traces&lt;br /&gt;&lt;br /&gt;/bin/rm wigtab? tmp?  plot.ps&lt;br /&gt;&lt;br /&gt;echo standard usage&lt;br /&gt;echo  "./Plot_epi outr_epi.grid outt_epi.grid  0.5  RAYN_2.0Hz"&lt;br /&gt;echo "EDIT PLOTTING PARAMETERS TO SUIT YOUR DATA"&lt;br /&gt;set BOX = -R-2/15/0/180&lt;br /&gt;set FRAME = -JX3/7.5&lt;br /&gt;set FRAME_BIG = -JX3/9.4&lt;br /&gt;&lt;br /&gt;awk '{print $2}' $1 | sort -u -n &gt; bazlist&lt;br /&gt;foreach i ( `cat bazlist` )&lt;br /&gt;&lt;br /&gt;echo working on $i&lt;br /&gt;awk '$2 == A &amp;&amp; $1 &gt;= -2' A=$i $1 &gt;&gt; wigtabR&lt;br /&gt;awk '$2 == A &amp;&amp; $1 &gt;= -2' A=$i $2 &gt;&gt; wigtabT&lt;br /&gt;echo "&gt;" &gt;&gt; wigtabR&lt;br /&gt;echo "&gt;" &gt;&gt; wigtabT&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;set scale = $3&lt;br /&gt;pswiggle wigtabR $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/a30/SWen -P -K &gt; plot.ps&lt;br /&gt;pswiggle wigtabR $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/a30f15/SWen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle wigtabR $FRAME $BOX -Z$scale -W1p/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 6 $1 scale $3 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 180&lt;br /&gt;END&lt;br /&gt;# psxy dipping_6.5_3.6_43_15_20.dat -: $FRAME $BOX -W1.5p/255/0/0 -O -K  &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;pswiggle wigtabT $FRAME $BOX -Z$scale -M -G0/0/255 -Ba4f1/a30/SwEn -P -O -K -X3.5 &gt;&gt; plot.ps&lt;br /&gt;pswiggle wigtabT $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/a30f15/SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;&lt;br /&gt;pswiggle wigtabT $FRAME $BOX -Z$scale -W1p/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;echo 0 2.4 14 0 5 6 $2 scale $3 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;echo -2.5 2.7 24 0 5 LT $4 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;psxy $FRAME $BOX -W1.5p/255/0/0 -O  &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 180&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;gv plot.ps &amp;&lt;br /&gt;echo  gv is aliased by JPark to ghostview&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-9081532316706649680?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/9081532316706649680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=9081532316706649680&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/9081532316706649680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/9081532316706649680'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/gmt-script-for-plotting-epicentral-rf.html' title='GMT script for plotting epicentral RF sweep from recfunk *.grid files'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-84801586495839709</id><published>2007-07-21T16:27:00.000-04:00</published><updated>2007-07-21T16:50:33.337-04:00</updated><title type='text'>GMT script for plotting backazimuthal RF sweep from recfunk *.grid files</title><content type='html'>Anyone planning to use this post should know what GMT commands are.  If not, google "Generic Mapping Tools"&lt;br /&gt;This shell script is based on an Ur-script written by Vadim Levin&lt;br /&gt;&lt;br /&gt;#!/bin/csh -f&lt;br /&gt;#shell to plot RF wiggles from the "grid" files generated by &lt;br /&gt;#spectral coherence code of JP, arranged by BAZ&lt;br /&gt;#Input - $1: radialRF filename; $2: tranvRF filename; $3: scale;  $4: TITLE&lt;br /&gt;# e.g.    ./Plotbaz outr_baz.grid outt_baz.grid  0.5  RAYN_2.0Hz&lt;br /&gt;# the scale parameter has inverse dependence -- larger scale = smaller wiggles&lt;br /&gt;&lt;br /&gt;echo sample usage&lt;br /&gt;echo  "./Plotbaz outr_baz.grid outt_baz.grid  0.5  RAYN_2.0Hz"&lt;br /&gt;echo "EDIT PLOTTING PARAMETERS TO SUIT YOUR DATA"&lt;br /&gt;set BOX = -R-2/15/-5/365&lt;br /&gt;set FRAME = -JX3/7.5&lt;br /&gt;set FRAME_BIG = -JX3/9.4&lt;br /&gt;&lt;br /&gt;set scale = $3&lt;br /&gt;set title = $4&lt;br /&gt;&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -M -G0/0/255  -P -K &gt;! plot.ps&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/30/SWen -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;pswiggle $1 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;&lt;br /&gt;echo 0 2.4 14 0 5 CT $1 scale $3 | pstext $FRAME -R-1/1/-2/2 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 380&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G0/0/255 -P -O -K -X3.5 &gt;&gt; plot.ps&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -M -G255/0/0 -N -Ba4f1/30/SwEn -P -K -O  &gt;&gt; plot.ps&lt;br /&gt;pswiggle $2 $FRAME $BOX -Z$scale -W1/0 -M  -P -K -O &gt;&gt;  plot.ps&lt;br /&gt;&lt;br /&gt;echo 0 2.4 14 0 5 CT $2 scale $3 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;echo -1.25 2.7 24 0 5 CT $4 | pstext $FRAME_BIG -R-1/1/-2/3 -N -O -K &gt;&gt; plot.ps&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;0 -10&lt;br /&gt;0 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;2.5 -10&lt;br /&gt;2.5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O -K &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;5 -10&lt;br /&gt;5 380&lt;br /&gt;END&lt;br /&gt;psxy $FRAME $BOX -W1.5p/0/150/0 -O  &lt;&lt;END &gt;&gt; plot.ps&lt;br /&gt;7.5 -10&lt;br /&gt;7.5 380&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;gv plot.ps &amp;  &lt;br /&gt;echo  gv is aliased by JPark to ghostview&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-84801586495839709?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/84801586495839709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=84801586495839709&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/84801586495839709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/84801586495839709'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/gmt-script-for-plotting-backazimuthal.html' title='GMT script for plotting backazimuthal RF sweep from recfunk *.grid files'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6099987139138089316</id><published>2007-07-21T15:29:00.000-04:00</published><updated>2007-08-16T22:03:10.289-04:00</updated><title type='text'>recfunk_pick.f -- version of multiple-taper RF estimation</title><content type='html'>This code is a simple variant of the multiple-taper RF estimator recfunk.f, which has been public for years on my Yale website.  This version reads the start time of the P-wave analysis window from the "AMARKER" entry of the SAC header.  It also rotates the  vertical and radial seismogram components into LQT coordinates using a formula based on epicentral distance.  This formula for LQ rotation angle is very crude, but simple measures of the actual rotation angle scatter quite a bit, and every station has unique behavior.  This variability suggests that careful derivation of a precise LQ rotation angle is a fool's game.&lt;br /&gt;&lt;br /&gt;http://earth.geology.yale.edu/~jjpark/Code/recfunk_pick_072107.f&lt;br /&gt;&lt;br /&gt;(you didnt think that I would post a 1000-line Fortran code!)&lt;br /&gt;&lt;br /&gt;The code needs the EISPACK library for matrix eigenvalue subroutines.  Also Plotit and Sacread, which are the subject of prior posts.&lt;br /&gt;&lt;br /&gt;Code is superceded on 8/16/07 to diversify the P-phase identification in the SAC header -- see later post&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6099987139138089316?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6099987139138089316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6099987139138089316&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6099987139138089316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6099987139138089316'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/recfunkpickf-version-of-multiple-taper.html' title='recfunk_pick.f -- version of multiple-taper RF estimation'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3785593926279632064</id><published>2007-07-21T13:53:00.001-04:00</published><updated>2007-07-21T13:57:50.767-04:00</updated><title type='text'>recfunk_pick_through.f  -- read list of data files and retain only those which have a P-wave window marked for RF estimation</title><content type='html'>c  program recfunk_pick_through&lt;br /&gt;c  version of recfunk_pick that reads seismic record start times from&lt;br /&gt;c  the sac header, and writes to in_recpick the filenames that have been picked&lt;br /&gt;c  10/13/05 JJP&lt;br /&gt;c  input file: in_recpick_raw&lt;br /&gt;c  output file: outfile (to be renamed in_recpick)&lt;br /&gt;c&lt;br /&gt;c  xf77 -o /park/backup/bin/recfunk_pick_through recfunk_pick_through.f /park/backup/Plotxy/plotlib.a /park/backup/Ritz/eislib.a /park/backup/Ritz/jlib.a&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/recfunk_pick_through recfunk_pick_through.f /Users/jjpark/Plotxy/plotlib.a /Users/jjpark/Ritz/eislib.a /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c&lt;br /&gt;......implicit real*4(a-h,o-z)&lt;br /&gt;......real*8 ar,ai,el(12),aaa&lt;br /&gt;......complex*8 zc,zero&lt;br /&gt;......complex*8 afft,rf,rfs&lt;br /&gt;......character*80 name,subtext,string&lt;br /&gt;......character*28 title(2)&lt;br /&gt;......character*10 cmps(3)&lt;br /&gt;......character comp(3)&lt;br /&gt;......common/nnaamm/iwflag&lt;br /&gt;......common/npiprol/anpi&lt;br /&gt;......common/stap2/tap(16400,16)&lt;br /&gt;......common/taperz/ta(16400,8,3),tai(16400,8,3)&lt;br /&gt;......common/stap0/ar(16400),ai(16400),bb(16400),time(99000)&lt;br /&gt;......common/specs/afft(4100,8,3),rf(4100,2),sss(4100,6),crf(4100,2)&lt;br /&gt;......common/saveit/rft(4100,799,2),crft(4100,2),rfs(2050,799,2),&lt;br /&gt;     x   drfs(2050,799,2),bazs(799),epic(799),s2n(799),ip(799)&lt;br /&gt;......common/saveit2/crfts(4100,799,2)&lt;br /&gt;......common/datastuff/a(99000,3),pdat(16400),tdat(16400),drf(4100,2)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......common/distrib/xi(72,36),yi(72,36),sumij(72,36)&lt;br /&gt;......common/chisq/chi(160000),enchi(160000),bbaz(160000),&lt;br /&gt;     x chim(200,2),enchim(200,2)&lt;br /&gt;......dimension iah(158),chead(158),mmonth(12),fr(3),tt(3),ttt(3)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead)&lt;br /&gt;......data mmonth/0,31,59,90,120,151,181,212,243,273,304,334/&lt;br /&gt;......data comp/'r','t','z'/&lt;br /&gt;......data cmps/'Radial    ','Transverse','Vertical  '/&lt;br /&gt;......data title/'Radial Receiver Function    ',&lt;br /&gt;     x 'Transverse Receiver Function'/&lt;br /&gt;......con=180./3.14159265358979&lt;br /&gt;......pi=3.14159265358979&lt;br /&gt;......pih=pi/2.&lt;br /&gt;......zero=cmplx(0.,0.)&lt;br /&gt;......fmax=5.&lt;br /&gt;......print *,'This code reads start of interval from sac header' &lt;br /&gt;......print *,'it writes filenames of those files that have been picked'&lt;br /&gt;c some default values (often superceded)&lt;br /&gt;......fmax0=fmax&lt;br /&gt;......fmin=0&lt;br /&gt;......anpi=2.5&lt;br /&gt;......nwin=3&lt;br /&gt;......npad=16384&lt;br /&gt;......nnf=npad/2&lt;br /&gt;......do i=1,1000&lt;br /&gt;......  crft(i,1)=0.&lt;br /&gt;......  crft(i,2)=0.&lt;br /&gt;......end do&lt;br /&gt;......irec=0&lt;br /&gt;......open(10,file='in_recpick_raw',form='formatted')&lt;br /&gt;......open(11,file='in_recpick',form='formatted')&lt;br /&gt;   10 print *,'enter filename e.g. 1998.361.bhz'&lt;br /&gt;......read(10,101) name&lt;br /&gt;  101 format(a)&lt;br /&gt;......if(name(1:4).eq.'stop') go to 111&lt;br /&gt;......subtext=name&lt;br /&gt;c  we assume that the last character is either 'r','t',or 'z'&lt;br /&gt;......do i=80,1,-1&lt;br /&gt;......  if(name(i:i).ne.' ') then&lt;br /&gt;......    namlen=i&lt;br /&gt;......    go to 98&lt;br /&gt;......  endif&lt;br /&gt;......end do&lt;br /&gt;......print *,name&lt;br /&gt;......print *,'no filename?'&lt;br /&gt;......stop&lt;br /&gt;   98 continue&lt;br /&gt;......do kcmp=3,3&lt;br /&gt;......  name(namlen:namlen)=comp(kcmp)&lt;br /&gt;......  print *,name&lt;br /&gt;......  call sacread(name,a(1,kcmp),ierr)&lt;br /&gt;......  if(ierr.eq.1) stop&lt;br /&gt;......  dt=ahead(1) &lt;br /&gt;......  tt(1)=0.&lt;br /&gt;......  tt(2)=dt&lt;br /&gt;......  tt(3)=dt&lt;br /&gt;......  nscan=iah(80)&lt;br /&gt;......  if(nscan.gt.99000) then&lt;br /&gt;......    print *,'Careful! data length greater than 99000:', nscan&lt;br /&gt;......    pause&lt;br /&gt;......  endif&lt;br /&gt;......end do&lt;br /&gt;c  naturally, you are in deep poop if dt is not the same for all records&lt;br /&gt;......npre=10./dt&lt;br /&gt;......npost=30./dt&lt;br /&gt;......ntot=npre+npost&lt;br /&gt;......ttt(1)=-npre*dt&lt;br /&gt;......ttt(2)=dt&lt;br /&gt;......ttt(3)=dt&lt;br /&gt;......do i=1,ntot&lt;br /&gt;......  time(i)=-ttt(1)-(i-1)*ttt(2)&lt;br /&gt;......end do&lt;br /&gt;......irec=irec+1&lt;br /&gt;......if(irec.gt.799) then&lt;br /&gt;......  print *,'max records exceeded'&lt;br /&gt;......  stop&lt;br /&gt;......endif&lt;br /&gt;......baz=ahead(53)&lt;br /&gt;......bazs(irec)=ahead(53)&lt;br /&gt;......epic(irec)=ahead(54)&lt;br /&gt;......print *,baz,'= back azimuth'&lt;br /&gt;c  ddf is cycles/sec&lt;br /&gt;......ddf=1./(dt*npad)&lt;br /&gt;......nf1=1&lt;br /&gt;......nf2=fmax/ddf+1&lt;br /&gt;......nf=nf2-nf1+1&lt;br /&gt;......if(nf.le.0) stop&lt;br /&gt;......fr(1)=0.&lt;br /&gt;......fr(2)=ddf&lt;br /&gt;......fr(3)=ddf&lt;br /&gt;c   FOR READING TIME INTERVAL FROM SAC HEADER&lt;br /&gt;c  ahead(9) is SAC's A parameter, for arrival time.  Set by pressing A in plotpk&lt;br /&gt;c......print *,'P window start time, duration (sec)'&lt;br /&gt;c......read(10,*) pstart,postwin&lt;br /&gt;......pstart=ahead(9)-ahead(6)-3.&lt;br /&gt;......print *,'sach params b and a, pstart',ahead(6),ahead(9),pstart&lt;br /&gt;......if(ahead(9).gt.0.1) write(11,101) subtext&lt;br /&gt;......go to 10&lt;br /&gt;  111 write(11,101) name&lt;br /&gt;......close(10)&lt;br /&gt;......close(11)&lt;br /&gt;......stop&lt;br /&gt;......end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3785593926279632064?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3785593926279632064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3785593926279632064&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3785593926279632064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3785593926279632064'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/recfunkpickthroughf-read-list-of-data.html' title='recfunk_pick_through.f  -- read list of data files and retain only those which have a P-wave window marked for RF estimation'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-3492177718527127902</id><published>2007-07-21T13:45:00.000-04:00</published><updated>2007-07-21T13:47:15.683-04:00</updated><title type='text'>Fortran subroutine for X-window plotting of simple arrays</title><content type='html'>see the following link&lt;br /&gt;&lt;br /&gt;http://earth.geology.yale.edu/~jjpark/Code/plotit.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-3492177718527127902?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/3492177718527127902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=3492177718527127902&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3492177718527127902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/3492177718527127902'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/fortran-subroutine-for-x-window.html' title='Fortran subroutine for X-window plotting of simple arrays'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4329140152173150732</id><published>2007-07-21T13:43:00.000-04:00</published><updated>2007-07-21T13:45:27.507-04:00</updated><title type='text'>examine_sac.f -- write a SAC macro to visually assess your body-wave data before receiver function estimation</title><content type='html'>c  program examine_sac&lt;br /&gt;c  7/8/99 JJP - adapted for WEED output, after running event_prune &amp; rotate_sac&lt;br /&gt;c  4/1/02  altered to order the input filenames by epicentral distance&lt;br /&gt;c......    to facilitate quality control (P and S wave pattern varies smoothly)&lt;br /&gt;c&lt;br /&gt;c  xf77 -o /Users/jjpark/bin/examine_sac examine_sac.f /Users/jjpark/Ritz/jlib.a /Users/jjpark/Plotxy/plotlib.a&lt;br /&gt;c  to read filenames of data files (bhr,t,z) for a single event&lt;br /&gt;c&lt;br /&gt;......character*80 name,nami,namo*15,dumf(3)*2,bigbanner*85&lt;br /&gt;c  slat, slon are in radians, sdep is in km, slat=colatitude&lt;br /&gt;c  SAC headers are degrees and meters, respectively, and lat is lat&lt;br /&gt;c  ---&gt; so must convert&lt;br /&gt;......common/sour/slat,slon,sdep,sol(6),am0,strike,dip,slip&lt;br /&gt;......common/ptitle/bigbanner,name,namo,dumf&lt;br /&gt;c  we read in data in scratch space&lt;br /&gt;......common/sing2/a(240000)&lt;br /&gt;......common/allfiles/nami(3,6000),gcarc(6000),gcord(6000),ip(6000)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension iah(158),chead(158),mmonth(12),xx(3)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead)&lt;br /&gt;......data mmonth/0,31,59,90,120,151,181,212,243,273,304,334/&lt;br /&gt;......data dumf/'ae','an','az'/&lt;br /&gt;......con=180./3.14159265358979&lt;br /&gt;......open(7,file='infiles2',form='formatted')  ! sacfiles  19*.bh[rtz] 20*.bh[rtz]&lt;br /&gt;......open(18,file='outfile1',form='formatted')  ! to be in_recfunk&lt;br /&gt;......open(9,file='outfile',form='formatted') ! to be sac_examine&lt;br /&gt;......open(13,file='outfile3',form='formatted') ! to be infiles3 (for pruning SKS data sets)&lt;br /&gt;......write(18,103) '0.4'&lt;br /&gt;......j=1&lt;br /&gt;  10  print *,'starting again'&lt;br /&gt;......do k=1,3&lt;br /&gt;......  read(7,101,end=998) nami(k,j)  &lt;br /&gt;......end do&lt;br /&gt;......name=nami(1,j)&lt;br /&gt;......print *,name&lt;br /&gt;......call sacread(name,a,ierr)&lt;br /&gt;......gcarc(j)=ahead(54)&lt;br /&gt;......j=j+1&lt;br /&gt;......go to 10&lt;br /&gt;  998 nevents=j-1&lt;br /&gt;......close(7)&lt;br /&gt;......xx(1)=1.&lt;br /&gt;......xx(2)=1.&lt;br /&gt;c  order the events by epicentral distance&lt;br /&gt;......call plotit(xx,gcarc,dum,nevents,'Events','event number',&lt;br /&gt;     x 'epicentral distance',1,0,0.05,2,21)&lt;br /&gt;......do l=1,nevents&lt;br /&gt;......  blob=200.&lt;br /&gt;......  do m=1,nevents&lt;br /&gt;......    if(blob.gt.gcarc(m)) then&lt;br /&gt;............blob=gcarc(m)&lt;br /&gt;............mm=m&lt;br /&gt;......    endif&lt;br /&gt;......  end do&lt;br /&gt;......  ip(l)=mm&lt;br /&gt;......  gcord(l)=gcarc(mm)&lt;br /&gt;......  gcarc(mm)=200.&lt;br /&gt;......end do&lt;br /&gt;......call plotit(xx,gcord,dum,nevents,'Events','event number',&lt;br /&gt;     x 'epicentral distance',1,0,0.05,2,22)&lt;br /&gt;......do j=1,nevents&lt;br /&gt;......  name=nami(1,ip(j))&lt;br /&gt;......  write(18,103) name(1:17),'?'&lt;br /&gt;......  write(18,103)'117 75 75'&lt;br /&gt;......end do&lt;br /&gt;......write(18,103) 'stop'&lt;br /&gt;......close(18)&lt;br /&gt;......write(9,101) 'qdp 2000'&lt;br /&gt;......do j=1,nevents&lt;br /&gt;......  name=nami(1,ip(j))&lt;br /&gt;........write(13,103) nami(1,ip(j))&lt;br /&gt;........write(13,103) nami(2,ip(j))&lt;br /&gt;........write(13,103) nami(2,ip(j))&lt;br /&gt;......  write(9,103) 'read ',name(1:17),'?; chnhdr a 115 '&lt;br /&gt;......  write(9,103)'rtrend; lp c 0.15 np 8; write lowr lowt lowz'&lt;br /&gt;......  write(9,103) 'read ',name(1:17),'?'&lt;br /&gt;......  write(9,103)'rtrend; hp c .5 np 8; write hir hit hiz'&lt;br /&gt;......  write(9,103) 'readhdr lowz;listhdr gcarc baz evla evlo evdp ',&lt;br /&gt;     x 'kzdate'&lt;br /&gt;c  to pick arrival times for pulses, change hi?;plot1;pause &lt;br /&gt;c  to hi?;plotpk markall on; write over&lt;br /&gt;......  write(9,103) 'read ',name(1:17),'? low? hi?;plot1;pause'&lt;br /&gt;......end do&lt;br /&gt;  999 close(9)&lt;br /&gt;......close(13)&lt;br /&gt;  101 format(a)&lt;br /&gt;  103 format(7a)&lt;br /&gt;  102 format(i4,1x,i2,1x,i2,1x,i2,1x,i2,1x,f4.1)&lt;br /&gt;  105 format(22x,f8.2,1x,f9.2,1x,f4.0)&lt;br /&gt;  104 format(a,f10.3,a,f8.3,a,f10.2)&lt;br /&gt;......print *,'to pick arrival times, change &lt;plot1;pause&gt;'&lt;br /&gt;......print *,'to &lt;plotpk markall on; writehdr over&gt;'&lt;br /&gt;......stop&lt;br /&gt;......end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4329140152173150732?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4329140152173150732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4329140152173150732&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4329140152173150732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4329140152173150732'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/examinesacf-write-sac-macro-to-visually.html' title='examine_sac.f -- write a SAC macro to visually assess your body-wave data before receiver function estimation'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-5236579879485881658</id><published>2007-07-21T13:29:00.000-04:00</published><updated>2007-07-21T13:35:26.110-04:00</updated><title type='text'>subroutines sacread and sacout -- SAC-binary I/O</title><content type='html'>These subroutines lack the neat feature of the new SAC release, which can detect and compensate for byte-swapped data.  Beware the swapped byte!  There are variants of the routines included that swap bytes, dogswork to be sure.&lt;br /&gt;&lt;br /&gt;c......subroutine sacread_noswap(name,a,ierr)&lt;br /&gt;......subroutine sacread(name,a,ierr)&lt;br /&gt;c  read a SAC-format file, dont swap the bytes&lt;br /&gt;......real*4 ahead,ahd,ahhd&lt;br /&gt;......character*80 name&lt;br /&gt;......character*4 chead(158),chd,chhd&lt;br /&gt;......character*1 chhead(4,158)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension a(1)&lt;br /&gt;......dimension iah(158)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead),(ahead,chhead(1,1))&lt;br /&gt;......equivalence (chd,ahd),(chhd,ahhd)&lt;br /&gt;......ierr=0&lt;br /&gt;......open(8,file=name,access='direct',recl=512,err=999)&lt;br /&gt;c  read the 158-word header, can use its info &lt;br /&gt;......read(8,rec=1,err=998)(ahead(i),i=1,128)&lt;br /&gt;......print *,(ahead(i),i=50,55)&lt;br /&gt;......print *,(iah(70+i),i=1,10)&lt;br /&gt;......nscan=iah(80)&lt;br /&gt;......irec=2&lt;br /&gt;......read(8,rec=2,err=998)(ahead(i+128),i=1,30),(a(j),j=1,98)&lt;br /&gt;......if(chead(145).ne.' GRN'.and.chead(145).ne.' grn') then&lt;br /&gt;......  nword=nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......  last=nword-128*(nrec-1)&lt;br /&gt;......else...... &lt;br /&gt;......  print *,'reading greens functions' &lt;br /&gt;......  nword=6*nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......  last=nword-128*(nrec-1)&lt;br /&gt;......endif&lt;br /&gt;......if(nrec.gt.3) then&lt;br /&gt;......  do irec=3,nrec-1&lt;br /&gt;......    read(8,rec=irec,err=998)(a((irec-3)*128+98+i),i=1,128)&lt;br /&gt;......  end do&lt;br /&gt;......endif&lt;br /&gt;c......print *,'rec=',nrec,'  Im trying to read the last partial record'&lt;br /&gt;......read(8,rec=nrec,err=998)(a((nrec-3)*128+98+i),i=1,last)&lt;br /&gt;......close(8)&lt;br /&gt;......return&lt;br /&gt;  999 print *,'open error'&lt;br /&gt;......ierr=1&lt;br /&gt;......return&lt;br /&gt;  998 print *,'read error: reading',irec,' out of',nrec&lt;br /&gt;......ierr=1&lt;br /&gt;......print *,irec&lt;br /&gt;......close(8)&lt;br /&gt;......return&lt;br /&gt;......end&lt;br /&gt;......subroutine sacread_swap(name,a,ierr)&lt;br /&gt;c......subroutine sacread(name,a,ierr)&lt;br /&gt;c  read a SAC-format file -- swap bytes for Intel mac for all numbers, not characters&lt;br /&gt;......real*4 ahead,ahd,ahhd&lt;br /&gt;......character*80 name&lt;br /&gt;......character*4 chead(158),chd,chhd&lt;br /&gt;......character*1 chhead(4,158)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension a(1)&lt;br /&gt;......dimension iah(158)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead),(ahead,chhead(1,1))&lt;br /&gt;......equivalence (chd,ahd),(chhd,ahhd)&lt;br /&gt;......ierr=0&lt;br /&gt;......open(8,file=name,access='direct',recl=512,err=999)&lt;br /&gt;c  read the 158-word header, can use its info &lt;br /&gt;......read(8,rec=1,err=998)(ahead(i),i=1,128)&lt;br /&gt;c  swap bytes&lt;br /&gt;......do i=1,120&lt;br /&gt;......  chd=chead(i)&lt;br /&gt;........do j=1,4&lt;br /&gt;........  chhead(j,i)=chd(5-j:5-j)&lt;br /&gt;........end do&lt;br /&gt;......end do&lt;br /&gt;......print *,(ahead(i),i=50,55)&lt;br /&gt;......print *,(iah(70+i),i=1,10)&lt;br /&gt;......nscan=iah(80)&lt;br /&gt;......irec=2&lt;br /&gt;......read(8,rec=2,err=998)(ahead(i+128),i=1,30),(a(j),j=1,98)&lt;br /&gt;c  swap bytes&lt;br /&gt;......do i=1,98&lt;br /&gt;......  ahd=a(i)&lt;br /&gt;........do j=1,4&lt;br /&gt;........  chhd(j:j)=chd(5-j:5-j)&lt;br /&gt;........end do&lt;br /&gt;........a(i)=ahhd&lt;br /&gt;......end do&lt;br /&gt;c......print *,'rec=2'&lt;br /&gt;......if(chead(145).ne.' GRN'.and.chead(145).ne.' grn') then&lt;br /&gt;......  nword=nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......  last=nword-128*(nrec-1)&lt;br /&gt;......else...... &lt;br /&gt;......  print *,'reading greens functions' &lt;br /&gt;......  nword=6*nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......  last=nword-128*(nrec-1)&lt;br /&gt;......endif&lt;br /&gt;......if(nrec.gt.3) then&lt;br /&gt;......  do irec=3,nrec-1&lt;br /&gt;c......    print *,'rec=',irec&lt;br /&gt;......    read(8,rec=irec,err=998)(a((irec-3)*128+98+i),i=1,128)&lt;br /&gt;c  swap bytes&lt;br /&gt;......    do i=1,128&lt;br /&gt;............ahd=a((irec-3)*128+98+i)&lt;br /&gt;...... .....do j=1,4&lt;br /&gt;..............chhd(j:j)=chd(5-j:5-j)&lt;br /&gt;........    end do&lt;br /&gt;........    a((irec-3)*128+98+i)=ahhd&lt;br /&gt;......    end do&lt;br /&gt;......  end do&lt;br /&gt;......endif&lt;br /&gt;......print *,'byteswapping read'&lt;br /&gt;c  this here is a big fat kluge --- I cant read the last partial record&lt;br /&gt;c  so I skip the last fragment and adjust the header to discard the points.&lt;br /&gt;c......print *,'NOT READING ',last,' points in last record -- SACBUGFIX'&lt;br /&gt;......read(8,rec=nrec,err=998)(a((nrec-3)*128+98+i),i=1,last)&lt;br /&gt;c  swap bytes&lt;br /&gt;......do i=1,last&lt;br /&gt;......  ahd=a((nrec-3)*128+98+i)&lt;br /&gt;...... .do j=1,4&lt;br /&gt;........  chhd(j:j)=chd(5-j:5-j)&lt;br /&gt;........end do&lt;br /&gt;........a((nrec-3)*128+98+i)=ahhd&lt;br /&gt;......end do&lt;br /&gt;c......nscan=nscan-last&lt;br /&gt;c......iah(80)=nscan&lt;br /&gt;......close(8)&lt;br /&gt;......return&lt;br /&gt;  999 print *,'open error'&lt;br /&gt;......ierr=1&lt;br /&gt;......return&lt;br /&gt;  998 print *,'read error: reading',irec,' out of',nrec&lt;br /&gt;......ierr=1&lt;br /&gt;......print *,irec&lt;br /&gt;......close(8)&lt;br /&gt;......return&lt;br /&gt;......end&lt;br /&gt;c......subroutine sacout_noswap(name,a)&lt;br /&gt;......subroutine sacout(name,a)&lt;br /&gt;c  write a SAC-format file&lt;br /&gt;......real*4 ahead&lt;br /&gt;......character*80 name&lt;br /&gt;......character*4 chead(158)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension a(1)&lt;br /&gt;......dimension iah(158)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead)&lt;br /&gt;......open(8,file=name,access='direct',recl=512)&lt;br /&gt;c  write the 158-word header&lt;br /&gt;......write(8,rec=1)(ahead(i),i=1,128)&lt;br /&gt;......print *,(ahead(i),i=50,55)&lt;br /&gt;......print *,(iah(70+i),i=1,10)&lt;br /&gt;......nscan=iah(80)&lt;br /&gt;......if(chead(145).ne.' GRN'.and.chead(145).ne.' grn') then&lt;br /&gt;......  nword=nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......else...... &lt;br /&gt;......  print *,'writing greens functions' &lt;br /&gt;......  nword=6*nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......endif&lt;br /&gt;......write(8,rec=2)(ahead(i+128),i=1,30),(a(j),j=1,98)&lt;br /&gt;......do irec=3,nrec&lt;br /&gt;......  write(8,rec=irec)(a((irec-3)*128+98+i),i=1,128)&lt;br /&gt;......end do&lt;br /&gt;......print *,nrec,' records written'&lt;br /&gt;......close(8)&lt;br /&gt;......return&lt;br /&gt;......end&lt;br /&gt;c......subroutine sacout(name,a)&lt;br /&gt;......subroutine sacout_swap(name,a)&lt;br /&gt;c  write a SAC-format file&lt;br /&gt;......real*4 ahead,ahd,ahhd&lt;br /&gt;......character*80 name&lt;br /&gt;......character*4 chead(158),chd,chhd&lt;br /&gt;......character*1 chhead(4,158)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension a(1)&lt;br /&gt;......dimension iah(158),output(158)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead),(ahead,chhead(1,1))&lt;br /&gt;......equivalence (chd,ahd),(chhd,ahhd)&lt;br /&gt;......open(8,file=name,access='direct',recl=512)&lt;br /&gt;......print *,(ahead(i),i=50,55)&lt;br /&gt;......print *,(iah(70+i),i=1,10)&lt;br /&gt;c  write the 158-word header&lt;br /&gt;c  swap bytes&lt;br /&gt;......do i=1,120&lt;br /&gt;......  chd=chead(i)&lt;br /&gt;........do j=1,4&lt;br /&gt;........  chhd(j:j)=chd(5-j:5-j)&lt;br /&gt;........end do&lt;br /&gt;........output(i)=ahhd&lt;br /&gt;......end do&lt;br /&gt;......do i=121,128&lt;br /&gt;......  output(i)=ahead(i)&lt;br /&gt;......end do&lt;br /&gt;......write(8,rec=1)(output(i),i=1,128)&lt;br /&gt;......nscan=iah(80)&lt;br /&gt;......if(chead(145).ne.' GRN'.and.chead(145).ne.' grn') then&lt;br /&gt;......  nword=nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......else...... &lt;br /&gt;......  print *,'writing greens functions' &lt;br /&gt;......  nword=6*nscan+158&lt;br /&gt;......  nrec=(nword-1)/128+1&lt;br /&gt;......endif&lt;br /&gt;c  swap bytes&lt;br /&gt;......do i=1,30&lt;br /&gt;......  output(i)=ahead(128+i)&lt;br /&gt;......end do&lt;br /&gt;......do i=1,98&lt;br /&gt;......  ahd=a(i)&lt;br /&gt;........do j=1,4&lt;br /&gt;........  chhd(j:j)=chd(5-j:5-j)&lt;br /&gt;........end do&lt;br /&gt;........output(30+i)=ahhd&lt;br /&gt;......end do&lt;br /&gt;......write(8,rec=2)(output(i),i=1,128)&lt;br /&gt;......do irec=3,nrec&lt;br /&gt;......  iii=(irec-3)*128+98&lt;br /&gt;......  do i=1,128&lt;br /&gt;......    ahd=a(iii+i)&lt;br /&gt;........  do j=1,4&lt;br /&gt;........    chhd(j:j)=chd(5-j:5-j)&lt;br /&gt;  ........  end do&lt;br /&gt;........  output(i)=ahhd&lt;br /&gt;......  end do&lt;br /&gt;......  write(8,rec=irec)(output(i),i=1,128)&lt;br /&gt;......end do&lt;br /&gt;......print *,nrec,'byteswapped records written'&lt;br /&gt;......close(8)&lt;br /&gt;......return&lt;br /&gt;......end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-5236579879485881658?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/5236579879485881658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=5236579879485881658&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5236579879485881658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/5236579879485881658'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/subroutines-sacread-and-sacout-sac.html' title='subroutines sacread and sacout -- SAC-binary I/O'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-6511704169950073812</id><published>2007-07-21T13:20:00.000-04:00</published><updated>2007-07-21T13:27:56.080-04:00</updated><title type='text'>rotate_sac.f  -- Preprocessing of SAC data for receiver function analysis</title><content type='html'>c  program rotate_sac&lt;br /&gt;c  7/8/99 JJP  -- adapted for JWEED output&lt;br /&gt;c  f77 -o /Users/jjpark/bin/rotate_sac rotate_sac.f /Users/jjpark/Ritz/jlib.a&lt;br /&gt;c  to read infiles1=filenames of data files (E,N,Z) for a single event&lt;br /&gt;c  cross-ref with file *events* of source locs and times&lt;br /&gt;c writes a SAC macro to read three components of data, synchronize times, cut to equal length, &lt;br /&gt;c  put the event location in the header, and rotate the horizontals to radial and transverse.&lt;br /&gt;c&lt;br /&gt;c  there must be three lines in infiles1 for every line in events, and the events must match the data&lt;br /&gt;c  take out the dots and replace with spaces before compiling&lt;br /&gt;c&lt;br /&gt;......character*80 name,nami,namo*15,dumf(3)*2,bigbanner*85,chh*51&lt;br /&gt;c  slat, slon are in radians, sdep is in km, slat=colatitude&lt;br /&gt;c  SAC headers are degrees and meters, respectively, and lat is lat&lt;br /&gt;c  ---&gt; so must convert&lt;br /&gt;......common/sour/slat,slon,sdep,sol(6),am0,strike,dip,slip&lt;br /&gt;......common/ptitle/bigbanner,nami(3),namo,name,dumf&lt;br /&gt;c  we read in data in scratch space&lt;br /&gt;......common/sing2/a(240000)&lt;br /&gt;......common/header/ahead(158)&lt;br /&gt;......dimension iah(158),chead(158),mmonth(12)&lt;br /&gt;......equivalence (ahead,iah),(ahead,chead)&lt;br /&gt;......data mmonth/0,31,59,90,120,151,181,212,243,273,304,334/&lt;br /&gt;......data dumf/'ae','an','az'/&lt;br /&gt;......con=180./3.14159265358979&lt;br /&gt;......print *,'open(7,file=infiles1)  ! sacfilenames'&lt;br /&gt;......print *,'open(18,file=events)   ! source locations and times'&lt;br /&gt;......open(7,file='infiles1',form='formatted')  ! sacfilenames&lt;br /&gt;......open(18,file='events',form='formatted') ! source locations and times&lt;br /&gt;......open(9,file='outfile',form='formatted')&lt;br /&gt;......write(9,101) 'qdp 2000'&lt;br /&gt;  10  print *,'starting again'&lt;br /&gt;c......if(jjc.eq.1) go to 112&lt;br /&gt;......read(18,101,end=110) name&lt;br /&gt;......print *,name&lt;br /&gt;c......go to 10&lt;br /&gt;c  112 continue&lt;br /&gt;......read(name,102) jy,jm,jd,jh,jmi,ssec&lt;br /&gt;......print *, jy,jm,jd,jh,jmi,ssec&lt;br /&gt;c......nami(1:38)=name(43:80)&lt;br /&gt;c......read(name,105) slat,slon,sdep&lt;br /&gt;......read(name(44:80),*) slat,slon,sdep&lt;br /&gt;......print *, slat,slon,sdep&lt;br /&gt;  101 format(a)&lt;br /&gt;  103 format(7a)&lt;br /&gt;  102 format(19x,i4,1x,i2,1x,i2,1x,i2,1x,i2,1x,f6.3)&lt;br /&gt;c  here reads to column 45 -- if evdp can be read OK here, doesnt matter&lt;br /&gt;c  if the spacing of columns is perfect&lt;br /&gt;  105 format(22x,f8.2,f9.2,f4.0)&lt;br /&gt;c  105 format(25x,3f8.2)&lt;br /&gt;  104 format(a,f10.3,a,f8.3,a,f10.2)&lt;br /&gt;......leap=1-(mod(jy,4)+3)/4&lt;br /&gt;......jd_julian=mmonth(jm)+jd&lt;br /&gt;......if(jm.gt.2) jd_julian=jd_julian+leap&lt;br /&gt;......write(9,103) 'cuterr fillz'&lt;br /&gt;......sdep=sdep*1000.&lt;br /&gt;......print *,slat,slon,sdep,' is depth in meters?'&lt;br /&gt;......do k=1,3&lt;br /&gt;......  read(7,101) nami(k)&lt;br /&gt;......end do&lt;br /&gt;......write(9,103) '/bin/rm ae an az'&lt;br /&gt;......do k=1,3&lt;br /&gt;......  name=nami(k)&lt;br /&gt;......  ii=80&lt;br /&gt;......  do while (name(ii:ii).eq.' ')&lt;br /&gt;......    ii=ii-1&lt;br /&gt;......  end do&lt;br /&gt;c......  ii=ii-4   ! earlier SEED-output name convention&lt;br /&gt;......  ii=ii-6  ! newer SEED-output name convention&lt;br /&gt;......  print *,ii&lt;br /&gt;......  if(name(ii:ii).eq.'Z') then&lt;br /&gt;......    j=3&lt;br /&gt;......  elseif(name(ii:ii).eq.'E'.or.name(ii:ii).eq.'2') then&lt;br /&gt;......    j=1&lt;br /&gt;......  elseif(name(ii:ii).eq.'N'.or.name(ii:ii).eq.'1') then&lt;br /&gt;......    j=2&lt;br /&gt;......  else&lt;br /&gt;......    print *,'bad character: ',name(ii:ii)&lt;br /&gt;......  endif&lt;br /&gt;......  write(9,103) 'sc ln ',name(1:ii+7),dumf(j)&lt;br /&gt;......end do&lt;br /&gt;c  LOVROK is the flag for allowing the user to overwrite a data file&lt;br /&gt;......chh='synch;rmean;rtrend;p1;chnhdr LOVROK TRUE;write over'&lt;br /&gt;......write(9,103)'read ae an az;',chh&lt;br /&gt;......write(9,103) 'cut 0 600'&lt;br /&gt;......write(9,103)'read;write over;cut off'&lt;br /&gt;......do k=1,3&lt;br /&gt;......  name=nami(k)&lt;br /&gt;c read in the file to obtain its reference time&lt;br /&gt;......  call sacread(name,a,ierr)&lt;br /&gt;......  if(ierr.ne.0) go to 111    ! in case of mistyped filename&lt;br /&gt;......  iy=iah(71)&lt;br /&gt;......  id=iah(72)&lt;br /&gt;......  ih=iah(73)&lt;br /&gt;......  im=iah(74)&lt;br /&gt;......  iss=iah(75)&lt;br /&gt;......  ims=iah(76)&lt;br /&gt;c compute origin time - year, month are assumed equal&lt;br /&gt;......  torg=ssec-iss-float(ims)/1000.+&lt;br /&gt;     x......60.*(jmi-im+60*(jh-ih+24*(jd_julian-id)))&lt;br /&gt;......  write(9,103) 'readhdr ',nami(k)&lt;br /&gt;......  write(9,104) 'chnhdr evla ',slat,' evlo ',slon,' evdp ',sdep&lt;br /&gt;......  write(9,104) 'chnhdr o ',torg&lt;br /&gt;......  write(6,104) 'chnhdr o ',torg&lt;br /&gt;......  write(9,103) 'writehdr'&lt;br /&gt;......end do&lt;br /&gt;......write(9,103) 'read ae an az'&lt;br /&gt;......write(9,103) 'plot1'&lt;br /&gt;......write(9,103) 'pause period 0.25'&lt;br /&gt;......write(9,103) ' '&lt;br /&gt;......write(9,103) 'read ae an'&lt;br /&gt;......write(9,103) 'rotate to gcp reversed'&lt;br /&gt;......write(9,103) 'read more az'&lt;br /&gt;......write(9,103) 'plot1'&lt;br /&gt;......write(9,103) 'pause period 0.25'&lt;br /&gt;......write(9,103) ' '&lt;br /&gt;......namo=name(1:15)&lt;br /&gt;......write(9,103) 'write ',namo,'bhr ',namo,'bht ',namo,'bhz'&lt;br /&gt;......go to 10&lt;br /&gt;  110 close(7)&lt;br /&gt;......close(18)&lt;br /&gt;......close(9)&lt;br /&gt;......stop&lt;br /&gt;  111 print *,'error! ',name&lt;br /&gt;......stop&lt;br /&gt;......end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-6511704169950073812?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/6511704169950073812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=6511704169950073812&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6511704169950073812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/6511704169950073812'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/rotatesacf-preprocessing-of-sac-data.html' title='rotate_sac.f  -- Preprocessing of SAC data for receiver function analysis'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-171781352314322615</id><published>2007-07-21T12:56:00.001-04:00</published><updated>2008-07-23T15:50:03.931-04:00</updated><title type='text'>Synthetic Seismogram normalizations</title><content type='html'>I have received queries about constants in the synthetic seismogram code anirec.f  &lt;br /&gt;&lt;br /&gt;In order to avoid round-off error and numerical overflow in numerical computations, it is conventional to nondimensionalize physical units in synthetic seismogram calculations.  My codes use the convetion that I inherited from Freeman Gilbert, my dissertation advisor, and the UCSD Free Oscillation crowd.  The rules for normalizing Mass, Length and Time are derived from three constraints.&lt;br /&gt;&lt;br /&gt;density is normalized by rho-bar = average Earth density = 5515 kg/m^3&lt;br /&gt;&lt;br /&gt;length is normalized by the mean Earth radius R=6.371*10^6 m&lt;br /&gt;&lt;br /&gt;The last constraint is that pi*G=1, where pi=3.14159265358979d0 and G=6.6723*10^{-11} m^3/(kg-s^2) is the Gravitational constant.&lt;br /&gt;&lt;br /&gt;From the public free-oscillation code MINEOS&lt;br /&gt;&lt;br /&gt;c    the model has been normalised such that a density of 5515 mg/m**3 = 1 ;&lt;br /&gt;c    pi*g=1 where g is the grav constant (6.6723e-11) and the radius of the&lt;br /&gt;c    earth (rn=6371000 m) is 1. these normalizations result in&lt;br /&gt;c      acceleration normalisation = pi*g*rhobar*rn                      = 7.365081 m/s^2&lt;br /&gt;c      velocity normalisation     = rn*sqrt(pi*g*rhobar)= vn        = 6850.0396 m/s&lt;br /&gt;c      frequency normalization    = vn/rn = sqrt(pi*g*rhobar)   = 1.075190645e-3 s^1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This last constraint leads to a normalization constant for frequency of REN=1.075190645d-3.  I have found a slightly different value for G quoted on the web, which is understandable considering that the seismological constants were set when G was not known as precisely as now.  There can be danger in mistyping the numbers.  One colleague of mine lost days and much sleep when the rho-bar constant was mistyped 5517 kg/m^3 and a 10^{-4} error crept into calculations that should have been good to double precision.  Believe me, no one was lauging when the error was discovered!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-171781352314322615?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/171781352314322615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=171781352314322615&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/171781352314322615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/171781352314322615'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/synthetic-seismogram-normalizations.html' title='Synthetic Seismogram normalizations'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-846906685773190066</id><published>2007-07-21T12:40:00.000-04:00</published><updated>2007-07-21T12:56:34.521-04:00</updated><title type='text'>Converting JWeed event files to julian days</title><content type='html'>JWeed event files identify earthquakes in month-day format, but seismic data filenames follow Julian-day format.  Unless you have a magic patch of brain cells that converts the calendar to julian days, this is a big hassle when matching files with events.  I adapted a little fortran code to convert, and some awk lines that convert a JWeed event file into a format that is used by other codes to pre-process body wave data.  Here are the awk lines:&lt;br /&gt;&lt;br /&gt;sed 's/,/ /g' events*.events | sed 's[/[ [g' &gt;! blob.dat&lt;br /&gt;awk '{print "echo " $3 " " $4 " " $2 " &gt;! blobb; echo " $0 " &gt;&gt;blobb ;  Julian1 &lt; blobb &gt;&gt; ev_julian " }' blob.dat &gt;! c_events&lt;br /&gt;sed 's/xxxx yyyyy//g' c_events &gt;! c_ev&lt;br /&gt;&lt;br /&gt;the JWeed event filenaming convention (for me) is events_YYYY.events, with variants.  The first step strips the syntax separating numbers in the events file, so that awk can parse the numbers.  The second line creates a command file c_events that uses Julian1 to read the output of the awk step.  The last step takes out some superfluous matter from c_events, then you "source c_ev" to make ev_julian.  I rename this file events.julian as a template for the file "events" that each station needs in preprocessing (see previous post).&lt;br /&gt;&lt;br /&gt;Oh yes, there is a Fortran code&lt;br /&gt;&lt;br /&gt;c  program Julian1&lt;br /&gt;c  f77 -o /Users/jjpark/bin/Julian1 Julian1.f&lt;br /&gt;      character string*80&lt;br /&gt;      dimension mmonth(12)&lt;br /&gt;      data mmonth/0,31,59,90,120,151,181,212,243,273,304,334/&lt;br /&gt;c      print *,'enter month, day, year'&lt;br /&gt;      read(5,*) jmo,jd,jy&lt;br /&gt;      leap=1-(mod(jy,4)+3)/4&lt;br /&gt;      jd_julian=mmonth(jmo)+jd&lt;br /&gt;      if(jmo.gt.2) jd_julian=jd_julian+leap&lt;br /&gt;c      print *,'julian day = ',jd_julian&lt;br /&gt;      read(5,101) string&lt;br /&gt;      print 102,jy,jd_julian,string&lt;br /&gt;  101 format(a)&lt;br /&gt;  102 format(2i5,4x,a)&lt;br /&gt;      stop&lt;br /&gt;      end&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-846906685773190066?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/846906685773190066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=846906685773190066&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/846906685773190066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/846906685773190066'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/converting-jweed-event-files-to-julian.html' title='Converting JWeed event files to julian days'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4448998395881540321</id><published>2007-07-20T16:04:00.000-04:00</published><updated>2007-07-20T16:44:37.809-04:00</updated><title type='text'>Installing JWeed on Linux</title><content type='html'>There is a nasty glitch in the Linux installation for JWeed.  The IRIS website downloads install.bin, but it has two bad lines.   FIRST, run the installer thusly to fix one bad line without changing the checksum&lt;br /&gt;&lt;br /&gt;cat install.bin | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" &gt; temp&lt;br /&gt;sh temp&lt;br /&gt;&lt;br /&gt;Then comment out lines 1335 and 1375 of JWeedv2.9.8, which is the executable script that embodies JWeed.  These are the lines&lt;br /&gt;&lt;br /&gt;1335 export LD_ASSUME_KERNEL=2.2.5&lt;br /&gt;&lt;br /&gt;1375 LD_ASSUME_KERNEL=2.2.5&lt;br /&gt;&lt;br /&gt;After these changes, there is still a little complaint about an extra backslash, which I tracked down to line 1343:&lt;br /&gt;    split ($3, ver, "[\._-]")&lt;br /&gt;&lt;br /&gt;I took the backslash out and the code still worked.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks to Alex Nikulin and Garrett Leahy for the tip!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4448998395881540321?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4448998395881540321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4448998395881540321&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4448998395881540321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4448998395881540321'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/installing-jweed-on-linux.html' title='Installing JWeed on Linux'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-1614780073690241507</id><published>2007-07-20T14:11:00.000-04:00</published><updated>2007-07-20T14:25:17.833-04:00</updated><title type='text'>Preparing RETREAT body waves for Receiver-Function Estimation</title><content type='html'>Work performed on an IntelMac laptop -- computer codes and scripts will be posted in successive blog posts.  This post documents the preparation of body wave data from the RETREAT experiment.  You can use the concepts to guide the preparation of data for other stations.&lt;br /&gt;&lt;br /&gt;The directory Teleseismic has subdirectories PIIR, VLC, VOLR, etc, one for each station name.  The station subdirectories have data files in SAC format, but without the source location in the header.  There are three steps in preparing a station's data for processing.  First, we associate events with data-file triplets.  The extraction by RDSEED from the SEED files should have synchronized the data files for each component of motion.  This first step can be tedious, however, because there will be more events than datafile triplets whenever the station was down, and more data files than events when the data files are fragmented.  The goal is to prune the files "events" to only the events that have data, and the file "infiles1" to be the triplets of datafile names -- infiles1 will have three times as many lines and events, natch.&lt;br /&gt;&lt;br /&gt;cd PIIR (from the Teleseismic directory)&lt;br /&gt;ls *.SAC &gt; infiles_raw&lt;br /&gt;cp infiles_raw infiles1       &lt;br /&gt;cp ../events.julian events&lt;br /&gt;te events &amp;&lt;br /&gt;te infiles1 &amp;&lt;br /&gt;&lt;br /&gt;events_julian is a master file of events used to request data from the IRIS DMC for the experiment, based on a JWeed event file:&lt;br /&gt;&lt;br /&gt; 2003  356    MHDF 2003 12 22 19:15:56.000 35.706 -121.102 7.6 MB 6.1 MS 6.4                  &lt;br /&gt; 2003  359    MHDF 2003 12 25 07:11:11.590 8.416 -82.824 33 MB 6.0 MS 6.4                     &lt;br /&gt; 2003  359    MHDF 2003 12 25 20:42:33.720 -22.252 169.488 10 MB 6.3 MS 6.3                   &lt;br /&gt; 2003  360    MHDF 2003 12 26 01:56:52.440 28.995 58.311 10 MB 6.0 MS 6.8                     &lt;br /&gt; 2003  360    MHDF 2003 12 26 21:26:04.100 -22.273 169.314 10 MB 6.1 MS 6.8                   &lt;br /&gt; 2003  361    MHDF 2003 12 27 16:00:59.450 -22.015 169.766 10 MB 6.1 MS 7.1                   &lt;br /&gt; 2003  361    MHDF 2003 12 27 22:38:01.880 -21.672 169.835 10 MB 5.8 MS 6.7                   &lt;br /&gt;&lt;br /&gt;Note that the month/day/year format of the JWeed event file is replaced by year julianday, which matches the output filename format of rdseed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The user now opens infiles1 and events in a text editor and synchronizes their lines.  It is smart to keep an Xterminal open to run SAC or pql.  Sometimes there will be more than three datafiles associated with an event start time, and you must display their contents in order to choose the three files to use, or else to merge some files.&lt;br /&gt;&lt;br /&gt;pql yyyy.ddd.* &amp;   &lt;br /&gt;&lt;br /&gt;is a good command for this.  Or&lt;br /&gt;&lt;br /&gt;echo "read yyyy.ddd.*; qdp 2000; p1" | sac&lt;br /&gt;&lt;br /&gt;because you can retrieve previous commands in a Unix shell and replace the yyyy.ddd for different cases.&lt;br /&gt;&lt;br /&gt;The second step is to run the code "rotate_sac." this code reads the info in infiles1 and events.  It generates a SAC macro file that will read the data triplets, put the earthquake hypocentre into the SAC headers, cut the files to 600-s length and rotate the horizontals to radial and transverse direction.  You run &lt;br /&gt;&lt;br /&gt;rotate_sac&lt;br /&gt;/bin/mv outfile sac_rotate&lt;br /&gt;echo exit &gt;&gt; sac_rotate&lt;br /&gt;sac &lt; sac_rotate&lt;br /&gt;&lt;br /&gt;and the files *yyyy.ddd.hh.*BH[ENZ]*.SAC are converted to truncated and rotated data files "yyyy.ddd.hh.mm.bh[zrt]"  Now comes the third step of processing.  The code examine_sac reads the data files and composes a SAC macro to visualize the data in raw and bandpassed traces, in order to assess the signal to noise ratio of the P wave. &lt;br /&gt;&lt;br /&gt;ls *bh? &gt;! infiles2&lt;br /&gt;echo 3 &gt;! c_c_c&lt;br /&gt;examine_sac &lt; c_c_c&lt;br /&gt;/bin/mv outfile1 in_recfunk&lt;br /&gt;/bin/mv outfile sac_examine&lt;br /&gt;sed -e 's/plot1;pause/plotpk markall on; writehdr over/' sac_examine &gt;! sac_examine_pick&lt;br /&gt;sac &lt; sac_examine_pick&lt;br /&gt;&lt;br /&gt;The SAC-macro sac_examine displays data from each event in raw, lowpassed and highpassed traces.  Oftentimes a Pwave is evident in some bandpasses and not others -- I typically keep events where the low or high bandpass has SNR&gt;2, but SNR.le.1 elsewhere.  The last "sed" command converts this display macro into a phase-picking macro.  "sac_examine_pick" asks you to click "A" on the desired start of a RF data window (the duration of the window is user-input in the RF codes, but the start time of analysis is most convenient if stored in the SAC header).  The SAC macro marks "A" in the lowpassed traces at the point 120s from the start of the record, the typical timing of the P wave.  A PKP or PP wave will arrive later than this, except for events that are so far away that JWEED neglected to use the Pdiff as a reference. GCARC~150 is the transition, but Im not certain where exactly this transition occurs. For P and Pdiff selection, you can leave the cursor close to 120s after trace onset, and adjust to capture the P wave with a 5-10 seconds to spare.  For the PKP phase, you must move the cursor to later in the record.  &lt;br /&gt;&lt;br /&gt;The data-evaluation and marking exercise is done with the A and Q keys.&lt;br /&gt;If the P or PKP wave is determined "analyzable" click A to mark the start time of the data window, then Q to move to the next record.  SAC marks all data traces with the A-time.  If you make a mistake in selecting A, either too early or too late, just mark it again.  &lt;br /&gt;If the P or PKP wave is weak or bad (e.g. the PP overlaps the PKP too much), then simply click Q and SAC will leave the datafile unmarked.  This flags the event and datafiles to be discarded.  If you click Q by accident before clicking A before a good P phase, you must return to the data later by running the relevant lines of sac_examine_pick.  Write down the event time (yyyy.ddd.hh) and go back to it later.  &lt;br /&gt;examine_sac takes the data files and orders them in increasing epicentral distance.  This way the user will assess the data first from nearby earthquakes with high-frequency P, moving on to low-frequency Pdiff, to an interval where only the largest quakes have visible Pdiff, and then to GCARC~120 where the PKP phase precedes the PP phase by enough time to be useful for RF analysis.  Finally the time-reference for JWeed shifts and the data interval has PKP/PKIKP starting at 120s.&lt;br /&gt;&lt;br /&gt;After the desired P waves have been identified with A-markers in their SAC headers, it is time to prune the list of events down to the chosen few.  To prune the in_recfunk file,  &lt;br /&gt;&lt;br /&gt;grep bh in_recfunk &gt;! in_recpick_raw&lt;br /&gt;echo stop &gt;&gt; in_recpick_raw&lt;br /&gt;recfunk_pick_through  &lt;br /&gt;&lt;br /&gt;--&gt; reads in_recpick_raw and writes in_recpick, a list of wildcarded filenames that includes only those whose headers define a data window to analyze.  Then this in_recpick can be used by recfunk_pick to compute simple RF sweeps (no migration, only epicentral and back-azimuths bin-sums).&lt;br /&gt;&lt;br /&gt;recfunk_pick&lt;br /&gt;&lt;br /&gt;There are GMT scripts in the Teleseismic directory, some files from recfunk_pick can be plotted to see what the station RFs are like:&lt;br /&gt;&lt;br /&gt;../Plotss outr_baz.grid outt_baz.grid 0.75 plot_baz&lt;br /&gt;cp plot.ps plot_baz.ps&lt;br /&gt;&lt;br /&gt;../Plot_epi3 outr_epi.grid outt_epi.grid 0.75 plot_epi&lt;br /&gt;cp plot.ps plot_epi.ps&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-1614780073690241507?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/1614780073690241507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=1614780073690241507&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1614780073690241507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/1614780073690241507'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/preparing-retreat-body-waves-for.html' title='Preparing RETREAT body waves for Receiver-Function Estimation'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-8255535715509265031</id><published>2007-07-20T13:57:00.000-04:00</published><updated>2007-07-20T14:09:51.457-04:00</updated><title type='text'>Using JWeed to read seismic data from the RETREAT Project (Post 1)</title><content type='html'>Notes on getting RETREAT data from the IRIS DMC  (6/13/07)  -- Experience working on an Intel Mac laptop&lt;br /&gt; &lt;br /&gt;FIRST:  obtain JWeed from the IRIS website.  Install on your computer.&lt;br /&gt; &lt;br /&gt;SECOND: obtain ccrypt from sourceforge on the web.  There are versions that have executables for many processors and operating systems, but it might be safest to get the source code and compile it in your own environment.  First "./configure" then "make" then "sudo make install" on a Mac.&lt;br /&gt; &lt;br /&gt;Running JWeed&lt;br /&gt; &lt;br /&gt;Three items to remember:  1) the RETREAT network code is YI.  There are some other stations in Antarctica that are included in network YI.  You might be able to avoid these in JWeed by restricting the stations to a box around Italy.  2) the definition of YI is time-variable.  If you ask for the station info when JWeed is set for a time interval in 2007, you wont get the RETREAT stations. 3) the RETREAT and GAIA stations record on the BH? channels, and the INGV network stations record on the HH? channels.  You must request both channel types to get data from both sets of stations.&lt;br /&gt; &lt;br /&gt;Dont try to move back and forth in JWeed while you are retrieving something from the internet.  In particular, the download of stations from the database is tedious, and there is temptation to wander in JWeed.  However, I have found that JWeed will halt when you move to a different tab in the GUI.  It is smarter to use the Network DataCenter once for each time interval of interest, then use the JWeed-written station file for later requests. &lt;br /&gt; &lt;br /&gt;To get the INGV HH? stations,  Ive wasted a day trying.  HH? channel is not a channel normally found by JWeed.  Also the IRIS database cant always find the INGV stations in JWeed.  It is a pisser.  The key is that JWeed wont find a station that does not have channel that is being requested.  So if you ask for BH? channels, only the PASSCAL and GAIA stations appear in YI, not the INGV stations.  I find that the request works if you ask for BOTH B* and HH* channels.&lt;br /&gt; &lt;br /&gt;The other JWeed "feature" is that you cant create multiple breqfast files without exiting the software.  Either the YI network decreases down to a single station on the Antarctic ice cap, the breqfast file hangs, or something else surprises you.  Give up! Exit  JWeed and start over! &lt;br /&gt; &lt;br /&gt;If you have event files and station files, it is possible to run JWeed without accessing the outside DHI servers.  However, I had to turn off the internet access for the computer to avoid problems.  Also, you cant run JWeed multiple times to create multiple files.  Ive had to close JWeed and start over every time.&lt;br /&gt; &lt;br /&gt;Here is what seems to work:&lt;br /&gt; &lt;br /&gt;1) set IRIS netDC for Jweed in first tab.&lt;br /&gt; &lt;br /&gt;2) Set the whole world in the second tab -- it is the default box.  You can also specify an epicentral range around a map point.  Use the crosshairs icon to the left&lt;br /&gt; &lt;br /&gt;3) in third tab, specify magnitude range, depth range, MB MS ML as the magnitudes to use for body-wave records, load the catalogs if they are not there already, choose WHDF (maybe) and specify the time period for gathering events (VERY important!)&lt;br /&gt; &lt;br /&gt;4) Save events if you like&lt;br /&gt; &lt;br /&gt;5) Map the events, an operation that pops open the second tab again -- in the map specify a small rectangle over Italy for choosing stations&lt;br /&gt; &lt;br /&gt;6) in the 4th tab, access the DHI to bring down a list of networks and stations from the server.  This can take a long time.  When "finished" open the YI folder to verify that the stations desired are there. If only the Antarctic station is there, search the DHI again.  If only BH? stations are there and not the INGV stations, start over if you want the INGV stations. &lt;br /&gt; &lt;br /&gt;7) Select the YI folder and map the stations.  save them to a file if you wish.&lt;br /&gt; &lt;br /&gt;8) Go to the generate-request tab.  click the "listing" button, rather than the "map" button.  wait until the summary file appears in the text window.  The program prompts for a file name and write out the summary file automatically.  JWeed write the file to the JWEED_HOME directory.  Make sure that you have set this environmental variable.&lt;br /&gt; &lt;br /&gt;9) Go to the mail-request tab.  Fill in the info, choose the Breqfast-IRIS tab to specify the IRIS DMC.  Do NOT email the request directly, save it to a file.  This allows you to fix any syntax issues easily.&lt;br /&gt; &lt;br /&gt;Running CCRYPT&lt;br /&gt; &lt;br /&gt;the routine ccrypt has better encryption protection than the old Unix version of crypt.  This is great, but IRIS encodes with the old version.  Therefore you must use the "u" option:&lt;br /&gt; &lt;br /&gt;ccrypt -u &lt; file.seed.crypted &gt; file.seed&lt;br /&gt; &lt;br /&gt;and the routine prompts you for the crypting key.  I put alias crypt "ccrypt -u" into my .cshrc file&lt;br /&gt; &lt;br /&gt;Using Breq_fast&lt;br /&gt; &lt;br /&gt;JWeed will generate a breq_fast request.  It is smart to save the breqfast file on your home computer in order to fix syntax problems. Some syntax issues crop up intermittently.  For instance, JWeed will let you specify multiple channels in the request&lt;br /&gt; e.g. BHZ HHZ, but in the last few days the two items in the breqfast file are not parsed by the DMC software, only the first one is.  Parsing the multiple-channel request by changing the breqfast file to "BHZ HHZ" with quote marks WONT WORK.  For the YI case you can try to specify ?H? as the channel and the request will obtain both HH? and BH?.  BUT, watch the last number before the channel identifier.  It should be the number 1, else there will be a syntax error.  However, the ?H? trick works in some cases and not others.  Therefore I have requested BH? and HH? separately.  One can use the same breqfast file twice, since no station has both BH and HH channels.&lt;br /&gt; &lt;br /&gt;A number of tests failed to work.  I hypothesize that Breqfast wildcarding wont allow '?', only '*'  In any case, the last time I sent a breakfast request with the '*' wiildcard and two channel items, the DMC responded as documented.  AAAAAUUUUUGGGGHHH!!!!!&lt;br /&gt; &lt;br /&gt;Running rdseed on the SEED files&lt;br /&gt; &lt;br /&gt;This seems to be OK.  The use of summary files is important, because these will synchronize start times for the three components of motion, if possible.  RDSEED is not transferring event informationj from the summary file, so there are no epicentral distances and azimuth values  (or correct ones!) in the SAC header.  It is possible to run rdseed in command-line mode:&lt;br /&gt; &lt;br /&gt;rdseed -d -f filename.seed -x filename.summary&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-8255535715509265031?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/8255535715509265031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=8255535715509265031&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8255535715509265031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/8255535715509265031'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/using-jweed-to-read-seismic-data-from.html' title='Using JWeed to read seismic data from the RETREAT Project (Post 1)'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6995266693478416926.post-4813002405890585800</id><published>2007-07-20T13:50:00.000-04:00</published><updated>2007-07-20T13:53:55.781-04:00</updated><title type='text'>Welcome to this Blog</title><content type='html'>JParkCodes is an expedient for me to disseminate information about computer codes used by the Yale University Seismology Group.   It will take me some time to post useful code for folks in Yale and colleagues worldwide.  Send email with queries, and add comments to posted programs and shell-scripts to flag bugs and suggest improvements.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6995266693478416926-4813002405890585800?l=jparkcodes.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jparkcodes.blogspot.com/feeds/4813002405890585800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6995266693478416926&amp;postID=4813002405890585800&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4813002405890585800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6995266693478416926/posts/default/4813002405890585800'/><link rel='alternate' type='text/html' href='http://jparkcodes.blogspot.com/2007/07/welcome-to-this-blog.html' title='Welcome to this Blog'/><author><name>Fearless Leader</name><uri>http://www.blogger.com/profile/16990033455262333285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>
