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

James T. Potemra jimp at hawaii.edu
Thu Dec 26 18:11:56 EST 2013


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

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


More information about the gradsusr mailing list