r.covar and closing raster files problem

Nalneesh Gaur ngaur at dynis.com
Fri Sep 6 08:00:00 EDT 1996



At 09:10 AM 9/6/96 EDT, you wrote:
>Hello,
>
>I'm trying to write a C programme that uses a system call to r.covar (to find
>the correlation between two raster layers) in a loop. The loop needs to go
 round
>72 x 72 times in order to find the correlation between the ratio of each of 72
>channels of a multispectral image against another raster layer.
>
>The programme works fine for the first 25 times that the loop calls r.covar
>(having used 24 raster layers), then (and each subsequent time) when r.covar i
s
>called to correlate two layers I get the error message :
>
>       WARNING: Too many open raster files
>
>I've checked the main.c source code for r.covar, and after it's main processin
g
>it doesn't close the raster files it has opened. Therefore memory isn't freed
>after r.covar has finished processing.
>
>Does anybody know how I can modify the source code for r.covar so that it
 closes
>all the raster files it has opened?
>
> Also are there other GRASS programmes that don't close files that have been
>opened at the end of processing - because if there are I think these should be
>modified, one of the first things I was taught when writing code to handle
 files
>was to make sure at the end of processing I should close all opened files.
>
GRASS has a limit on the number of raster files open. You may be able to use
a function call like G_close to close the open raster file.

---------------------------------------------------------
Dynatech Integrated Systems Corporation
9790-C Patuxent Woods Drive, 
Columbia, MD 21046
Phone:  (410) 995-6422
Fax:        (410) 995-6090
---------------------------------------------------------






More information about the grass-user mailing list