[GRASS5] saving metadata

Glynn Clements glynn.clements at virgin.net
Sat May 31 15:19:17 EDT 2003


H Bowman wrote:

> Currently several modules, such as s.surf.rst and r.mapcalc write to the
> hist meta-data file. This is good.
> 
> Unfortunatly running r.mapcalc or another processing module overwrites
> instead of appends to the hist file, destroying possibly important
> meta-data (such as s.surf.rst parameters).

r.mapcalc doesn't overwrite anything. It creates a new map, and fills
in its history with the expression which is used to create it. Any
maps which were used as input remain unchanged (including their
history).

Or are you suggesting that r.mapcalc should include the histories of
all of the input maps in the new map's history?

There is one special case: if the RHS is a single map, possibly with
an offset or modifier, the history is copied.

Now that I think of it, this is incorrect; the history shouldn't be
preserved if there is any offset or modifier, as it may contain
comments which are rendered untrue by the offset or modifier. No data
is better than incorrect data.

The handling of the categories and colour table is correct; these
aren't copied if a modifier is used, but an offset is allowed.

> I understand that the hist file code may need a bit of work, and it is a
> mine-field of relevance, which hist to keep in event of a map
> merge, etc., but that might be better than just throwing all the old
> data away?

Nothing is being thrown away; it just isn't being propagated. But I'm
not sure that it should be; is the "history" meant to be a "comments"
section (which is how it is currently used) or an audit trail?

If it's the latter, the data could become quite large; particularly
when using r.mapcalc to create one map from several maps, each of
which were created with r.mapcalc from several maps, etc.

> In lieu of modifying the hist library functions to allow append, a hack
> might be to read in the hist file to memory, append the new string and
> write the whole thing back?

What happens when the combined history exceeds MAXEDLINES? If every
program propagates its inputs' histories, it will happen eventually.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list