Skip to content

Commit

Permalink
Merge branch 't_register_mapset_old' into t_register_mapset
Browse files Browse the repository at this point in the history
  • Loading branch information
ninsbl committed Mar 20, 2023
2 parents 965df06 + a7c0030 commit de6ba10
Show file tree
Hide file tree
Showing 7 changed files with 1,146 additions and 233 deletions.
34 changes: 12 additions & 22 deletions python/grass/temporal/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,12 @@ 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(
maplist_item, mapset, check_mapset_element=type
)
}

# Read the map list from file
if file:
Expand Down Expand Up @@ -209,24 +203,20 @@ 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()

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(
mapname, mapset, check_mapset_element=type
)

maplist.append(row)

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

0 comments on commit de6ba10

Please sign in to comment.