Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.register: support mapset name in input file #2863

Merged
merged 21 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions python/grass/temporal/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,10 @@ def register_maps_in_space_time_dataset(
maplist = maps.split(",")

# Build the map list again with the ids
for count in range(len(maplist)):
row = {}
mapname = maplist[count]
map_mapset = mapset
if "@" not in mapname:
found = gscript.find_file(element=type, name=mapname)
if found["mapset"] is not None and len(found["mapset"]) > 0:
map_mapset = found["mapset"]
mapid = AbstractMapDataset.build_id(mapname, map_mapset, None)

row["id"] = mapid
maplist[count] = row
for idx, maplist_item in enumerate(maplist):
maplist[idx] = {
"id": AbstractMapDataset.build_id_from_search_path(maplist_item, type)
}

# Read the map list from file
if file:
Expand Down Expand Up @@ -209,24 +201,18 @@ def register_maps_in_space_time_dataset(
mapname = line_list[0].strip()
row = {}

if start_time_in_file and end_time_in_file:
if start_time_in_file:
row["start"] = line_list[1].strip()
row["end"] = line_list[2].strip()

if start_time_in_file and not end_time_in_file:
row["start"] = line_list[1].strip()
if end_time_in_file:
row["end"] = line_list[2].strip()
wenzeslaus marked this conversation as resolved.
Show resolved Hide resolved

if semantic_label_in_file:
idx = 3 if end_time_in_file else 2
# case-sensitive, the user decides on the band name
row["semantic_label"] = line_list[idx].strip()

map_mapset = mapset
if "@" not in mapname:
found = gscript.find_file(element=type, name=mapname)
if found["mapset"] is not None and len(found["mapset"]) > 0:
map_mapset = found["mapset"]
row["id"] = AbstractMapDataset.build_id(mapname, map_mapset)
row["id"] = AbstractMapDataset.build_id_from_search_path(mapname, type)

maplist.append(row)

Expand Down
19 changes: 19 additions & 0 deletions temporal/t.register/t.register.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ <h2>DESCRIPTION</h2>
start and end time, <em>t.register</em> will read timestamps from the temporal
database (i.e., in this case only passing map names will be enough).
<p>
Maps can be specified both with their fully qualified map name, meaning e.g.
<i>map@mapset</i> and without the mapset name included. If the mapset
name is not provided in the input, <em>t.register</em> will look for
the given map on the current search path and assign the matching mapset.
If the map is not found on the current search path the module will fail.
Thus, registering maps with fully qualified map name is slightly faster.
<p>
The module <em>t.register</em> supports absolute and relative time. The absolute temporal type
refers to a fixed date while the relative temporal type refers to data
without fixed timestamps (e.g., sequential maps used to calculate
Expand Down Expand Up @@ -113,6 +120,18 @@ <h2>INPUT FILE FORMAT</h2>
prec_6|2002-04-01|2002-07-01
</pre></div>

<p>
Same as above but with fully qualified map names
(no support for <em>increment</em> option nor <b>-i</b> flag):
<div class="code"><pre>
prec_1@PERMANENT|2001-01-01|2001-04-01
prec_2@PERMANENT|2001-04-01|2001-07-01
prec_3@PERMANENT|2001-07-01|2001-10-01
prec_4@PERMANENT|2001-10-01|2002-01-01
prec_5@PERMANENT|2002-01-01|2002-04-01
prec_6@PERMANENT|2002-04-01|2002-07-01
</pre></div>

<h3>Support for semantic labels</h3>

For more information about semantic labels and image collections
Expand Down
83 changes: 0 additions & 83 deletions temporal/t.register/test.t.register.raster.file.sh

This file was deleted.

128 changes: 0 additions & 128 deletions temporal/t.register/test.t.register.raster.sh

This file was deleted.

Loading