[GRASS5] Temporary raster file names (+G3d)

Hi all,

Just wondering how I should go about creating temporary
raster files that other commands can access...

I have a controlling module (r.dispersal) that reads
a xml model definition and command line options.
From the control module several other modules that
alter a raster file are invoked successively. However
I don't know where to store these intermediary raster
files.

Using G_tempfile gives me a full pathname to a file,
but this can't be opened using the normal
G_open_cell_old and G_open_raster_new.

I can think of many ways to circumvent these problems,
but I wanted to know what fits most closely with
the GRASS design. I'd like to be able to submit
my working invasive species toolkit to GRASS once it is
complete.

Also, since I'm creating a time series of raster maps
would a 3d raster file be appropriate for storing these?

Joel

Joel,

I don't have an answer for your temp files question
but it would be great if you could explore the possibility
of storing time series of 2D raster files as a g3d file -
we have discussed this issue a lot because all hydrologic
and pollutant transport models need it as well as any
other dynamic modeling and storing it as g3d file came up
quite often as a viable option. However, there is very little support
for 3d rasters right now, although r3.to.r2 and r2.to.r3 would be a good
start - just to pack and upack the time series to make the
mapsets more manageable. Then just few scripts could make it relatively
easy to view the data through xganim or assign a common color table,
etc.
If you could look at it and let us know whether you think it
would be a good idea and what needs to be done to make it work,
it might be a great addition for the next grass release.

Helena

Peter William Pitt wrote:

Hi all,

Just wondering how I should go about creating temporary
raster files that other commands can access...

I have a controlling module (r.dispersal) that reads
a xml model definition and command line options.
From the control module several other modules that
alter a raster file are invoked successively. However
I don't know where to store these intermediary raster
files.

Using G_tempfile gives me a full pathname to a file,
but this can't be opened using the normal
G_open_cell_old and G_open_raster_new.

I can think of many ways to circumvent these problems,
but I wanted to know what fits most closely with
the GRASS design. I'd like to be able to submit
my working invasive species toolkit to GRASS once it is
complete.

Also, since I'm creating a time series of raster maps
would a 3d raster file be appropriate for storing these?

Joel

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

Just wondering how I should go about creating temporary
raster files that other commands can access...

I have a controlling module (r.dispersal) that reads
a xml model definition and command line options.
From the control module several other modules that
alter a raster file are invoked successively. However
I don't know where to store these intermediary raster
files.

Using G_tempfile gives me a full pathname to a file,
but this can't be opened using the normal
G_open_cell_old and G_open_raster_new.

I can think of many ways to circumvent these problems,
but I wanted to know what fits most closely with
the GRASS design. I'd like to be able to submit
my working invasive species toolkit to GRASS once it is
complete.

These raster functions use G_tempfile(), maybe something there will
guide you:

r.average/main.c
r.coin/main.c
r.cost/main.c
r.digit/main.c
r.drain/main.c
r.fill.dir/main.c
r.flow/io.c
r.in.arc/main.c
r.in.ascii/main.c
r.kappa/stats.c
r.le/r.le.setup/setup.c
r.los/main.c
r.mfilter/perform.c
r.out.mpeg/main.c
r.report/stats.c
r.resamp.rst/main.c
r.statistics/o_average.c
r.statistics/o_distrib.c
r.statistics/o_sum.c
r.surf.contour/bseg_open.c
r.surf.contour/cseg_open.c
r.thin/io.c
r.watershed/seg/bseg_open.c
r.watershed/seg/cseg_open.c
r.watershed/seg/dseg_open.c
r.watershed/seg/sseg_open.c
wildfire/r.spreadpath/main.c

Also, since I'm creating a time series of raster maps
would a 3d raster file be appropriate for storing these?

I'd be wary. You hit the 2gb filesize limit with only 365 maps of only
5.5mb each. For a detailed DCELL raster (or CELL with negative values),
that's not much or many.

+ you lose the ability to use r.series; r.univar needs a 3D bin= option;
etc.

Setting the raster title & history info in your C module and naming the
maps e.g. "data.073" for say julian day 73 has always done me well.

Again, for emphasis, I highly recommend using the raster title & history
space in your C module if you can. (see r.in.mat & v.surf.rst for code)

Hamish

I don't have an answer for your temp files question
but it would be great if you could explore the possibility
of storing time series of 2D raster files as a g3d file -
we have discussed this issue a lot because all hydrologic
and pollutant transport models need it as well as any
other dynamic modeling and storing it as g3d file came up
quite often as a viable option. However, there is very little support
for 3d rasters right now, although r3.to.r2 and r2.to.r3 would be a
good start - just to pack and upack the time series to make the
mapsets more manageable. Then just few scripts could make it
relatively easy to view the data through xganim or assign a common
color table, etc.
If you could look at it and let us know whether you think it
would be a good idea and what needs to be done to make it work,
it might be a great addition for the next grass release.

what about better use of i.group?

(I'm not denying that having it all in one big "map" isn't easier to
deal with than 'n' maps + raster file crud)

Hamish