[GRASS-dev] nc_spm_08_grass8?

Vaclav Petras wenzeslaus at gmail.com
Fri Sep 10 20:46:03 PDT 2021


On Fri, Sep 10, 2021 at 3:02 AM Maris Nartiss <maris.gis at gmail.com> wrote:

> 2021-09-10 5:56 GMT+03:00, Vaclav Petras <wenzeslaus at gmail.com>:

...
> = Not a big difference from existing implementation
>

Just to be clear, all these would be in addition to the proper handling of
band references and applied only when you don't want to deal with band
references directly.

...
>
> > Option 4) i.gensigset et al. labels the bands 1,2,3,... on the fly only
> in
> > the signature file and i.smap et al. uses the same numbering scheme when
> > the rasters don't have band references. Band references are handled only
> > when needed even on the module level in addition to the user level.
>
> Didn't understood how this differs from option #2.
>

The difference would be that the band references are never added to the
rasters in #4, only added to the signature file and re-created in the same
way for classification. In #2 they are actually added to rasters by
i.group. However, here is another option which I think is better than my
previous ones:

Option 5) Add a library function to read band reference which has a
fallback (band reference getter with a default). A reasonable fallback
seems to be the name of the raster map. This function can be then used on
all places in the signature/classification context instead of
Rast_read_bandref. i.gensigset et al. writes raster names as band
references to the signature file, i.smap et al. reads these names and
matches them with result from this new function unless the user didn't set
or renamed the raster map in the meantime. No additional step needed to the
v7 workflow if you don't need to use band references. The signatures are
associated with the raster map name rather than the order (as it is in v7).
Signatures from one mapset can then be used in another mapset as long as
the names of the rasters are the same (let's say each scene imported under
the same name into its own mapset for parallel processing). Something like
this function:

/** Return band reference or fallback to raster name if it is not set. */
char *Rast_read_bandref_with_fallback(const char *name, const char *mapset)
{
   char *ret = Rast_read_bandref(name, mapset);
   if (ret)
       return ret;
   else
       return G_store(name);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20210910/4b56e20a/attachment.html>


More information about the grass-dev mailing list