[Rd] R-console vs. bash console (execution halted)

Roger Bivand Roger.Bivand at nhh.no
Tue Mar 11 21:57:58 CET 2008


On Tue, 11 Mar 2008, Prof Brian Ripley wrote:

> Your first use is non-interactive.  I have no idea what
>
> R CMD source("/data/myscript.R")
>
> is supposed to do (it does not work for me), but source() when run in RGui
> is interactive.
>
> See ?options and in particular 'error' and the reference to ?stop for the
> different ways errors are handled in interactive and non-interactive use.
>

In addition, this is an error in external software accessed through the 
rgdal package. So the first thing would be to find out interactively why 
it is happening, and if necessary trap errors that the author of the 
script knows about and wishes to step over.

Could I suggest that you re-post to the R-sig-geo list to get help in 
resolving the underlying problem? As the GDAL error message says, there is 
a problem with a GTiff file, but whether you are reading from an external 
file, or copying from a created GDAL object is not known. In posting, 
please give a simplified example of your workflow. I'm not sure that your 
diagnosis is correct - GDAL typically gives a "file not found" error if 
the file is not present, but here it seems to indicate a corrupt file.

>
>
> On Tue, 11 Mar 2008, Lienert  Christophe wrote:
>
>> Dear Everyone,
>> I am using R 2.6.2 on my Redhat AS4. I installed the RPM offered on the cran website. I would like to use R from my bash console with the following command:
>>
>> /path/to/R --vanilla --slave --args < /data/myscript.R
>>
>> this script invokes a range of functions and tools, among others to process a bunch of raster images in a loop using GDAL. The thing is that releasing this command in the bash results in the following error
>>
>>
>> Error in function (handle)  :
>>        GDAL Error 1: TIFFReadDirectory:/tmp/RtmpPCALnL/file265f67a6: cannot handle zero scanline size
>> Calls: <Anonymous> -> .Call
>> Execution halted
>>
>> The scripts halts, although there are more images to process. The question is why the script halts and why the script is not halted (but still "decorated" with errors) when releasing it within the R console like so
>>
>> R CMD source("/data/myscript.R")
>>
>> The result of this R CMD is shown below. Note that the script is doing what it is supposed to, despite the error it produces. The loop is completely finalized
>>
>> Error in function (handle)  :
>>        GDAL Error 1: TIFFReadDirectory:/tmp/Rtmp6gXG5W/file67e9e074: cannot handle zero scanline size
>> [1] "/data/someimg1.tiff"
>> Error in function (handle)  :
>>        GDAL Error 1: TIFFReadDirectory:/tmp/Rtmp6gXG5W/file21e4ef74: cannot handle zero scanline size
>> [1] "/data/someimg2.tiff"
>> Error in function (handle)  :
>>        GDAL Error 1: TIFFReadDirectory:/tmp/Rtmp6gXG5W/file67e9e074: cannot handle zero scanline size
>> [1] "/data/someimg3.tiff"
>>
>> etc.
>>
>> Obviously, the tmp directory is being deleted before the stored image in it can be used. Does anybody know what to consider or provide when working in a external console like bash and/or does anybody know about such halted executions when working with GDAL?
>> Help is greatly appreciated,
>>
>> Ciao,
>> Chris
>>
>> _______________________________________________
>> Christophe Lienert
>> ETH Zurich
>> Institute of Cartography
>> Wolfgang-Pauli-Str. 15
>> HIL G 13.3
>> CH-8093 Zurich
>> SWITZERLAND
>>
>> Fon: +41-44-6333036
>> Fax: +41-44-6331153
>> www.karto.ethz.ch
>> lienert at karto.baug.ethz.ch
>> <mailto:lienert at karto.baug.ethz.ch>
>>
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-devel mailing list