Opened 16 years ago

Closed 9 years ago

#134 closed enhancement (fixed)

Add a flag for subgroup listing in i.group

Reported by: nikos Owned by: grass-dev@…
Priority: major Milestone: 7.0.0
Component: Imagery Version: unspecified
Keywords: i.group Cc:
CPU: All Platform: All

Description

How do you list your subgroup's?

Change History (8)

comment:1 by neteler, 16 years ago

Currently i.group seems to be broken for subgroups. Otherwise -l should list them AFAIK.

Markus

in reply to:  1 comment:2 by glynn, 16 years ago

Replying to neteler:

Currently i.group seems to be broken for subgroups. Otherwise -l should list them AFAIK.

No, -l doesn't list subgroups, only files. Essentially, it dumps the contents of the REF file for either a group or subgroup (depending upon whether subgroup= was given).

You can list groups with "g.list group", but there doesn't appear to be any way to list the subgroups of a group.

comment:3 by neteler, 16 years ago

With fixed i.group, it is possible but too complicated to list subgroups:

location: nc_spm_07
mapset:   landsat

i.group mylsat7_2000 sub=mylsat7_2000 in=lsat7_2000_10,lsat7_2000_20,lsat7_2000_30,lsat7_2000_40,lsat7_2000_50,lsat7_2000_61,lsat7_2000_70,lsat7_2000_80

i.group -l mylsat7_2000
group [mylsat7_2000] references the following cellfiles
-------------
lsat7_2000_10 in landsat    lsat7_2000_20 in landsat
lsat7_2000_30 in landsat    lsat7_2000_40 in landsat
lsat7_2000_50 in landsat    lsat7_2000_61 in landsat
lsat7_2000_70 in landsat    lsat7_2000_80 in landsat
-------------
i.group complete.

-> subgroups missing, not even indicated that they are present in that group. "g.list subgroup" does not exist.

i.group -l mylsat7_2000 subgroup=mylsat7_2000
subgroup [mylsat7_2000] of group [mylsat7_2000] references the following cellfiles
-------------
lsat7_2000_10 in landsat    lsat7_2000_20 in landsat
lsat7_2000_30 in landsat    lsat7_2000_40 in landsat
lsat7_2000_50 in landsat    lsat7_2000_61 in landsat
lsat7_2000_70 in landsat    lsat7_2000_80 in landsat
-------------
i.group complete.

Now only the subgroups are listed. But how to know its name to issue this command?

I see some conceptual problems here. Proposal

  • either list automatically also the subgroup(s) when only indicating group=
  • or add a new flag for subgroup(s) listing
  • or enhance g.list to ist subgroup names (but looks moreover confusig to me).

Markus

in reply to:  3 comment:4 by glynn, 16 years ago

Replying to neteler:

With fixed i.group, it is possible but too complicated to list subgroups:

Let me clarify. You can list the files which make up a subgroup, but you cannot list the subgroups of a group.

-> subgroups missing, not even indicated that they are present in that group.

The -l switch just dumps the REF file for a group or subgroup.

"g.list subgroup" does not exist.

Well, each group has its own list of subgroups. g.list only lists "top-level" entities (rasters, vectors, groups, etc).

Now only the subgroups are listed.

Only the contents of a specific subgroup are listed. Adding subgroup= causes -l to dump that subgroup's REF file rather than the group's REF file.

But how to know its name to issue this command?

Exactly.

I see some conceptual problems here. Proposal

  • either list automatically also the subgroup(s) when only indicating group=

That could be confusing, particularly if you have scripts parsing the output of "i.group -l".

  • or add a new flag for subgroup(s) listing

That seems like the most viable solution. And there is actually a function to do this, named I_list_subgroups(), although nothing uses it at present.

FWIW, there is also I_list_groups(), but the only thing which uses it is I_ask_group_old() (if you type "list"), which in turn is only used by the i.ortho.photo front-end.

Both of those functions are abominations which uses popen("ls ...") to enumerate the directory. They also do all of the formatting, and send the results to the pager. There isn't anything like I_get_[sub]group_ref() which just returns the information to the caller in a usable form.

  • or enhance g.list to ist subgroup names (but looks moreover confusig to me).

You would need to add a group= parameter to g.list, unless you want it to enumerate all subgroups of all groups. But that's arguably outside of the scope of g.list, which isn't supposed to know the details of the various entity types (it violates that principle for vectors, although I'm not sure if that's really necessary).

comment:5 by hamish, 16 years ago

CPU: Unspecified
Platform: Unspecified

see also duplicate in #324

Hamish

comment:6 by hamish, 11 years ago

Component: DefaultImagery
CPU: UnspecifiedAll
Keywords: i.group added
Milestone: 6.4.06.4.4
Platform: UnspecifiedAll

comment:7 by turek, 11 years ago

Hi,

I have added (r57704 and r57703) -s flag into G7 i.group module, which lists subgroups in group.

Stepan

comment:8 by nikos, 9 years ago

Milestone: 6.4.47.0.0
Resolution: fixed
Status: newclosed

Thanks Stepan, works perfectly in both (G71 and G7).

Note: See TracTickets for help on using tickets.