<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="&#1;" 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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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(&quot;dirlist&quot;)</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 &quot;do_eof.gs&quot; 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(&quot;on&quot;)</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(&quot;math1 string2&quot;) </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>&nbsp;</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>&nbsp;</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>&nbsp;</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&nbsp;is here: c:/grib/a/main_script.gs&nbsp;&nbsp;and the
called&nbsp;script is&nbsp;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'>&nbsp;<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'>&nbsp;<o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>rc =
gsfpath(&quot;../b&quot;) </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'>&nbsp;<o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:"Courier New";color:black'>Unfortunately&nbsp;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'>&nbsp;<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.&nbsp;&nbsp;</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'>&nbsp;<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'>&nbsp;<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: &quot;John Huddleston&quot; &lt;Huddleston@cira.colostate.edu&gt;<br>
To: &quot;GrADS Users Forum&quot; &lt;gradsusr@gradsusr.org&gt;<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'>&nbsp;<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&nbsp;Cygwin &quot;UNIX&quot; style of
paths. So, if you want to go up one directory and then down into another, use
the &quot;..&quot; parent directory. The &quot;.&quot; 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'>&nbsp;<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.&nbsp; I am using gfsallow right now, and it works fine if
the 'b' script is in the same directory as the 'a' script.&nbsp;<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&nbsp;in a different
directory.&nbsp;I'm&nbsp;trying to set up&nbsp;a bunch&nbsp;of common scripts
in a standalone directory, so they can be accessed from any grads script
elswhere on the drive.&nbsp;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'>&nbsp;<o:p></o:p></span></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>I'm
trying to&nbsp;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'>&nbsp;<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&nbsp;&nbsp;&nbsp;(and executed from that
location), &nbsp;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'>&nbsp;<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 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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(&quot;./b&quot;) 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'>&nbsp;<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.&nbsp;</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>&nbsp;</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: &quot;Brian Doty&quot; &lt;doty@cola.iges.org&gt;<br>
To: &quot;GrADS Users Forum&quot; &lt;gradsusr@gradsusr.org&gt;<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 &quot;gsfallow&quot; 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>&nbsp;</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'>&quot;run myscript.gs
&quot;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>&nbsp;</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&nbsp;</span></span><span
style='font-size:10.0pt;font-family:"Arial","sans-serif";color:black'>variable.&nbsp;<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>&nbsp;</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>&nbsp;</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>&nbsp;</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'>&quot;run b.gs testing&quot;</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
&quot;---&gt;&quot;result&quot;&lt;---&quot;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</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'>----&gt;testing&lt;----</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>&nbsp;</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>&nbsp;</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>&nbsp;</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.&nbsp; Excellent example you provided. I had previous
read the tutorial provided, but never really understood the implications of it
all&nbsp;until I saw your example.&nbsp;It makes perfect sense now.&nbsp;
Thanks so much for taking the time to help.&nbsp; &nbsp;Would have never
figured it out on my own. &nbsp;&nbsp;<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&nbsp;<br>
To: GrADS Users Forum&nbsp;<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&nbsp;<br>
function).<br>
<br>
***********************<br>
* Main script<br>
***********************<br>
<br>
rc = gsfallow(&quot;on&quot;)<br>
<br>
iVal = 1<br>
<br>
&nbsp;&nbsp;say 'iVal = 'iVal<br>
&nbsp;&nbsp;say 'Making Call to GrADS script function &quot;add1&quot;'<br>
<br>
oVal = add1(iVal)<br>
<br>
&nbsp;&nbsp;say 'Call Made - Checking for Answer'<br>
<br>
&nbsp;&nbsp;say 'oVal = 'oVal<br>
<br>
Try using GrADS main script as follows:<br>
<br>
ga-&gt; main.gs<br>
iVal = 1<br>
Making Call to GrADS script function &quot;add1&quot;<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&nbsp;<br>
&quot;add1.gsf&quot; (<a href="http://grads.iges.org/grads/gadoc/gsf.html"
target="_blank">http://grads.iges.org/grads/gadoc/gsf.html</a>) and can
be&nbsp;<br>
called from *outside* of main.gs because of &quot;rc =
gsfallow(&quot;on&quot;)&quot; in&nbsp;<br>
main.gs and because of the suffix &quot;gsf&quot; for &quot;add1.gsf&quot;...<br>
<br>
first, if only the line &quot;rc = gsfallow(&quot;on&quot;)&quot; is commented
out (add1.gsf&nbsp;<br>
exists), the result (you can try this):<br>
ga-&gt; main.gs<br>
iVal = 1<br>
Making Call to GrADS script function &quot;add1&quot;<br>
Function not found:
add1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;Error occurred on line 12<br>
&nbsp;&nbsp;In file main.gs<br>
<br>
next, if the line &quot;rc = gsfallow(&quot;on&quot;)&quot; is active, but
add1.gsf is&nbsp;<br>
renamed to add1.gs (you can try this):<br>
ga-&gt; main.gs<br>
iVal = 1<br>
Making Call to GrADS script function &quot;add1&quot;<br>
Function not found:
add1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;Error occurred on line 12<br>
&nbsp;&nbsp;In file main.gs<br>
<br>
Hope this helps,<br>
Chuck<br>
<br>
Mark Sponsler wrote:<br>
&gt;<br>
&gt; Hi Chales,<br>
&gt; I took a look at the script you referenced and was similar to others&nbsp;<br>
&gt; I've seen where the main script and the subscripts are all encased
in&nbsp;<br>
&gt; the same physical file.&nbsp;&nbsp;What I'm trying to accomplish is to
have a&nbsp;<br>
&gt; main script in one directory and a bunch of scripts of comomonly
used&nbsp;<br>
&gt; routines in a separate directory. The idea is to have the main
script&nbsp;<br>
&gt; call one of the common routines, then have the common routine pass&nbsp;<br>
&gt; some variable data back to the main script for additional
processing.&nbsp;<br>
&gt;<br>
&gt; Below is a simple example with both scripts in the same directory.
The&nbsp;<br>
&gt; problem is the value&nbsp;&nbsp;_val1&nbsp;&nbsp;never gets returned to
the main script.&nbsp;&nbsp;<br>
&gt; I'm using Grads 1.9 on WinXP.<br>
&gt;<br>
&gt; Any thoughts or ideas would be welcome!<br>
&gt;<br>
&gt; ***********************<br>
&gt; * Main script<br>
&gt; ***********************<br>
&gt;<br>
&gt; rc = gsfallow(&quot;on&quot;)<br>
&gt;<br>
&gt; val = 1<br>
&gt;<br>
&gt;&nbsp;&nbsp; say 'Val = 'val<br>
&gt;&nbsp;&nbsp; say 'Making Call to Test_Call'<br>
&gt;<br>
&gt; 'run test_call.gs 1'<br>
&gt;<br>
&gt;&nbsp;&nbsp; say 'Call Made - Checking for Answer'<br>
&gt;<br>
&gt;&nbsp;&nbsp; say 'New val = '_val1<br>
&gt;<br>
&gt;<br>
&gt; Here's the called script<br>
&gt; ************************<br>
&gt; * Seconadry Script<br>
&gt; ************************<br>
&gt; function main (args)<br>
&gt; if (args='')<br>
&gt;&nbsp;&nbsp; say 'No argument provided.&nbsp;&nbsp;Argument must be a value
1-10'<br>
&gt;&nbsp;&nbsp; return<br>
&gt; else<br>
&gt;&nbsp;&nbsp; val = subwrd(args,1)<br>
&gt; endif<br>
&gt;<br>
&gt;&nbsp;&nbsp;say 'Val = 'val<br>
&gt;<br>
&gt; _val1 = (val + 1)<br>
&gt;<br>
&gt;&nbsp;&nbsp;say 'New Val = '_val1<br>
&gt;<br>
&gt;&nbsp;&nbsp;say 'Passing Variable Back to Main Script'<br>
&gt;<br>
&gt;&nbsp;&nbsp; return(_val1)<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Mark<br>
&gt;<br>
&gt;<br>
&gt; ----- Original Message -----<br>
&gt; From: Charles Seman<br>
&gt; To: GrADS Users Forum<br>
&gt; Sent: Tue, 20 Apr 2010 21:21:12 +0000 (UTC)<br>
&gt; Subject: Re: [gradsusr] Pass Data via the 'Return' Expression<br>
&gt;<br>
&gt; Mark,<br>
&gt;<br>
&gt; Don't know if you have resolved this yet, but Bob Hart's
&quot;plotskew.gs&quot;<br>
&gt; script has examples of what it appears that you want to do:<br>
&gt;&nbsp;<a href="http://www.iges.org/grads/gadoc/library" target="_blank">http://www.iges.org/grads/gadoc/library</a><br>
&gt;&nbsp;<a href="about:blank" target="_blank">ftp://grads.iges.org/grads/scripts/plotskew.gs</a><br>
&gt;<br>
&gt; Hope this helps,<br>
&gt; Chuck<br>
&gt;<br>
&gt; Mark Sponsler wrote:<br>
&gt; &gt;<br>
&gt; &gt; I have a script that calls a second script (and passes some arguments<br>
&gt; &gt; to it). That works fine. I'm trying to get the second script to
return<br>
&gt; &gt; some data back to the first script, but am having
difficulty.&nbsp;&nbsp;I use<br>
&gt; &gt; the 'return' command to have the second script return control back
the<br>
&gt; &gt; first script, but cannot seem to get any variable data to pass with<br>
&gt; &gt; it. It seems this is possible per the Grads documentation:<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt; To return from a function, use the |return| command:<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; |return /expression/|<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; The |/expression/| is optional; if not
provided, a NULL string<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; will be returned. (A null string is: '') The
result of the<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; function is the result of the expression
specified on the return<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; command.<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt; In the second script, the last line is:<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt; return val1<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt; Where val1 is a variable string<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt; Just can't seem to get the first script to read the contents of<br>
&gt; &gt; val1. Could always write the data to a file, but am looking for<br>
&gt; &gt; something a little more elegant.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt; &gt;<br>
&gt; &gt; Any help would be appreciated,<br>
&gt; &gt; Mark<br>
&gt; &gt;<br>
&gt; &gt;
------------------------------------------------------------------------<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; gradsusr mailing list<br>
&gt; &gt;&nbsp;<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
&gt; &gt;&nbsp;<a href="http://gradsusr.org/mailman/listinfo/gradsusr"
target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
&gt; &gt;&nbsp;&nbsp;<br>
&gt;<br>
&gt; --&nbsp;<br>
&gt;<br>
&gt; Please note that&nbsp;<a href="mailto:Charles.Seman@noaa.gov"
target="_blank">Charles.Seman@noaa.gov</a>&nbsp;should be considered my NOAA<br>
&gt; email address, not&nbsp;<a href="mailto:cjs@gfdl.noaa.gov" target="_blank">cjs@gfdl.noaa.gov</a>.<br>
&gt;<br>
&gt; ********************************************************************<br>
&gt; Charles
Seman&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
href="mailto:Charles.Seman@noaa.gov" target="_blank">Charles.Seman@noaa.gov</a><br>
&gt; U.S. Department of Commerce / NOAA / OAR<br>
&gt; Geophysical Fluid Dynamics
Laboratory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; voice: (609)
452-6547<br>
&gt; 201 Forrestal
Road&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fax:
(609) 987-5063<br>
&gt; Princeton,
NJ&nbsp;&nbsp;08540-6649&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
href="http://www.gfdl.noaa.gov/~cjs/" target="_blank">http://www.gfdl.noaa.gov/~cjs/</a><br>
&gt; ********************************************************************<br>
&gt;<br>
&gt; &quot;The contents of this message are mine personally and do not reflect
any<br>
&gt; official or unofficial position of the United States Federal Government,<br>
&gt; the United States Department of Commerce, or NOAA.&quot;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; gradsusr mailing list<br>
&gt;&nbsp;<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
&gt;&nbsp;<a href="http://gradsusr.org/mailman/listinfo/gradsusr"
target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
&gt; ------------------------------------------------------------------------<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; gradsusr mailing list<br>
&gt;&nbsp;<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
&gt;&nbsp;<a href="http://gradsusr.org/mailman/listinfo/gradsusr"
target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
&gt;&nbsp;&nbsp;&nbsp;<br>
<br>
--&nbsp;<br>
<br>
Please note that&nbsp;<a href="mailto:Charles.Seman@noaa.gov" target="_blank">Charles.Seman@noaa.gov</a>&nbsp;should
be considered my NOAA<br>
email address, not&nbsp;<a href="mailto:cjs@gfdl.noaa.gov" target="_blank">cjs@gfdl.noaa.gov</a>.<br>
<br>
********************************************************************<br>
Charles
Seman&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; voice: (609)
452-6547<br>
201 Forrestal
Road&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fax:
(609) 987-5063<br>
Princeton, NJ&nbsp;&nbsp;08540-6649&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
href="http://www.gfdl.noaa.gov/~cjs/" target="_blank">http://www.gfdl.noaa.gov/~cjs/</a><br>
********************************************************************<br>
<br>
&quot;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.&quot;<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>&nbsp;</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>