[GRASSLIST:4920] read-write cells

A stupid doubt :slight_smile:
When I open a new raster file (outfd=G_open_raster_new(pippo,pluto)) it is open only in writing or can I also read it?
Let me explane, I change my active region, the first time I applay some calculations and write cell values, the next time my active region overlay the old one and I want to retrive the just written data cells....
Is it done just using:
G_get_raster_row(outfd,outrast,row,data_type) ???

Sorry for my confusion.....

--
_____________________________________________________

Ing. Massimiliano Cannata

SUPSI - Istituto Scienze della Terra
C.P. 72 - CH-6952 Canobbio (Ticino, Switzerland)
Tel +41 (0)91 935 12 25 - Fax +41 (0)91 935 12 09
mailto:massimiliano.cannata@supsi.ch
http://www.ist.supsi.ch

Massimiliano Cannata wrote:

When I open a new raster file (outfd=G_open_raster_new(pippo,pluto)) it
is open only in writing or can I also read it?

No, it's write-only.

And you can't open the file for reading until you've finished writing
it, as the map won't exist (so far as G_open_cell_old() is concerned)
until you call G_close_cell().

Let me explane, I change my active region, the first time I applay some
calculations and write cell values, the next time my active region
overlay the old one and I want to retrive the just written data cells....
Is it done just using:
G_get_raster_row(outfd,outrast,row,data_type) ???

No. If you want to read the data which you've written, you'll have to
keep a copy of it.

Also, you need to be careful about changing the region settings while
writing to a file. The region settings which were in effect at the
time you called G_open_raster_new() determine how many rows and
columns you need to write.

This is different from reading, where each call to G_get_raster_row()
etc resamples the data according to the current region settings.

--
Glynn Clements <glynn@gclements.plus.com>