Skip to content

r.learn.predict: write raster history#1695

Open
neteler wants to merge 1 commit into
OSGeo:grass8from
neteler:r_ml_learn2_write_history
Open

r.learn.predict: write raster history#1695
neteler wants to merge 1 commit into
OSGeo:grass8from
neteler:r_ml_learn2_write_history

Conversation

@neteler

@neteler neteler commented May 22, 2026

Copy link
Copy Markdown
Member

Adds writing out of the raster history.

Example:

r.info rf_classification
 +----------------------------------------------------------------------------+
 | Map:      rf_classification              Date: Fri May 15 18:20:39 2026    |
 | Mapset:   mneteler                       Login of Creator: mneteler        |
 | Project:  ecad17_ll                                                        |
 | DataBase: /home/mneteler/grassdata                                         |
 | Title:                                                                     |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 62              |
 |   Data Type:    CELL                 Semantic label: (none)                |
 |   Rows:         201                                                        |
 |   Columns:      464                                                        |
 |   Total Cells:  93264                                                      |
 |        Projection: Latitude-Longitude                                      |
 |            N:     75:30N    S:     25:15N   Res:  0:15                     |
 |            E:     75:30E    W:     40:30W   Res:  0:15                     |
 |   Range of data:    min = 21  max = 62                                     |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by ?                                                          |
 |                                                                            |
 |   Comments:                                                                |
 |    r.learn.predict group=ecad_1981_2010 load_model=rf_classification_model |
 |    .data output=rf_classification                                          |
 |                                                                            |
 +----------------------------------------------------------------------------+

Question: How to fill "Data Description:"?

Add to write out the raster history.

Example:

```sh
r.info rf_classification
 +----------------------------------------------------------------------------+
 | Map:      rf_classification              Date: Fri May 15 18:20:39 2026    |
 | Mapset:   mneteler                       Login of Creator: mneteler        |
 | Project:  ecad17_ll                                                        |
 | DataBase: /home/mneteler/grassdata                                         |
 | Title:                                                                     |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 62              |
 |   Data Type:    CELL                 Semantic label: (none)                |
 |   Rows:         201                                                        |
 |   Columns:      464                                                        |
 |   Total Cells:  93264                                                      |
 |        Projection: Latitude-Longitude                                      |
 |            N:     75:30N    S:     25:15N   Res:  0:15                     |
 |            E:     75:30E    W:     40:30W   Res:  0:15                     |
 |   Range of data:    min = 21  max = 62                                     |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by ?                                                          |
 |                                                                            |
 |   Comments:                                                                |
 |    r.learn.predict group=ecad_1981_2010 load_model=rf_classification_model |
 |    .data output=rf_classification                                          |
 |                                                                            |
 +----------------------------------------------------------------------------+
```

Question: How to fill "`Data Description:`"?
@neteler neteler self-assigned this May 22, 2026
@neteler neteler added the Python Related code is in Python label May 22, 2026
@marisn

marisn commented May 25, 2026

Copy link
Copy Markdown
Contributor
  • sh: r.support description="Data description text"
  • C: Rast_short_history(..) or directly Rast_format_history(hist, HIST_KEYWRD, "foo: %", bar); or Rast_set_history(hist, HIST_KEYWRD, "string");
  • python: pygrass.raster.History.keyword

@neteler

neteler commented May 25, 2026

Copy link
Copy Markdown
Member Author

python: pygrass.raster.History.keyword

Seems I don't find a single example of a Python script in which this (or similar code) is used. Any hints for best practice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants