r.covar and closing raster files problem

Alastair Duncan 100074.213 at compuserve.com
Fri Sep 6 08:00:00 EDT 1996



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 roun
d
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 is
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 processing
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 close
s
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 file
s
was to make sure at the end of processing I should close all opened files.


Thanks,

Alastair Duncan,
GIS Data Officer,
National Centre for Environmental Monitoring and Surveillance,
The Environment Agency,
Rivers House,
Lower Bristol Road,
Bath, UK.







More information about the grass-user mailing list