[GRASS-dev] Raster history: why not reclass

Hi all.
The history of rasters is one of the very nice features of grass. I
noticed that in reclassified rasters, however, the rules are not saved,
so the user does not have a clue of how the raster have been
reclassified. Is there any special reason for this? Any plan to
implement it?
Thanks.
--
Paolo Cavallini: http://www.faunalia.it/pc

On Sat, Sep 24, 2011 at 10:54 AM, Paolo Cavallini <cavallini@faunalia.it> wrote:

Hi all.
The history of rasters is one of the very nice features of grass. I
noticed that in reclassified rasters, however, the rules are not saved,
so the user does not have a clue of how the raster have been
reclassified.

I agree.

Is there any special reason for this? Any plan to implement it?

The reason will be the limited space in the history structure. The code
is essentially there:

[neteler@north r.reclass]$ grep hist *
reclass.c: struct History hist;
reclass.c: G_short_history(new_name, "reclass", &hist);
reclass.c: strcpy(hist.datsrc_1, "Reclassified map based on:");
reclass.c: sprintf(hist.datsrc_2, " Map [%s] in mapset [%s]",
new.name, new.mapset);
reclass.c: G_write_history(new_name, &hist);

http://grass.osgeo.org/programming6/history_8c.html#aadc6b56dba0ade914f5ed0c94600fa2a
http://grass.osgeo.org/programming6/structHistory.html
using
#define RECORD_LEN 80

http://grass.osgeo.org/programming6/dist_8i686-pc-linux-gnu_2include_2grass_2gis_8h.html#a244dc84fb432bea62b1716f74f1eb335

Not too many rules will fit in this 80 chars space.

Ideas
- improve this in GRASS 7
- store the reclass file in the metadata space in the mapset and display
  it with r.info if file present (should be backward compatible like this)

Markus

Il giorno sab, 24/09/2011 alle 11.05 +0200, Markus Neteler ha scritto:

Ideas
- improve this in GRASS 7
- store the reclass file in the metadata space in the mapset and display
  it with r.info if file present (should be backward compatible like this)

I think having an extended history would be good.
Would you open a ticket on this, or should I?
All the best.
--
Paolo Cavallini: http://www.faunalia.it/pc

Paolo wrote:

The history of rasters is one of the very nice features of
grass.

thanks.. it is all done by hand in the last few years though,
and there's probably lots we missed. It has been enhanced
quite a bit in trunk to not be limited to 80 chars per line.

I think we still have lots we could do to make metadata better.
(any external library to support INSPIRE as xml..?)

I noticed that in reclassified rasters, however, the rules
are not saved,

actually, the rules are all that are saved- it's a virtual map.
the file in $MAPSET/cellhd/ could be pasted together with the
result of r.category or r.stats in a script or spreadsheet
easily enough.

so the user does not have a clue of how the
raster have been reclassified.

r.info (in normal report mode) has a special test for reclass
maps and prints all that info.

Is there any special reason for this? Any plan to implement it?

besides the r.info list which is there now, how about new -p and
-g flags added to r.reclass to print them in form or csv format?
(out= would need the conditionally-required magic flag in trunk)
or perhaps a new -c flag for r.info for that?

Hamish