[gradsusr] "No Files Open" When Running In Batch Mode

James T. Potemra jimp at hawaii.edu
Thu Dec 26 20:09:34 EST 2013


Also, it's not really clear in your function what the "args" are 
directly following 'q time'.  Typically you open the file first,
then can "q time".  It appears in your script that you don't have an 
open file, so I think 'q time' will return "No Files Open".
Second, the output from 'q time' is written to 'result' (like you have 
for 'q dims').  So, try move the entire block from
'q time' to just above the line 'path 1...' to after you open a file and 
define the time/lat/lon.

It might be the case that the "date" part is working (you get the right 
file open) but the time is not read correctly from
that file.

Jim

On 12/26/13 2:35 PM, Perry, Aaron @ LSC wrote:
> Hi Jim,
>
> I really appreciate all the assistance with this date issue.
>
> 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:
>
> Ex:*
>
> _In bash script:_
> *
> YMD=`date +%Y%m%d`
>
> grads -clb "run ${HOMEDIR}${PATH3}500gph_${FHR0}.gs ${YMD}
> _*
> In GrADS .gs script:*_
>
> function pull (args)
>
> currdate = subwrd(args,1)
>
>
> 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.
>
> This is becoming quite frustrating...
>
>
> Onward and Upward,
>
> Aaron Perry
> Boston, MA
> Mobile: 617-780-4312
> ------------------------------------------------------------------------
> *From:* gradsusr-bounces at gradsusr.org [gradsusr-bounces at gradsusr.org] 
> on behalf of James T. Potemra [jimp at hawaii.edu]
> *Sent:* Thursday, December 26, 2013 6:11 PM
> *To:* GrADS Users Forum
> *Subject:* Re: [gradsusr] "No Files Open" When Running In Batch Mode
>
> Hi Aaron:
>
> 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.  
> Then, the third line in
> 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).  So, you should
> change this third line (I think) to:
>
> sysdate = sublin(d,1)
>
> Next, you have an issue with the "date" command redirect. On most 
> operating systems a ">>" (double) will append to an existing file, and a
> ">!" will overwrite the file.  The single ">" is different on 
> different systems, on some it overwrites and on others it appends.  
> So, ideally I think
> you want a ">!" since a ">>" will append to a file, but you are always 
> reading the same line (hope that makes sense).  Finally, at least on my
> system the grads script is reading the single quote in the date 
> command as a termination of the command.  So, I think what you really 
> want is:
>
> '!date +"%Y%m%d" >! /home/muaddib/grads/date/date.formatted'
> d = read('/home/muaddib/grads/date/date.formatted')
> sysdate = sublin(d,1)
>
> However, the ! part of >! is apparently not allowed in the Grads 
> script (I think the ! means to escape from grads for a system 
> command).  So,
> if you can confirm that a single ">" will overwrite a file, and change 
> the sublin(d,2) to sublin(d,1) you are probably ok:
>
> '!date +'%Y%m%d' > /home/muaddib/grads/date/date.formatted'
> d = read('/home/muaddib/grads/date/date.formatted')
> sysdate = sublin(d,1)
>
> Jim
>
> On 12/26/13 12:18 PM, Perry, Aaron @ LSC wrote:
>> Hi Jim,
>>
>> 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.
>>
>> Adding the " " around !date +%Y%m%d seemed to help and so did doing 
>> just one ">" but, when I tried changing >> to >!, 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.
>>
>> 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?
>>
>> Here's the part in the bash script where I'm running GrADS:
>>
>> *GRADS=/usr/local/lib/grads/./grads
>> PATH3=/grads/scripts/gem/25km/12/
>> FHR0=000
>> HOMEDIR=/home/muaddib
>>
>> ${GRADS} -clb "run ${HOMEDIR}${PATH3}500GPH_${FHR0}.gs"*
>>
>>
>> Onward and Upward,
>>
>> Aaron Perry
>> Boston, MA
>> Mobile: 617-780-4312
>> ------------------------------------------------------------------------
>> *From:* gradsusr-bounces at gradsusr.org [gradsusr-bounces at gradsusr.org] 
>> on behalf of James T. Potemra [jimp at hawaii.edu]
>> *Sent:* Thursday, December 26, 2013 4:06 PM
>> *To:* GrADS Users Forum
>> *Subject:* Re: [gradsusr] "No Files Open" When Running In Batch Mode
>>
>> Aaron:
>>
>> I think the problem is with the "date" command. You can test this with
>> specifying the date (replace the top lines with a constant date).  If 
>> this
>> is indeed the case, some suggestions:
>>
>> 1.  Try with double quotes around the arguments to date, e.g.,
>>
>> '!date +"%Y%m%d" >> /home/muaddib/grads/date/date.formatted'
>>
>> I think you want a date like 20131226, but with single quotes around
>> the argument I think you'll get something like "Ymd".
>>
>> 2.  Is it possible you have two different "date" commands?  It could
>> be running in batch mode is using a different path that when you are
>> running interactively (e.g., you have a .bashrc or .cshrc that is not
>> accessed in batch mode).
>>
>> 3.  The >> syntax will append the output to file date.formatted,
>> but your script is always accessing the second line of this file:
>> sysdate = sublin(d,2)
>> Not sure why you have this.  Have you tried >! to overwrite the
>> file, then read the first line?
>>
>> Jim
>>
>>
>> On 12/26/13 8:46 AM, Perry, Aaron @ LSC wrote:
>>> Good Afternoon Jennifer,
>>>
>>> Thanks for the reply! Sorry about not attaching the script that I'm 
>>> having issues with!
>>>
>>> I've attached it to this email.
>>>
>>>
>>> Onward and Upward,
>>>
>>> Aaron Perry
>>> Boston, MA
>>> Mobile: 617-780-4312
>>> ------------------------------------------------------------------------
>>> *From:* gradsusr-bounces at gradsusr.org 
>>> [gradsusr-bounces at gradsusr.org] on behalf of Jennifer Adams 
>>> [jma at cola.iges.org]
>>> *Sent:* Thursday, December 26, 2013 10:05 AM
>>> *To:* GrADS Users Forum
>>> *Subject:* Re: [gradsusr] "No Files Open" When Running In Batch Mode
>>>
>>> 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.
>>> --Jennifer
>>>
>>>
>>> On Dec 26, 2013, at 12:56 AM, Perry, Aaron @ LSC wrote:
>>>
>>>> Good Morning All,
>>>>
>>>> Currently, I'm having an issue where "No Files Open" pops up every 
>>>> time that I run GrADS in Batch Mode (grads -clb).
>>>>
>>>> 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.
>>>>
>>>> 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.
>>>>
>>>> Has anybody else had this issue before?
>>>>
>>>>
>>>>
>>>> Onward and Upward,
>>>>
>>>> Aaron Perry
>>>> Boston, MA
>>>> Mobile: 617-780-4312
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>> --
>>> Jennifer M. Adams
>>> Center for Ocean-Land-Atmosphere Studies (COLA)
>>> 111 Research Hall, Mail Stop 2B3
>>> George Mason University
>>> 4400 University Drive
>>> Fairfax, VA 22030
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20131226/1881fbcc/attachment-0001.html 


More information about the gradsusr mailing list