<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style id=owaTempEditStyle>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\0027Courier New\0027";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
/* List Definitions */
@list l0
        {mso-list-id:2144738044;
        mso-list-template-ids:-1083289976;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Good morning Mark,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Sorry for the delay, we had nearly three inches of rain followed
by four inches of snow and I was sequestered at home until today.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>See <a href="http://www.iges.org/grads/gadoc/gadocindex">http://www.iges.org/grads/gadoc/gadocindex</a>
and click on the gsfpath() indexed item.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>There are some steps for you to complete; according to the
instructions on that page.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>It does appear that those paths must be the full path, e.g. rc =
gfspath(/home/mark/b /home/mark/a)<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Here is a snippet from the page<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:black'>The private path directory list is an optional list that is
provided via the </span><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>gsfpath</span><span style='color:black'> function: <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>rc = gsfpath("dirlist")</span><span
style='color:black'><o:p></o:p></span></p>
<p class=MsoNormal><span style='color:black'>If used, the declaration of the
private path directory list should appear at the top of the main script just
underneath the statement enabling the dynamic script loading. <o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:black'>For example, if our main script "do_eof.gs" is
executed with the command: <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>run /usr/local/gradslib/do_eof</span><span
style='color:black'><o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:black'>and this script file contains the following lines at the
front: <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>rc = gsfallow("on")</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><br>
</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>rc
= gsfpath("math1 string2") </span><span style='color:black'><o:p></o:p></span></p>
<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:black'>and the script calls a function </span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>str_chop</span><span
style='color:black'> which is not found in the main script, then the search
path would be: <o:p></o:p></span></p>
<ol start=1 type=1>
<li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:
auto;mso-list:l0 level1 lfo1'>/usr/local/gradslib/str_chop.gsf <o:p></o:p></li>
<li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:
auto;mso-list:l0 level1 lfo1'>/usr/local/gradslib/math1/str_chop.gsf <o:p></o:p></li>
<li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:
auto;mso-list:l0 level1 lfo1'>/usr/local/gradslib/string2/str_chop.gsf <o:p></o:p></li>
</ol>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>John<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>John Huddleston, PhD<o:p></o:p></span></p>
</div>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> gradsusr-bounces@gradsusr.org
[mailto:gradsusr-bounces@gradsusr.org] <b>On Behalf Of </b>Mark Sponsler<br>
<b>Sent:</b> Friday, April 23, 2010 2:36 PM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> Re: [gradsusr] Pass Data via the 'Return' Expression<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>John,<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>I
hate to be a pain but am still having problems.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><br>
So if my main script is here: c:/grib/a/main_script.gs and the
called script is here: c:/grib/b/called.gfs<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>Then I
should set gfspath as follows:</span><span style='font-size:10.0pt;font-family:
"Arial","sans-serif";color:black'><o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>rc =
gsfpath("../b") </span><span style='font-size:10.0pt;font-family:
"Arial","sans-serif";color:black'><o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>Unfortunately the
script hangs on the gfspath command. </span><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>I've
tried it with both \ and / too. </span><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Any
suggestions?<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>Thanks,<br>
Mark<o:p></o:p></span></p>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:black'><br>
<br>
----- Original Message -----<br>
From: "John Huddleston" <Huddleston@cira.colostate.edu><br>
To: "GrADS Users Forum" <gradsusr@gradsusr.org><br>
Sent: Friday, April 23, 2010 11:45:23 AM GMT -08:00 US/Canada Pacific<br>
Subject: Re: [gradsusr] Pass Data via the 'Return' Expression<o:p></o:p></span></p>
<div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:black'>Mark,<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:black'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:black'>The Windows builds use the Cygwin "UNIX" style of
paths. So, if you want to go up one directory and then down into another, use
the ".." parent directory. The "." directory is the current
directory.<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:black'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";
color:black'>John Huddleston, PhD<o:p></o:p></span></p>
</div>
<div id=divRpF374583>
<div class=MsoNormal align=center style='text-align:center'><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'>
<hr size=2 width="100%" align=center>
</span></div>
<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif";color:black'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:black'>
gradsusr-bounces@gradsusr.org [gradsusr-bounces@gradsusr.org] On Behalf Of Mark
Sponsler [msponsler@comcast.net]<br>
<b>Sent:</b> Friday, April 23, 2010 9:39 AM<br>
<b>To:</b> GrADS Users Forum<br>
<b>Subject:</b> Re: [gradsusr] Pass Data via the 'Return' Expression<o:p></o:p></span></p>
</div>
<div>
<div>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Brian,<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Excellent
addtional examples. I am using gfsallow right now, and it works fine if
the 'b' script is in the same directory as the 'a' script. <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>But
now I'm kinda stuck because I want the b script to be in a different
directory. I'm trying to set up a bunch of common scripts
in a standalone directory, so they can be accessed from any grads script
elswhere on the drive. So pathing is now the issue.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>I'm
trying to locate 'script b' using gfspath.<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>Say
'script a' is here: c:/grib/a (and executed from that
location), and 'script b' (the .gsf script) is here: c:/grib/b<o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>I
can't seem to figure out how to get gfspath to go 'up' one directory, then down
into directory b <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>I
tried <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>rc =
gsfpath("./b") but the scripts hangs on the gfspath command. </span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'> <o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>I'm on
a Windows build of Grads. </span><span style='font-size:10.0pt;font-family:
"Arial","sans-serif";color:black'><o:p></o:p></span></p>
<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p> </o:p></span></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>Thanks,<br>
Mark<o:p></o:p></span></p>
</div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><br>
<br>
----- Original Message -----<br>
From: "Brian Doty" <doty@cola.iges.org><br>
To: "GrADS Users Forum" <gradsusr@gradsusr.org><br>
Sent: Thursday, April 22, 2010 7:42:56 PM GMT -08:00 US/Canada Pacific<br>
Subject: Re: [gradsusr] Pass Data via the 'Return' Expression<br>
<br>
The "gsfallow" stuff is usually the better solution, but I will also
note that if you have a main script that issues the run command to grads, ie: <o:p></o:p></span></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><span style='font-size:10.0pt;
font-family:"'Courier New'","serif";color:black'>"run myscript.gs
"args</span></span><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>and if that script returns something via the </span><span
class=apple-style-span><span style='font-size:10.0pt;font-family:"'Courier New'","serif";
color:black'>return</span></span><span style='font-size:10.0pt;font-family:
"Arial","sans-serif";color:black'> statement, then that string is available to
the first script in the </span><span class=apple-style-span><span
style='font-size:10.0pt;font-family:"'Courier New'","serif";color:black'>result </span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>variable. <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>Example:<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>script a:<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><span style='font-size:10.0pt;
font-family:"'Courier New'","serif";color:black'>"run b.gs testing"</span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><span style='font-size:10.0pt;
font-family:"'Courier New'","serif";color:black'>say
"--->"result"<---"</span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>script b:<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><span style='font-size:10.0pt;
font-family:"'Courier New'","serif";color:black'>function b(args)</span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><span style='font-size:10.0pt;
font-family:"'Courier New'","serif";color:black'>return(subwrd(args,1))</span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>If you run a.gs from within grads, you should see the following
line output:<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><span style='font-size:10.0pt;
font-family:"'Courier New'","serif";color:black'>---->testing<----</span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>...Brian<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<div>
<div>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>On Apr 21, 2010, at 8:42 PM, Mark Sponsler wrote:<o:p></o:p></span></p>
</div>
<blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;
font-family:"Arial","sans-serif";color:black'>Charles,<br>
It works perfectly now. Excellent example you provided. I had previous
read the tutorial provided, but never really understood the implications of it
all until I saw your example. It makes perfect sense now.
Thanks so much for taking the time to help. Would have never
figured it out on my own. <o:p></o:p></span></p>
<div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'>Thanks again,<br>
Mark<o:p></o:p></span></p>
</div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><br>
<br>
----- Original Message -----<br>
From: Charles Seman <br>
To: GrADS Users Forum <br>
Sent: Wed, 21 Apr 2010 23:47:00 +0000 (UTC)<br>
Subject: Re: [gradsusr] Pass Data via the 'Return' Expression<br>
<br>
Hi Mark,<br>
<br>
Please find attached main.gs (calling script) and add1.gsf (GrADS script <br>
function).<br>
<br>
***********************<br>
* Main script<br>
***********************<br>
<br>
rc = gsfallow("on")<br>
<br>
iVal = 1<br>
<br>
say 'iVal = 'iVal<br>
say 'Making Call to GrADS script function "add1"'<br>
<br>
oVal = add1(iVal)<br>
<br>
say 'Call Made - Checking for Answer'<br>
<br>
say 'oVal = 'oVal<br>
<br>
Try using GrADS main script as follows:<br>
<br>
ga-> main.gs<br>
iVal = 1<br>
Making Call to GrADS script function "add1"<br>
input val = 1<br>
new val = 2<br>
Passing Variable Back to Main Script<br>
Call Made - Checking for Answer<br>
oVal = 2<br>
<br>
<br>
in main.gs, a call is made to an external user-defined script function <br>
"add1.gsf" (<a href="http://grads.iges.org/grads/gadoc/gsf.html"
target="_blank">http://grads.iges.org/grads/gadoc/gsf.html</a>) and can
be <br>
called from *outside* of main.gs because of "rc =
gsfallow("on")" in <br>
main.gs and because of the suffix "gsf" for "add1.gsf"...<br>
<br>
first, if only the line "rc = gsfallow("on")" is commented
out (add1.gsf <br>
exists), the result (you can try this):<br>
ga-> main.gs<br>
iVal = 1<br>
Making Call to GrADS script function "add1"<br>
Function not found:
add1 <br>
Error occurred on line 12<br>
In file main.gs<br>
<br>
next, if the line "rc = gsfallow("on")" is active, but
add1.gsf is <br>
renamed to add1.gs (you can try this):<br>
ga-> main.gs<br>
iVal = 1<br>
Making Call to GrADS script function "add1"<br>
Function not found:
add1 <br>
Error occurred on line 12<br>
In file main.gs<br>
<br>
Hope this helps,<br>
Chuck<br>
<br>
Mark Sponsler wrote:<br>
><br>
> Hi Chales,<br>
> I took a look at the script you referenced and was similar to others <br>
> I've seen where the main script and the subscripts are all encased
in <br>
> the same physical file. What I'm trying to accomplish is to
have a <br>
> main script in one directory and a bunch of scripts of comomonly
used <br>
> routines in a separate directory. The idea is to have the main
script <br>
> call one of the common routines, then have the common routine pass <br>
> some variable data back to the main script for additional
processing. <br>
><br>
> Below is a simple example with both scripts in the same directory.
The <br>
> problem is the value _val1 never gets returned to
the main script. <br>
> I'm using Grads 1.9 on WinXP.<br>
><br>
> Any thoughts or ideas would be welcome!<br>
><br>
> ***********************<br>
> * Main script<br>
> ***********************<br>
><br>
> rc = gsfallow("on")<br>
><br>
> val = 1<br>
><br>
> say 'Val = 'val<br>
> say 'Making Call to Test_Call'<br>
><br>
> 'run test_call.gs 1'<br>
><br>
> say 'Call Made - Checking for Answer'<br>
><br>
> say 'New val = '_val1<br>
><br>
><br>
> Here's the called script<br>
> ************************<br>
> * Seconadry Script<br>
> ************************<br>
> function main (args)<br>
> if (args='')<br>
> say 'No argument provided. Argument must be a value
1-10'<br>
> return<br>
> else<br>
> val = subwrd(args,1)<br>
> endif<br>
><br>
> say 'Val = 'val<br>
><br>
> _val1 = (val + 1)<br>
><br>
> say 'New Val = '_val1<br>
><br>
> say 'Passing Variable Back to Main Script'<br>
><br>
> return(_val1)<br>
><br>
> Thanks,<br>
> Mark<br>
><br>
><br>
> ----- Original Message -----<br>
> From: Charles Seman<br>
> To: GrADS Users Forum<br>
> Sent: Tue, 20 Apr 2010 21:21:12 +0000 (UTC)<br>
> Subject: Re: [gradsusr] Pass Data via the 'Return' Expression<br>
><br>
> Mark,<br>
><br>
> Don't know if you have resolved this yet, but Bob Hart's
"plotskew.gs"<br>
> script has examples of what it appears that you want to do:<br>
> <a href="http://www.iges.org/grads/gadoc/library" target="_blank">http://www.iges.org/grads/gadoc/library</a><br>
> <a href="about:blank" target="_blank">ftp://grads.iges.org/grads/scripts/plotskew.gs</a><br>
><br>
> Hope this helps,<br>
> Chuck<br>
><br>
> Mark Sponsler wrote:<br>
> ><br>
> > I have a script that calls a second script (and passes some arguments<br>
> > to it). That works fine. I'm trying to get the second script to
return<br>
> > some data back to the first script, but am having
difficulty. I use<br>
> > the 'return' command to have the second script return control back
the<br>
> > first script, but cannot seem to get any variable data to pass with<br>
> > it. It seems this is possible per the Grads documentation:<br>
> ><br>
> > <br>
> ><br>
> > <br>
> ><br>
> > To return from a function, use the |return| command:<br>
> ><br>
> > |return /expression/|<br>
> ><br>
> > The |/expression/| is optional; if not
provided, a NULL string<br>
> > will be returned. (A null string is: '') The
result of the<br>
> > function is the result of the expression
specified on the return<br>
> > command.<br>
> ><br>
> > <br>
> ><br>
> > In the second script, the last line is:<br>
> ><br>
> > <br>
> ><br>
> > return val1<br>
> ><br>
> > <br>
> ><br>
> > Where val1 is a variable string<br>
> ><br>
> > <br>
> ><br>
> > Just can't seem to get the first script to read the contents of<br>
> > val1. Could always write the data to a file, but am looking for<br>
> > something a little more elegant.<br>
> ><br>
> ><br>
> > <br>
> ><br>
> > Any help would be appreciated,<br>
> > Mark<br>
> ><br>
> >
------------------------------------------------------------------------<br>
> ><br>
> > _______________________________________________<br>
> > gradsusr mailing list<br>
> > <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> > <a href="http://gradsusr.org/mailman/listinfo/gradsusr"
target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> > <br>
><br>
> -- <br>
><br>
> Please note that <a href="mailto:Charles.Seman@noaa.gov"
target="_blank">Charles.Seman@noaa.gov</a> should be considered my NOAA<br>
> email address, not <a href="mailto:cjs@gfdl.noaa.gov" target="_blank">cjs@gfdl.noaa.gov</a>.<br>
><br>
> ********************************************************************<br>
> Charles
Seman <a
href="mailto:Charles.Seman@noaa.gov" target="_blank">Charles.Seman@noaa.gov</a><br>
> U.S. Department of Commerce / NOAA / OAR<br>
> Geophysical Fluid Dynamics
Laboratory voice: (609)
452-6547<br>
> 201 Forrestal
Road fax:
(609) 987-5063<br>
> Princeton,
NJ 08540-6649 <a
href="http://www.gfdl.noaa.gov/~cjs/" target="_blank">http://www.gfdl.noaa.gov/~cjs/</a><br>
> ********************************************************************<br>
><br>
> "The contents of this message are mine personally and do not reflect
any<br>
> official or unofficial position of the United States Federal Government,<br>
> the United States Department of Commerce, or NOAA."<br>
><br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr"
target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> gradsusr mailing list<br>
> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr"
target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> <br>
<br>
-- <br>
<br>
Please note that <a href="mailto:Charles.Seman@noaa.gov" target="_blank">Charles.Seman@noaa.gov</a> should
be considered my NOAA<br>
email address, not <a href="mailto:cjs@gfdl.noaa.gov" target="_blank">cjs@gfdl.noaa.gov</a>.<br>
<br>
********************************************************************<br>
Charles
Seman <a
href="mailto:Charles.Seman@noaa.gov" target="_blank">Charles.Seman@noaa.gov</a><br>
U.S. Department of Commerce / NOAA / OAR<br>
Geophysical Fluid Dynamics
Laboratory voice: (609)
452-6547<br>
201 Forrestal
Road fax:
(609) 987-5063<br>
Princeton, NJ 08540-6649 <a
href="http://www.gfdl.noaa.gov/~cjs/" target="_blank">http://www.gfdl.noaa.gov/~cjs/</a><br>
********************************************************************<br>
<br>
"The contents of this message are mine personally and do not reflect any<br>
official or unofficial position of the United States Federal Government,<br>
the United States Department of Commerce, or NOAA."<br>
<br>
_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
http://gradsusr.org/mailman/listinfo/gradsusr<o:p></o:p></span></p>
</div>
</blockquote>
</div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><o:p> </o:p></span></p>
</div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><br>
_______________________________________________ gradsusr mailing list
gradsusr@gradsusr.org http://gradsusr.org/mailman/listinfo/gradsusr <o:p></o:p></span></p>
</div>
</div>
</div>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:black'><br>
_______________________________________________ gradsusr mailing list
gradsusr@gradsusr.org http://gradsusr.org/mailman/listinfo/gradsusr <o:p></o:p></span></p>
</div>
</div>
</body>
</html>