[GRASS5] Temporary raster file names (+G3d)

Hamish hamish_nospam at yahoo.com
Mon Feb 14 02:08:01 EST 2005


> 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




More information about the grass-dev mailing list