[GRASS-dev] GRASS 7 raster coding best practices

Hamish hamish_b at yahoo.com
Sun May 4 05:38:38 EDT 2008


Yann Chemin wrote:
> In a similar way, metadata/history storage:
> 
>         G_short_history(result1, "raster", &history);
>         G_command_history(&history);
>         G_write_history(result1,&history);
> 
> This is the standard incantation,

that is a bit of a modern hack, really those lines should be combined in
a single library call.


> but I have to find timestamp(), and more details metadata

there are two you can see with r.info, map creation time and more
flexible Timestamp:, see r.timestamp module.

> maybe like sensor type for a start,

freeform stuff could go into general metadata, see "r.support history="

> or source/origin of data...

r.info/r.support gives two lines for
 |   Data Source:       


> Can we make metadata having elements
> (history->processing, history->timestamp, history->source(or
> history->origin), etc?) then it could be filled up specifically.

see the grass 6.3.0 r.support help page for current metadata support and
this wiki page for planned GRASS 7 metadata rewrite ideas:
http://grass.osgeo.org/wiki/GRASS_Metadata_Management


> Or color palettes application, discovered this recently, it is nice:
> 
>   /* Color table for biomass */
>         G_init_colors(&colors);
>         G_add_color_rule(0,0,0,0,1,255,255,255,&colors);
> 
> I don't deny it, it must be there, I just would like to get things
> together and identify what best (i.e. clean/complete/nice) coding I
> can implement as a standard on the modules I work on...
> 
> Are there other gems hidden that we could simply list or make a more
> exhaustive r.example2?


there are lots of nice tricks to be found in the modules and in libgis,
probably noone remembers all of them, my advice is to replicate something
you already find in a module or go exploring in libgis.
Often there are nice solutions already there (but slightly hidden).

the module synopsis list is another interesting thing to explore. I am
still finding new + interesting modules I never knew existed.


Hamish




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



More information about the grass-dev mailing list