<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Aaron:<br>
    <br>
    Alright, sublin actually returns two lines, a return code (line 1)
    and the value (line 2), so "sublin(d,1)" is incorrect.&nbsp; Can you try
    this:<br>
    <br>
    '!date +"%Y%m%d" &gt; date.formatted'<br>
    d = read('date.formatted')<br>
    sysdate = sublin(d,2)<br>
    'draw string 4.0 4.0 'sysdate<br>
    <br>
    If you save this to a script and run it, you should get the date as
    a string right in the center of the GrADS display window.&nbsp; If this<br>
    works we can at least eliminate the "date" and re-direct issues.<br>
    <br>
    Jim<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 12/26/13 2:35 PM, Perry, Aaron @ LSC
      wrote:<br>
    </div>
    <blockquote
cite="mid:DEE427CC71C1184E9F7C903BF1EEE7A802BD1123@LSC-EX10MBX03.lsc.vsc.edu"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div style="direction: ltr;font-family: Tahoma;color:
        #000000;font-size: 10pt;">
        <div style="direction:ltr; font-family:Tahoma; color:#000000;
          font-size:10pt">Hi Jim,<br>
          <br>
          I really appreciate all the assistance with this date issue. <br>
          <br>
          Unfortunately, using sublin(d,1) absolutely refuses to work
          for me so, I think I'm just going to try setting the date
          outside of GrADS before I run my script:<br>
          <br>
          Ex:<b><br>
            <br>
            <u>In bash script:</u><br>
          </b><br>
          YMD=`date +%Y%m%d`<br>
          <br>
          grads -clb "run ${HOMEDIR}${PATH3}500gph_${FHR0}.gs ${YMD}<br>
          <u><b><br>
              In GrADS .gs script:</b></u><br>
          <br>
          function pull (args)<br>
          <br>
          currdate = subwrd(args,1)<br>
          <br>
          <br>
          Believe it or not, I'm still having an issue where "No Files
          Open" still popping up when GrADS is run and the valid
          forecast hour not showing up on my plots. I've attached a
          sample of what's happening to this email and an updated
          version of the script. I feel like the issue is with fdate and
          fday from 'q time' but, from what I can tell the coding checks
          out.<br>
          <br>
          This is becoming quite frustrating...<br>
          <br>
          <div><br>
            <div style="font-family:Tahoma; font-size:13px">
              <div style="font-family:Tahoma; font-size:13px">
                <div style="font-family:Tahoma; font-size:13px">
                  <div style="font-family:Tahoma; font-size:13px">
                    <div style="font-family:Tahoma; font-size:13px">
                      <div style="font-family:Tahoma; font-size:13px"><font
                          size="3"><font face="Arial"><font
                              face="Tahoma" size="2"><font size="2">Onward
                                and Upward,<br>
                                <br>
                              </font>Aaron Perry<br>
                            </font><font size="3"><font size="3"><font
                                  face="Tahoma" size="2">Boston, MA<br>
                                  Mobile: 617-780-4312</font><br>
                              </font></font></font></font></div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div style="font-family:Times New Roman; color:#000000;
            font-size:16px">
            <hr tabindex="-1">
            <div id="divRpF572849" style="direction:ltr"><font
                color="#000000" face="Tahoma" size="2"><b>From:</b>
                <a class="moz-txt-link-abbreviated" href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>
                [<a class="moz-txt-link-abbreviated" href="mailto:gradsusr-bounces@gradsusr.org">gradsusr-bounces@gradsusr.org</a>] on behalf of James T.
                Potemra [<a class="moz-txt-link-abbreviated" href="mailto:jimp@hawaii.edu">jimp@hawaii.edu</a>]<br>
                <b>Sent:</b> Thursday, December 26, 2013 6:11 PM<br>
                <b>To:</b> GrADS Users Forum<br>
                <b>Subject:</b> Re: [gradsusr] "No Files Open" When
                Running In Batch Mode<br>
              </font><br>
            </div>
            <div>Hi Aaron:<br>
              <br>
              Just to be clear, in your script the line '!date +.....'
              will create a single line file with the date as the single
              line, e.g., 20131226.&nbsp; Then, the third line in<br>
              your script is sysdate = sublin(d,2) which is trying to
              read the second line of the file created (which I think
              should only have one line).&nbsp; So, you should
              <br>
              change this third line (I think) to:<br>
              <br>
              sysdate = sublin(d,1)<br>
              <br>
              Next, you have an issue with the "date" command redirect.&nbsp;
              On most operating systems a "&gt;&gt;" (double) will
              append to an existing file, and a
              <br>
              "&gt;!" will overwrite the file.&nbsp; The single "&gt;" is
              different on different systems, on some it overwrites and
              on others it appends.&nbsp; So, ideally I think<br>
              you want a "&gt;!" since a "&gt;&gt;" will append to a
              file, but you are always reading the same line (hope that
              makes sense).&nbsp; Finally, at least on my<br>
              system the grads script is reading the single quote in the
              date command as a termination of the command.&nbsp; So, I think
              what you really want is:<br>
              <br>
              '!date +"%Y%m%d" &gt;!
              /home/muaddib/grads/date/date.formatted'<br>
              d = read('/home/muaddib/grads/date/date.formatted')<br>
              sysdate = sublin(d,1)<br>
              <br>
              However, the ! part of &gt;! is apparently not allowed in
              the Grads script (I think the ! means to escape from grads
              for a system command).&nbsp; So,<br>
              if you can confirm that a single "&gt;" will overwrite a
              file, and change the sublin(d,2) to sublin(d,1) you are
              probably ok:<br>
              <br>
              '!date +'%Y%m%d' &gt;
              /home/muaddib/grads/date/date.formatted'<br>
              d = read('/home/muaddib/grads/date/date.formatted')<br>
              sysdate = sublin(d,1)<br>
              <br>
              Jim<br>
              <br>
              <div class="moz-cite-prefix">On 12/26/13 12:18 PM, Perry,
                Aaron @ LSC wrote:<br>
              </div>
              <blockquote type="cite">
                <div style="direction:ltr; font-family:Tahoma;
                  color:#000000; font-size:10pt">Hi Jim,<br>
                  <br>
                  I tried the changes that you suggested and
                  unfortunately I still have the same problem. I also
                  tried just entering the actual date instead of trying
                  to set a command to create the current date, didn't
                  work.<br>
                  <br>
                  Adding the " " around !date +%Y%m%d seemed to help and
                  so did doing just one "&gt;" but, when I tried
                  changing &gt;&gt; to &gt;!, I kept getting this error
                  message "date: extra operand
                  `/home/muaddib/grads/date/date.formatted' Try `date
                  --help` for more information" and then it goes back to
                  the usual "No Files Open No files open" message.<br>
                  <br>
                  Could you elaborate a little bit more about the
                  .bashrc approach? In my bash script, I'm defining the
                  date variable as "YMD=`date +%Y%m%d` to pull .grib2
                  data via wget and then convert it through g2ctl and
                  gribmap. I wouldn't think that would affect GrADS,
                  right?<br>
                  <br>
                  Here's the part in the bash script where I'm running
                  GrADS:<br>
                  <br>
                  <b>GRADS=/usr/local/lib/grads/./grads<br>
                    PATH3=/grads/scripts/gem/25km/12/<br>
                    FHR0=000<br>
                    HOMEDIR=/home/muaddib<br>
                    <br>
                    ${GRADS} -clb "run
                    ${HOMEDIR}${PATH3}500GPH_${FHR0}.gs"</b><br>
                  <br>
                  <div><br>
                    <div style="font-family:Tahoma; font-size:13px">
                      <div style="font-family:Tahoma; font-size:13px">
                        <div style="font-family:Tahoma; font-size:13px">
                          <div style="font-family:Tahoma;
                            font-size:13px">
                            <div style="font-family:Tahoma;
                              font-size:13px">
                              <div style="font-family:Tahoma;
                                font-size:13px"><font size="3"><font
                                    face="Arial"><font face="Tahoma"
                                      size="2"><font size="2">Onward and
                                        Upward,<br>
                                        <br>
                                      </font>Aaron Perry<br>
                                    </font><font size="3"><font size="3"><font
                                          face="Tahoma" size="2">Boston,
                                          MA<br>
                                          Mobile: 617-780-4312</font><br>
                                      </font></font></font></font></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div style="font-family:Times New Roman;
                    color:#000000; font-size:16px">
                    <hr tabindex="-1">
                    <div id="divRpF490290" style="direction:ltr"><font
                        color="#000000" face="Tahoma" size="2"><b>From:</b>
                        <a moz-do-not-send="true"
                          class="moz-txt-link-abbreviated"
                          href="mailto:gradsusr-bounces@gradsusr.org"
                          target="_blank">
                          gradsusr-bounces@gradsusr.org</a> [<a
                          moz-do-not-send="true"
                          class="moz-txt-link-abbreviated"
                          href="mailto:gradsusr-bounces@gradsusr.org"
                          target="_blank">gradsusr-bounces@gradsusr.org</a>]
                        on behalf of James T. Potemra [<a
                          moz-do-not-send="true"
                          class="moz-txt-link-abbreviated"
                          href="mailto:jimp@hawaii.edu" target="_blank">jimp@hawaii.edu</a>]<br>
                        <b>Sent:</b> Thursday, December 26, 2013 4:06 PM<br>
                        <b>To:</b> GrADS Users Forum<br>
                        <b>Subject:</b> Re: [gradsusr] "No Files Open"
                        When Running In Batch Mode<br>
                      </font><br>
                    </div>
                    <div>Aaron:<br>
                      <br>
                      I think the problem is with the "date" command.&nbsp;
                      You can test this with<br>
                      specifying the date (replace the top lines with a
                      constant date).&nbsp; If this<br>
                      is indeed the case, some suggestions:<br>
                      <br>
                      1.&nbsp; Try with double quotes around the arguments to
                      date, e.g.,<br>
                      <br>
                      '!date +"%Y%m%d" &gt;&gt;
                      /home/muaddib/grads/date/date.formatted'<br>
                      <br>
                      I think you want a date like 20131226, but with
                      single quotes around<br>
                      the argument I think you'll get something like
                      "Ymd".<br>
                      <br>
                      2.&nbsp; Is it possible you have two different "date"
                      commands?&nbsp; It could<br>
                      be running in batch mode is using a different path
                      that when you are<br>
                      running interactively (e.g., you have a .bashrc or
                      .cshrc that is not<br>
                      accessed in batch mode).<br>
                      <br>
                      3.&nbsp; The &gt;&gt; syntax will append the output to
                      file date.formatted,<br>
                      but your script is always accessing the second
                      line of this file:<br>
                      sysdate = sublin(d,2)<br>
                      Not sure why you have this.&nbsp; Have you tried &gt;!
                      to overwrite the<br>
                      file, then read the first line?<br>
                      <br>
                      Jim<br>
                      <br>
                      <br>
                      <div class="moz-cite-prefix">On 12/26/13 8:46 AM,
                        Perry, Aaron @ LSC wrote:<br>
                      </div>
                      <blockquote type="cite">
                        <style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
body
        {direction:ltr;
        font-family:Tahoma;
        color:#000000;
        font-size:10pt}
p
        {margin-top:0;
        margin-bottom:0}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {direction:ltr;
        font-family:Tahoma;
        color:#000000;
        font-size:10pt}
p
        {margin-top:0;
        margin-bottom:0}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
body
        {scrollbar-base-color:undefined;
        scrollbar-highlight-color:undefined;
        scrollbar-darkshadow-color:undefined;
        scrollbar-arrow-color:undefined}
-->
BODY {direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;}P {margin-top:0;margin-bottom:0;}BODY {scrollbar-base-color:undefined;scrollbar-highlight-color:undefined;scrollbar-darkshadow-color:undefined;scrollbar-track-color:undefined;scrollbar-arrow-color:undefined}</style>
                        <div style="direction:ltr; font-family:Tahoma;
                          color:#000000; font-size:10pt">Good Afternoon
                          Jennifer,<br>
                          <br>
                          Thanks for the reply! Sorry about not
                          attaching the script that I'm having issues
                          with!<br>
                          <br>
                          I've attached it to this email.<br>
                          <div><br>
                            <div style="font-family:Tahoma;
                              font-size:13px">
                              <div style="font-family:Tahoma;
                                font-size:13px">
                                <div style="font-family:Tahoma;
                                  font-size:13px">
                                  <div style="font-family:Tahoma;
                                    font-size:13px">
                                    <div style="font-family:Tahoma;
                                      font-size:13px">
                                      <div style="font-family:Tahoma;
                                        font-size:13px"><font size="3"><font
                                            face="Arial"><font
                                              face="Tahoma" size="2"><font
                                                size="2"><br>
                                                Onward and Upward,<br>
                                                <br>
                                              </font>Aaron Perry<br>
                                            </font><font size="3"><font
                                                size="3"><font
                                                  face="Tahoma" size="2">Boston,
                                                  MA<br>
                                                  Mobile: 617-780-4312</font><br>
                                              </font></font></font></font></div>
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                          <div style="font-family:Times New Roman;
                            color:#000000; font-size:16px">
                            <hr tabindex="-1">
                            <div id="divRpF123183" style="direction:ltr"><font
                                color="#000000" face="Tahoma" size="2"><b>From:</b>
                                <a moz-do-not-send="true"
                                  class="moz-txt-link-abbreviated"
                                  href="mailto:gradsusr-bounces@gradsusr.org"
                                  target="_blank">
                                  gradsusr-bounces@gradsusr.org</a> [<a
                                  moz-do-not-send="true"
                                  class="moz-txt-link-abbreviated"
                                  href="mailto:gradsusr-bounces@gradsusr.org"
                                  target="_blank">gradsusr-bounces@gradsusr.org</a>]
                                on behalf of Jennifer Adams [<a
                                  moz-do-not-send="true"
                                  class="moz-txt-link-abbreviated"
                                  href="mailto:jma@cola.iges.org"
                                  target="_blank">jma@cola.iges.org</a>]<br>
                                <b>Sent:</b> Thursday, December 26, 2013
                                10:05 AM<br>
                                <b>To:</b> GrADS Users Forum<br>
                                <b>Subject:</b> Re: [gradsusr] "No Files
                                Open" When Running In Batch Mode<br>
                              </font><br>
                            </div>
                            <div>You've probably got a 'q time' command
                              in your script before you open any files,
                              or after you open a file with some error.
                              But without knowing what script you're
                              running on startup, it's impossible to
                              help any further.
                              <div>--Jennifer</div>
                              <div><br>
                                <div><br>
                                  <div>
                                    <div>On Dec 26, 2013, at 12:56 AM,
                                      Perry, Aaron @ LSC wrote:</div>
                                    <br
                                      class="Apple-interchange-newline">
                                    <blockquote type="cite"><span
                                        class="Apple-style-span"
                                        style="border-collapse:separate;
                                        font-family:Helvetica;
                                        font-style:normal;
                                        font-variant:normal;
                                        font-weight:normal;
                                        letter-spacing:normal;
                                        line-height:normal; orphans:2;
                                        text-indent:0px;
                                        text-transform:none;
                                        white-space:normal; widows:2;
                                        word-spacing:0px;
                                        font-size:medium">
                                        <div>
                                          <div style="direction:ltr;
                                            font-family:Tahoma;
                                            color:rgb(0,0,0);
                                            font-size:10pt">
                                            Good Morning All,<br>
                                            <br>
                                            Currently, I'm having an
                                            issue where "No Files Open"
                                            pops up every time that I
                                            run GrADS in Batch Mode
                                            (grads -clb).<span
                                              class="Apple-converted-space">&nbsp;</span><br>
                                            <br>
                                            This results in the Valid
                                            Forecast Time not being
                                            displayed on my plots. At
                                            first, I thought that it was
                                            an issue of the 'set t 1'
                                            placement after 'reinit', as
                                            I'm using g2ctl/gribmap ctl
                                            files.<br>
                                            <br>
                                            I've sort of narrowed this
                                            down to just a batch mode
                                            problem because, when I open
                                            the .gs file with 'grads -l'
                                            , "No Files Open" does not
                                            pop up and the Valid
                                            Forecast Time shows up on
                                            the plot.<br>
                                            <br>
                                            Has anybody else had this
                                            issue before?<br>
                                            <br>
                                            <br>
                                            <div><br>
                                              <div
                                                style="font-family:Tahoma;
                                                font-size:13px">
                                                <div
                                                  style="font-family:Tahoma;
                                                  font-size:13px">
                                                  <div
                                                    style="font-family:Tahoma;
                                                    font-size:13px">
                                                    <div
                                                      style="font-family:Tahoma;
                                                      font-size:13px">
                                                      <div
                                                        style="font-family:Tahoma;
                                                        font-size:13px">
                                                        <div
                                                          style="font-family:Tahoma;
font-size:13px"><font size="3"><font face="Arial"><font face="Tahoma"
                                                          size="2"><font
                                                          size="2">Onward
                                                          and Upward,<br>
                                                          <br>
                                                          </font>Aaron
                                                          Perry<br>
                                                          </font><font
                                                          size="3"><font
                                                          size="3"><font
                                                          face="Tahoma"
                                                          size="2">Boston,
                                                          MA<br>
                                                          Mobile:
                                                          617-780-4312</font><br>
                                                          </font></font></font></font></div>
                                                      </div>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </div>
                                          </div>
_______________________________________________<br>
                                          gradsusr mailing list<br>
                                          <a moz-do-not-send="true"
                                            href="mailto:gradsusr@gradsusr.org"
                                            target="_blank">gradsusr@gradsusr.org</a><br>
                                          <a moz-do-not-send="true"
                                            href="http://gradsusr.org/mailman/listinfo/gradsusr"
                                            target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
                                        </div>
                                      </span></blockquote>
                                  </div>
                                  <br>
                                  <div><span class="Apple-style-span"
                                      style="border-collapse:separate;
                                      color:rgb(0,0,0);
                                      font-family:Helvetica;
                                      font-style:normal;
                                      font-variant:normal;
                                      font-weight:normal;
                                      letter-spacing:normal;
                                      line-height:normal; orphans:2;
                                      text-indent:0px;
                                      text-transform:none;
                                      white-space:normal; widows:2;
                                      word-spacing:0px;
                                      font-size:medium"><span
                                        class="Apple-style-span"
                                        style="border-collapse:separate;
                                        color:rgb(0,0,0);
                                        font-family:Helvetica;
                                        font-size:12px;
                                        font-style:normal;
                                        font-variant:normal;
                                        font-weight:normal;
                                        letter-spacing:normal;
                                        line-height:normal;
                                        text-indent:0px;
                                        text-transform:none; orphans:2;
                                        white-space:normal; widows:2;
                                        word-spacing:0px">
                                        <div
                                          style="word-wrap:break-word"><span
                                            class="Apple-style-span"
                                            style="border-collapse:separate;
                                            color:rgb(0,0,0);
                                            font-family:Helvetica;
                                            font-size:12px;
                                            font-style:normal;
                                            font-variant:normal;
                                            font-weight:normal;
                                            letter-spacing:normal;
                                            line-height:normal;
                                            text-indent:0px;
                                            text-transform:none;
                                            orphans:2;
                                            white-space:normal;
                                            widows:2; word-spacing:0px"><span
                                              class="Apple-style-span"
                                              style="border-collapse:separate;
                                              color:rgb(0,0,0);
                                              font-family:Helvetica;
                                              font-size:12px;
                                              font-style:normal;
                                              font-variant:normal;
                                              font-weight:normal;
                                              letter-spacing:normal;
                                              line-height:normal;
                                              text-indent:0px;
                                              text-transform:none;
                                              orphans:2;
                                              white-space:normal;
                                              widows:2;
                                              word-spacing:0px">
                                              <div>--</div>
                                              <div>Jennifer M. Adams<br>
                                                Center for
                                                Ocean-Land-Atmosphere
                                                Studies (COLA)<br>
                                                111 Research Hall, Mail
                                                Stop 2B3<br>
                                                George Mason University<br>
                                                4400 University Drive<br>
                                                Fairfax, VA 22030&nbsp;<br>
                                                <br>
                                              </div>
                                              <div><br
                                                  class="khtml-block-placeholder">
                                              </div>
                                              <br
                                                class="Apple-interchange-newline">
                                            </span></span></div>
                                      </span></span><br
                                      class="Apple-interchange-newline">
                                  </div>
                                  <br>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                        <br>
                        <fieldset class="mimeAttachmentHeader"
                          target="_blank"></fieldset>
                        <br>
                        <pre>_______________________________________________
gradsusr mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
                      </blockquote>
                      <br>
                    </div>
                  </div>
                </div>
                <br>
                <fieldset class="mimeAttachmentHeader" target="_blank"></fieldset>
                <br>
                <pre>_______________________________________________
gradsusr mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
              </blockquote>
              <br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
gradsusr mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a>
<a class="moz-txt-link-freetext" href="http://gradsusr.org/mailman/listinfo/gradsusr">http://gradsusr.org/mailman/listinfo/gradsusr</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>