"""
+
import os
import re
import sys
diff --git a/python/grass/script/testsuite/test_names.py b/python/grass/script/testsuite/test_names.py
index 72db4aff174..6d48596c392 100644
--- a/python/grass/script/testsuite/test_names.py
+++ b/python/grass/script/testsuite/test_names.py
@@ -109,7 +109,11 @@ def works_for_vector_table_column(self, name):
try:
gs.run_command("v.edit", map=name, tool="create")
gs.run_command("v.db.addtable", map=name)
- gs.run_command("v.db.addcolumn", map=name, columns=name)
+ gs.run_command(
+ "v.db.addcolumn",
+ map=name,
+ columns=f"{name} integer",
+ )
works = True
except gs.CalledModuleError:
works = False
diff --git a/python/grass/temporal/abstract_dataset.py b/python/grass/temporal/abstract_dataset.py
index 4d6d4d81b51..720b2210ad8 100644
--- a/python/grass/temporal/abstract_dataset.py
+++ b/python/grass/temporal/abstract_dataset.py
@@ -9,6 +9,7 @@
:authors: Soeren Gebbert
"""
+
from abc import ABCMeta, abstractmethod
from .core import (
get_tgis_message_interface,
diff --git a/python/grass/temporal/c_libraries_interface.py b/python/grass/temporal/c_libraries_interface.py
index 260fdeae1e1..9db4a897077 100644
--- a/python/grass/temporal/c_libraries_interface.py
+++ b/python/grass/temporal/c_libraries_interface.py
@@ -51,6 +51,7 @@ class RPCDefs:
WRITE_SEMANTIC_LABEL = 15
READ_SEMANTIC_LABEL = 16
REMOVE_SEMANTIC_LABEL = 17
+ READ_MAP_HISTORY = 18
G_FATAL_ERROR = 49
TYPE_RASTER = 0
@@ -981,6 +982,142 @@ def _read_vector_info(name, mapset):
###############################################################################
+def _read_map_history(lock, conn, data):
+ """Read map history from the spatial database using C-library functions
+
+ :param lock: A multiprocessing.Lock instance
+ :param conn: A multiprocessing.Pipe instance used to send True or False
+ :param data: The list of data entries [function_id, maptype, name, mapset]
+ """
+ kvp = None
+ try:
+ maptype = data[1]
+ name = data[2]
+ mapset = data[3]
+ if maptype == RPCDefs.TYPE_RASTER:
+ kvp = _read_raster_history(name, mapset)
+ elif maptype == RPCDefs.TYPE_VECTOR:
+ kvp = _read_vector_history(name, mapset)
+ elif maptype == RPCDefs.TYPE_RASTER3D:
+ kvp = _read_raster3d_history(name, mapset)
+ except:
+ raise
+ finally:
+ conn.send(kvp)
+
+
+###############################################################################
+
+
+def _read_raster_history(name, mapset):
+ """Read the raster history from the file system and store the content
+ into a dictionary
+
+ This method uses the ctypes interface to the gis and raster libraries
+ to read the map history
+
+ :param name: The name of the map
+ :param mapset: The mapset of the map
+ :returns: The key value pairs of the map specific metadata, or None in
+ case of an error
+ """
+
+ kvp = {}
+
+ if not libgis.G_find_raster(name, mapset):
+ return None
+
+ # Read the raster history
+ hist = libraster.History()
+ ret = libraster.Rast_read_history(name, mapset, byref(hist))
+ if ret < 0:
+ logging.warning(_("Unable to read history file"))
+ return None
+ else:
+ kvp["creation_time"] = decode(
+ libraster.Rast_get_history(byref(hist), libraster.HIST_MAPID)
+ )
+ kvp["creator"] = decode(
+ libraster.Rast_get_history(byref(hist), libraster.HIST_CREATOR)
+ )
+
+ return kvp
+
+
+###############################################################################
+
+
+def _read_raster3d_history(name, mapset):
+ """Read the 3D raster map info from the file system and store the content
+ into a dictionary
+
+ This method uses the ctypes interface to the gis and raster3d libraries
+ to read the map metadata information
+
+ :param name: The name of the map
+ :param mapset: The mapset of the map
+ :returns: The key value pairs of the map specific metadata, or None in
+ case of an error
+ """
+
+ kvp = {}
+
+ if not libgis.G_find_raster3d(name, mapset):
+ return None
+
+ # Read the region information
+ hist = libraster.History()
+ ret = libraster3d.Rast3d_read_history(name, mapset, byref(hist))
+ if ret < 0:
+ logging.warning(_("Unable to read history file"))
+ return None
+ else:
+ kvp["creation_time"] = decode(
+ libraster.Rast_get_history(byref(hist), libraster3d.HIST_MAPID)
+ )
+ kvp["creator"] = decode(
+ libraster.Rast_get_history(byref(hist), libraster3d.HIST_CREATOR)
+ )
+
+ return kvp
+
+
+###############################################################################
+
+
+def _read_vector_history(name, mapset):
+ """Read the vector history from the file system and store the content
+ into a dictionary
+
+ This method uses the ctypes interface to the gis and raster libraries
+ to read the map history
+
+ :param name: The name of the map
+ :param mapset: The mapset of the map
+ :returns: The key value pairs of the map specific metadata, or None in
+ case of an error
+ """
+
+ kvp = {}
+
+ if not libgis.G_find_vector(name, mapset):
+ return None
+
+ # Read the vector history
+ Map = libvector.Map_info()
+ if libvector.Vect_open_old(byref(Map), name, mapset, "1") > 0:
+ kvp["creation_time"] = decode(libvector.Vect_get_map_date(byref(Map)))
+ kvp["creator"] = decode(libvector.Vect_get_person(byref(Map)))
+ else:
+ None
+ libvector.Vect_close(byref(Map))
+
+ return kvp
+
+
+###############################################################################
+
+
def _convert_timestamp_from_grass(ts):
"""Convert a GRASS file based timestamp into the temporal framework
format datetime or integer.
@@ -1124,6 +1261,7 @@ def error_handler(data):
functions[RPCDefs.WRITE_SEMANTIC_LABEL] = _write_semantic_label
functions[RPCDefs.READ_SEMANTIC_LABEL] = _read_semantic_label
functions[RPCDefs.REMOVE_SEMANTIC_LABEL] = _remove_semantic_label
+ functions[RPCDefs.READ_MAP_HISTORY] = _read_map_history
functions[RPCDefs.G_FATAL_ERROR] = _fatal_error
libgis.G_gisinit("c_library_server")
@@ -1416,6 +1554,21 @@ def read_raster_full_info(self, name, mapset):
)
return self.safe_receive("read_raster_full_info")
+ def read_raster_history(self, name, mapset):
+ """Read the raster map history from the file system and store the content
+ into a dictionary
+
+ :param name: The name of the map
+ :param mapset: The mapset of the map
+ :returns: The key value pairs of the map history (creation, creation_time),
+ or None in case of an error
+ """
+ self.check_server()
+ self.client_conn.send(
+ [RPCDefs.READ_MAP_HISTORY, RPCDefs.TYPE_RASTER, name, mapset, None]
+ )
+ return self.safe_receive("read_raster_history")
+
def has_raster_timestamp(self, name, mapset):
"""Check if a file based raster timestamp exists
@@ -1575,6 +1728,21 @@ def read_raster3d_info(self, name, mapset):
)
return self.safe_receive("read_raster3d_info")
+ def read_raster3d_history(self, name, mapset):
+ """Read the 3D raster map history from the file system and store the content
+ into a dictionary
+
+ :param name: The name of the map
+ :param mapset: The mapset of the map
+ :returns: The key value pairs of the map history (creation, creation_time),
+ or None in case of an error
+ """
+ self.check_server()
+ self.client_conn.send(
+ [RPCDefs.READ_MAP_HISTORY, RPCDefs.TYPE_RASTER3D, name, mapset, None]
+ )
+ return self.safe_receive("read_raster3d_history")
+
def has_raster3d_timestamp(self, name, mapset):
"""Check if a file based 3D raster timestamp exists
@@ -1697,6 +1865,21 @@ def read_vector_full_info(self, name, mapset):
)
return self.safe_receive("read_vector_full_info")
+ def read_vector_history(self, name, mapset):
+ """Read the vector map history from the file system and store the content
+ into a dictionary
+
+ :param name: The name of the map
+ :param mapset: The mapset of the map
+ :returns: The key value pairs of the map history (creation, creation_time),
+ or None in case of an error
+ """
+ self.check_server()
+ self.client_conn.send(
+ [RPCDefs.READ_MAP_HISTORY, RPCDefs.TYPE_VECTOR, name, mapset, None]
+ )
+ return self.safe_receive("read_vector_history")
+
def has_vector_timestamp(self, name, mapset, layer=None):
"""Check if a file based vector timestamp exists
diff --git a/python/grass/temporal/extract.py b/python/grass/temporal/extract.py
index 9cb91ac2230..3f8c9cb0738 100644
--- a/python/grass/temporal/extract.py
+++ b/python/grass/temporal/extract.py
@@ -8,6 +8,7 @@
:authors: Soeren Gebbert
"""
+
from .core import (
get_tgis_message_interface,
get_current_mapset,
diff --git a/python/grass/temporal/factory.py b/python/grass/temporal/factory.py
index cc3652ff4ca..b7ef8ab5218 100644
--- a/python/grass/temporal/factory.py
+++ b/python/grass/temporal/factory.py
@@ -17,6 +17,7 @@
:authors: Soeren Gebbert
"""
+
from .core import get_tgis_message_interface
from .space_time_datasets import (
SpaceTimeRaster3DDataset,
diff --git a/python/grass/temporal/gui_support.py b/python/grass/temporal/gui_support.py
index 44e32b6e2e8..09b858657bc 100644
--- a/python/grass/temporal/gui_support.py
+++ b/python/grass/temporal/gui_support.py
@@ -9,6 +9,7 @@
:authors: Soeren Gebbert
"""
+
from .core import get_available_temporal_mapsets, init_dbif
from .factory import dataset_factory
import grass.script as gscript
diff --git a/python/grass/temporal/mapcalc.py b/python/grass/temporal/mapcalc.py
index e23d8cac165..54edeab885d 100644
--- a/python/grass/temporal/mapcalc.py
+++ b/python/grass/temporal/mapcalc.py
@@ -8,6 +8,7 @@
:authors: Soeren Gebbert
"""
+
import copy
from datetime import datetime
from multiprocessing import Process
diff --git a/python/grass/temporal/open_stds.py b/python/grass/temporal/open_stds.py
index 837f1a860a7..83aacc1c819 100644
--- a/python/grass/temporal/open_stds.py
+++ b/python/grass/temporal/open_stds.py
@@ -17,6 +17,7 @@
:authors: Soeren Gebbert
"""
+
from .core import init_dbif, get_current_mapset, get_tgis_message_interface
from .factory import dataset_factory
from .abstract_map_dataset import AbstractMapDataset
diff --git a/python/grass/temporal/register.py b/python/grass/temporal/register.py
index 4d0780ecabf..3804d8c3f72 100644
--- a/python/grass/temporal/register.py
+++ b/python/grass/temporal/register.py
@@ -18,7 +18,7 @@
"""
from datetime import datetime
-import grass.script as gscript
+import grass.script as gs
from .core import get_tgis_message_interface, init_dbif, get_current_mapset
from .open_stds import open_old_stds
from .abstract_map_dataset import AbstractMapDataset
@@ -82,6 +82,7 @@ def register_maps_in_space_time_dataset(
start_time_in_file = False
end_time_in_file = False
semantic_label_in_file = False
+ overwrite = gs.overwrite()
msgr = get_tgis_message_interface()
@@ -96,15 +97,13 @@ def register_maps_in_space_time_dataset(
increment = str(increment)
if maps and file:
- msgr.fatal(_("%s= and %s= are mutually exclusive") % ("maps", "file"))
+ msgr.fatal(_("maps and file are mutually exclusive"))
if end and increment:
- msgr.fatal(_("%s= and %s= are mutually exclusive") % ("end", "increment"))
+ msgr.fatal(_("end and increment are mutually exclusive"))
if end and interval:
- msgr.fatal(
- _("%s= and the %s flag are mutually exclusive") % ("end", "interval")
- )
+ msgr.fatal(_("end and the interval flag are mutually exclusive"))
if increment and not start:
msgr.fatal(_("The increment option requires the start option"))
@@ -113,13 +112,14 @@ def register_maps_in_space_time_dataset(
msgr.fatal(_("The interval flag requires the start option"))
if end and not start:
- msgr.fatal(_("Please specify %s= and %s=") % ("start_time", "end_time"))
+ msgr.fatal(_("Please specify start_time and end_time"))
if not maps and not file:
- msgr.fatal(_("Please specify %s= or %s=") % ("maps", "file"))
+ msgr.fatal(_("Please specify maps or file"))
+
# We may need the mapset
mapset = get_current_mapset()
- dbif, connection_state_changed = init_dbif(None)
+ dbif, connection_state_changed = init_dbif(dbif)
# create new stds only in the current mapset
# remove all connections to any other mapsets
@@ -136,23 +136,17 @@ def register_maps_in_space_time_dataset(
dbif.close()
msgr.fatal(
_(
- "Space time %(sp)s dataset <%(name)s> with relative"
- " time found, but no relative unit set for %(sp)s "
+ "Space time {sp} dataset <{name}> with relative"
+ " time found, but no relative unit set for {sp} "
"maps"
- )
- % {"name": name, "sp": sp.get_new_map_instance(None).get_type()}
+ ).format(name=name, sp=sp.get_new_map_instance(None).get_type())
)
maplist = []
# Map names as comma separated string
if maps:
- if maps.find(",") < 0:
- maplist = [
- maps,
- ]
- else:
- maplist = maps.split(",")
+ maplist = maps.split(",")
# Build the map list again with the ids
for idx, maplist_item in enumerate(maplist):
@@ -244,148 +238,140 @@ def register_maps_in_space_time_dataset(
msgr.debug(2, "Gathering map information...")
- for count in range(len(maplist)):
+ for count, row in enumerate(maplist):
if count % 50 == 0:
msgr.percent(count, num_maps, 1)
# Get a new instance of the map type
- map = dataset_factory(type, maplist[count]["id"])
+ map_object = dataset_factory(type, row["id"])
- if map.map_exists() is not True:
+ map_object_id = map_object.get_map_id()
+ map_object_layer = map_object.get_layer()
+ map_object_type = map_object.get_type()
+ if not map_object.map_exists():
msgr.fatal(
- _("Unable to update %(t)s map <%(id)s>. " "The map does not exist.")
- % {"t": map.get_type(), "id": map.get_map_id()}
+ _("Unable to update {t} map <{mid}>. The map does not exist.").format(
+ t=map_object_type, mid=map_object_id
+ )
)
# Use the time data from file
- if "start" in maplist[count]:
- start = maplist[count]["start"]
- if "end" in maplist[count]:
- end = maplist[count]["end"]
+ if "start" in row:
+ start = row["start"]
+ if "end" in row:
+ end = row["end"]
# Use the semantic label from file
- if "semantic_label" in maplist[count]:
- semantic_label = maplist[count]["semantic_label"]
+ if "semantic_label" in row:
+ semantic_label = row["semantic_label"]
else:
semantic_label = None
- is_in_db = False
+ is_in_db = map_object.is_in_db(dbif, mapset)
# Put the map into the database of the current mapset
- if not map.is_in_db(dbif, mapset):
+ if not is_in_db:
# Break in case no valid time is provided
- if (start == "" or start is None) and not map.has_grass_timestamp():
+ if (start == "" or start is None) and not map_object.has_grass_timestamp():
dbif.close()
- if map.get_layer():
+ if map_object_layer:
msgr.fatal(
_(
- "Unable to register %(t)s map <%(id)s> with "
- "layer %(l)s. The map has timestamp and "
+ "Unable to register {t} map <{mid}> with "
+ "layer {l}. The map has timestamp and "
"the start time is not set."
+ ).format(
+ t=map_object_type,
+ mid=map_object_id,
+ l=map_object_layer,
)
- % {
- "t": map.get_type(),
- "id": map.get_map_id(),
- "l": map.get_layer(),
- }
)
else:
msgr.fatal(
_(
- "Unable to register %(t)s map <%(id)s>. The"
+ "Unable to register {t} map <{mid}>. The"
" map has no timestamp and the start time "
"is not set."
- )
- % {"t": map.get_type(), "id": map.get_map_id()}
+ ).format(t=map_object_type, mid=map_object_id)
)
if start != "" and start is not None:
# We need to check if the time is absolute and the unit was specified
time_object = check_datetime_string(start)
if isinstance(time_object, datetime) and unit:
- msgr.fatal(
- _("%(u)s= can only be set for relative time") % {"u": "unit"}
- )
+ msgr.fatal(_("unit can only be set for relative time"))
if not isinstance(time_object, datetime) and not unit:
- msgr.fatal(
- _("%(u)s= must be set in case of relative time" " stamps")
- % {"u": "unit"}
- )
+ msgr.fatal(_("unit must be set in case of relative time stamps"))
if unit:
- map.set_time_to_relative()
+ map_object.set_time_to_relative()
else:
- map.set_time_to_absolute()
+ map_object.set_time_to_absolute()
else:
- is_in_db = True
# Check the overwrite flag
- if not gscript.overwrite():
- if map.get_layer():
+ if not overwrite:
+ if map_object_layer:
msgr.warning(
_(
"Map is already registered in temporal "
- "database. Unable to update %(t)s map "
- "<%(id)s> with layer %(l)s. Overwrite flag"
+ "database. Unable to update {t} map "
+ "<{mid}> with layer {l}. Overwrite flag"
" is not set."
+ ).format(
+ t=map_object_type,
+ mid=map_object_id,
+ l=str(map_object_layer),
)
- % {
- "t": map.get_type(),
- "id": map.get_map_id(),
- "l": str(map.get_layer()),
- }
)
else:
msgr.warning(
_(
"Map is already registered in temporal "
- "database. Unable to update %(t)s map "
- "<%(id)s>. Overwrite flag is not set."
- )
- % {"t": map.get_type(), "id": map.get_map_id()}
+ "database. Unable to update {t} map "
+ "<{mid}>. Overwrite flag is not set."
+ ).format(t=map_object_type, mid=map_object_id)
)
# Simple registration is allowed
if name:
- map_object_list.append(map)
+ map_object_list.append(map_object)
# Jump to next map
continue
- # Select information from temporal database
- map.select(dbif)
+ # Reload properties from database
+ map_object.select(dbif)
# Save the datasets that must be updated
- datasets = map.get_registered_stds(dbif)
+ datasets = map_object.get_registered_stds(dbif)
if datasets is not None:
for dataset in datasets:
if dataset != "":
datatsets_to_modify[dataset] = dataset
- if name and map.get_temporal_type() != sp.get_temporal_type():
+ if name and map_object.get_temporal_type() != sp.get_temporal_type():
dbif.close()
- if map.get_layer():
+ if map_object_layer:
msgr.fatal(
_(
- "Unable to update %(t)s map <%(id)s> "
- "with layer %(l)s. The temporal types "
+ "Unable to update {t} map <{id}> "
+ "with layer {l}. The temporal types "
"are different."
+ ).format(
+ t=map_object_type,
+ mid=map_object_id,
+ l=map_object_layer,
)
- % {
- "t": map.get_type(),
- "id": map.get_map_id(),
- "l": map.get_layer(),
- }
)
else:
msgr.fatal(
_(
- "Unable to update %(t)s map <%(id)s>. "
+ "Unable to update {t} map <{mid}>. "
"The temporal types are different."
- )
- % {"t": map.get_type(), "id": map.get_map_id()}
+ ).format(t=map_object_type, mid=map_object_id)
)
# Load the data from the grass file database
- map.load()
+ map_object.load()
# Try to read an existing time stamp from the grass spatial database
# in case this map wasn't already registered in the temporal database
@@ -393,7 +379,7 @@ def register_maps_in_space_time_dataset(
# this map
# as method argument or in the input file
if not is_in_db and not start:
- map.read_timestamp_from_grass()
+ map_object.read_timestamp_from_grass()
# Set the valid time
if start:
@@ -402,8 +388,8 @@ def register_maps_in_space_time_dataset(
if start_time_in_file:
count = 1
assign_valid_time_to_map(
- ttype=map.get_temporal_type(),
- map=map,
+ ttype=map_object.get_temporal_type(),
+ map_object=map_object,
start=start,
end=end,
unit=unit,
@@ -417,17 +403,17 @@ def register_maps_in_space_time_dataset(
# semantic label defined in input file
# -> update raster metadata
# -> write band identifier to GRASS data base
- map.set_semantic_label(semantic_label)
+ map_object.set_semantic_label(semantic_label)
else:
# Try to read semantic label from GRASS data base if defined
- map.read_semantic_label_from_grass()
+ map_object.read_semantic_label_from_grass()
if is_in_db:
# Gather the SQL update statement
- statement += map.update_all(dbif=dbif, execute=False)
+ statement += map_object.update_all(dbif=dbif, execute=False)
else:
# Gather the SQL insert statement
- statement += map.insert(dbif=dbif, execute=False)
+ statement += map_object.insert(dbif=dbif, execute=False)
# Sqlite3 performance is better for huge datasets when committing in
# small chunks
@@ -439,7 +425,7 @@ def register_maps_in_space_time_dataset(
# Store the maps in a list to register in a space time dataset
if name:
- map_object_list.append(map)
+ map_object_list.append(map_object)
msgr.percent(num_maps, num_maps, 1)
@@ -448,13 +434,11 @@ def register_maps_in_space_time_dataset(
# Finally Register the maps in the space time dataset
if name and map_object_list:
- count = 0
num_maps = len(map_object_list)
- for map in map_object_list:
+ for count, map_object in enumerate(map_object_list):
if count % 50 == 0:
msgr.percent(count, num_maps, 1)
- sp.register_map(map=map, dbif=dbif)
- count += 1
+ sp.register_map(map=map_object, dbif=dbif)
# Update the space time tables
if name and map_object_list:
@@ -465,11 +449,11 @@ def register_maps_in_space_time_dataset(
# Update affected datasets
if datatsets_to_modify:
for dataset in datatsets_to_modify:
- if type == "rast" or type == "raster":
+ if type in ["rast", "raster"]:
ds = dataset_factory("strds", dataset)
- elif type == "raster_3d" or type == "rast3d" or type == "raster3d":
+ elif type in ["raster_3d", "rast3d", "raster3d"]:
ds = dataset_factory("str3ds", dataset)
- elif type == "vect" or type == "vector":
+ elif type in ["vect", "vector"]:
ds = dataset_factory("stvds", dataset)
ds.select(dbif)
ds.update_from_registered_maps(dbif)
@@ -484,7 +468,7 @@ def register_maps_in_space_time_dataset(
def assign_valid_time_to_map(
- ttype, map, start, end, unit, increment=None, mult=1, interval=False
+ ttype, map_object, start, end, unit, increment=None, mult=1, interval=False
):
"""Assign the valid time to a map dataset
@@ -513,7 +497,7 @@ def assign_valid_time_to_map(
start_time = string_to_datetime(start)
if start_time is None:
msgr.fatal(
- _('Unable to convert string "%s"into a ' "datetime object") % (start)
+ _('Unable to convert string "{}" into a datetime object').format(start)
)
end_time = None
@@ -521,7 +505,9 @@ def assign_valid_time_to_map(
end_time = string_to_datetime(end)
if end_time is None:
msgr.fatal(
- _('Unable to convert string "%s"into a ' "datetime object") % (end)
+ _('Unable to convert string "{}" into a datetime object').format(
+ end
+ )
)
# Add the increment
@@ -534,28 +520,32 @@ def assign_valid_time_to_map(
if end_time is None:
msgr.fatal(_("Error occurred in increment computation"))
- if map.get_layer():
+ if map_object.get_layer():
msgr.debug(
1,
_(
- "Set absolute valid time for map <%(id)s> with "
- "layer %(layer)s to %(start)s - %(end)s"
- )
- % {
- "id": map.get_map_id(),
- "layer": map.get_layer(),
- "start": str(start_time),
- "end": str(end_time),
- },
+ "Set absolute valid time for map <{id}> with "
+ "layer {layer} to {start} - {end}"
+ ).format(
+ id=map_object.get_map_id(),
+ layer=map_object.get_layer(),
+ start=str(start_time),
+ end=str(end_time),
+ ),
)
else:
msgr.debug(
1,
- _("Set absolute valid time for map <%s> to %s - %s")
- % (map.get_map_id(), str(start_time), str(end_time)),
+ _(
+ "Set absolute valid time for map <{mid}> to {start_time} - {end_time}"
+ ).format(
+ mid=map_object.get_map_id(),
+ start_time=str(start_time),
+ end_time=str(end_time),
+ ),
)
- map.set_absolute_time(start_time, end_time)
+ map_object.set_absolute_time(start_time, end_time)
else:
start_time = int(start)
end_time = None
@@ -568,23 +558,34 @@ def assign_valid_time_to_map(
if interval:
end_time = start_time + int(increment)
- if map.get_layer():
+ if map_object.get_layer():
msgr.debug(
1,
_(
- "Set relative valid time for map <%s> with layer"
- " %s to %i - %s with unit %s"
- )
- % (map.get_map_id(), map.get_layer(), start_time, str(end_time), unit),
+ "Set relative valid time for map <{mid}> with layer"
+ " {layer} to {start} - {end} with unit {unit}"
+ ).format(
+ mid=map_object.get_map_id(),
+ layer=map_object.get_layer(),
+ start=start_time,
+ end=str(end_time),
+ unit=unit,
+ ),
)
else:
msgr.debug(
1,
- _("Set relative valid time for map <%s> to %i - %s " "with unit %s")
- % (map.get_map_id(), start_time, str(end_time), unit),
+ _(
+ "Set relative valid time for map <{mid}> to {start} - {end} with unit {unit}"
+ ).format(
+ mid=map_object.get_map_id(),
+ start=start_time,
+ end=str(end_time),
+ unit=unit,
+ ),
)
- map.set_relative_time(start_time, end_time, unit)
+ map_object.set_relative_time(start_time, end_time, unit)
##############################################################################
@@ -607,37 +608,34 @@ def register_map_object_list(
import grass.pygrass.modules as pymod
import copy
- dbif, connection_state_changed = init_dbif(dbif)
+ dbif, connection_state_changed = init_dbif(None)
- filename = gscript.tempfile(True)
- file = open(filename, "w")
-
- empty_maps = []
- for map_layer in map_list:
- # Read the map data
- map_layer.load()
- # In case of a empty map continue, do not register empty maps
-
- if delete_empty:
- if type in ["raster", "raster_3d", "rast", "rast3d"]:
- if (
- map_layer.metadata.get_min() is None
- and map_layer.metadata.get_max() is None
- ):
- empty_maps.append(map_layer)
- continue
- if type == "vector":
- if map_layer.metadata.get_number_of_primitives() == 0:
- empty_maps.append(map_layer)
- continue
-
- start, end = map_layer.get_temporal_extent_as_tuple()
- id = map_layer.get_id()
- if not end:
- end = start
- string = "%s|%s|%s\n" % (id, str(start), str(end))
- file.write(string)
- file.close()
+ filename = gs.tempfile(True)
+ with open(filename, "w") as register_file:
+ empty_maps = []
+ for map_layer in map_list:
+ # Read the map data
+ map_layer.load()
+ # In case of a empty map continue, do not register empty maps
+ if delete_empty:
+ if type in ["raster", "raster_3d", "rast", "rast3d"]:
+ if (
+ map_layer.metadata.get_min() is None
+ and map_layer.metadata.get_max() is None
+ ):
+ empty_maps.append(map_layer)
+ continue
+ if type == "vector":
+ if map_layer.metadata.get_number_of_primitives() == 0:
+ empty_maps.append(map_layer)
+ continue
+
+ start, end = map_layer.get_temporal_extent_as_tuple()
+ id = map_layer.get_id()
+ if not end:
+ end = start
+ string = f"{id}|{start}|{end}\n"
+ register_file.write(string)
if output_stds:
output_stds_id = output_stds.get_id()
@@ -648,22 +646,21 @@ def register_map_object_list(
type, output_stds_id, unit=unit, file=filename, dbif=dbif
)
- g_remove = pymod.Module("g.remove", flags="f", quiet=True, run_=False, finish_=True)
-
# Remove empty maps and unregister them from the temporal database
+ g_remove = pymod.Module("g.remove", flags="f", quiet=True, run_=False, finish_=True)
if len(empty_maps) > 0:
- for map in empty_maps:
+ for map_object in empty_maps:
mod = copy.deepcopy(g_remove)
- if map.get_name():
- if map.get_type() == "raster":
- mod(type="raster", name=map.get_name())
- if map.get_type() == "raster3d":
- mod(type="raster_3d", name=map.get_name())
- if map.get_type() == "vector":
- mod(type="vector", name=map.get_name())
+ if map_object.get_name():
+ if map_object.get_type() == "raster":
+ mod(type="raster", name=map_object.get_name())
+ if map_object.get_type() == "raster3d":
+ mod(type="raster_3d", name=map_object.get_name())
+ if map_object.get_type() == "vector":
+ mod(type="vector", name=map_object.get_name())
mod.run()
- if map.is_in_db(dbif):
- map.delete(dbif)
+ if map_object.is_in_db(dbif):
+ map_object.delete(dbif)
if connection_state_changed:
dbif.close()
diff --git a/python/grass/temporal/sampling.py b/python/grass/temporal/sampling.py
index 38fdd1aed53..afe84ce57b3 100644
--- a/python/grass/temporal/sampling.py
+++ b/python/grass/temporal/sampling.py
@@ -16,6 +16,7 @@
:authors: Soeren Gebbert
"""
+
from .core import (
get_current_mapset,
get_tgis_message_interface,
diff --git a/python/grass/temporal/space_time_datasets.py b/python/grass/temporal/space_time_datasets.py
index b91222e4c49..a32cb2d2fac 100644
--- a/python/grass/temporal/space_time_datasets.py
+++ b/python/grass/temporal/space_time_datasets.py
@@ -10,6 +10,7 @@
"""
import getpass
+from datetime import datetime
from .abstract_map_dataset import AbstractMapDataset
from .abstract_space_time_dataset import AbstractSpaceTimeDataset
from .base import (
@@ -56,6 +57,8 @@
import grass.script.array as garray
+GRASS_TIMESTAMP_FMT = "%a %b %d %H:%M:%S %Y"
+
###############################################################################
@@ -417,7 +420,16 @@ def load(self):
return False
# Fill base information
- self.base.set_creator(str(getpass.getuser()))
+ kvp = self.ciface.read_raster_history(self.get_name(), self.get_mapset())
+
+ if kvp:
+ self.base.set_creator(kvp["creator"])
+ self.base.set_ctime(
+ datetime.strptime(kvp["creation_time"], GRASS_TIMESTAMP_FMT)
+ )
+ else:
+ self.base.set_creator(str(getpass.getuser()))
+ self.base.set_ctime()
kvp = self.ciface.read_raster_info(self.get_name(), self.get_mapset())
@@ -820,7 +832,16 @@ def load(self):
return False
# Fill base information
- self.base.set_creator(str(getpass.getuser()))
+ kvp = self.ciface.read_raster3d_history(self.get_name(), self.get_mapset())
+
+ if kvp:
+ self.base.set_creator(kvp["creator"])
+ self.base.set_ctime(
+ datetime.strptime(kvp["creation_time"], GRASS_TIMESTAMP_FMT)
+ )
+ else:
+ self.base.set_creator(str(getpass.getuser()))
+ self.base.set_ctime()
# Fill spatial extent
kvp = self.ciface.read_raster3d_info(self.get_name(), self.get_mapset())
@@ -1157,10 +1178,18 @@ def load(self):
return False
# Fill base information
- self.base.set_creator(str(getpass.getuser()))
+ kvp = self.ciface.read_vector_history(self.get_name(), self.get_mapset())
- # Get the data from an existing vector map
+ if kvp:
+ self.base.set_creator(kvp["creator"])
+ self.base.set_ctime(
+ datetime.strptime(kvp["creation_time"], GRASS_TIMESTAMP_FMT)
+ )
+ else:
+ self.base.set_creator(str(getpass.getuser()))
+ self.base.set_ctime()
+ # Get the data from an existing vector map
kvp = self.ciface.read_vector_info(self.get_name(), self.get_mapset())
if kvp:
diff --git a/python/grass/temporal/spatial_topology_dataset_connector.py b/python/grass/temporal/spatial_topology_dataset_connector.py
index 1427ccd790c..93fe3270c43 100644
--- a/python/grass/temporal/spatial_topology_dataset_connector.py
+++ b/python/grass/temporal/spatial_topology_dataset_connector.py
@@ -13,6 +13,7 @@
:authors: Soeren Gebbert
"""
+
import copy
@@ -67,7 +68,8 @@ class SpatialTopologyDatasetConnector:
meet=a@P
>>> rlist = tmr.get_spatial_relations()
>>> if "COVER" in rlist.keys():
- ... print(rlist["COVER"][0].get_id())
+ ... print(rlist["COVER"][0].get_id())
+ ...
a@P
"""
@@ -318,8 +320,7 @@ def print_spatial_topology_info(self):
"""Print information about this class in human readable style"""
print(
- " +-------------------- Spatial Topology ----------------------------------\
- ----+"
+ " +-------------------- Spatial Topology --------------------------------------+" # noqa: E501
)
# 0123456789012345678901234567890
if self.equivalent is not None:
diff --git a/python/grass/temporal/temporal_algebra.py b/python/grass/temporal/temporal_algebra.py
index d5c2dc2a707..acd0b8adba1 100644
--- a/python/grass/temporal/temporal_algebra.py
+++ b/python/grass/temporal/temporal_algebra.py
@@ -525,9 +525,8 @@ class TemporalAlgebraLexer:
# and in relative units in case of relative time.
# The end_time() will be represented by null() in case of a time instance.
"start_doy": "START_DOY", # Day of year (doy) from the start time [1 - 366]
- # Day of week (dow) from the start time [1 - 7], the start of the week is
- # Monday == 1
- "start_dow": "START_DOW",
+ "start_dow": "START_DOW", # Day of week (dow) from the start time [1 - 7],
+ # the start of the week is Monday == 1
"start_year": "START_YEAR", # The year of the start time [0 - 9999]
"start_month": "START_MONTH", # The month of the start time [1 - 12]
"start_week": "START_WEEK", # Week of year of the start time [1 - 54]
@@ -536,9 +535,8 @@ class TemporalAlgebraLexer:
"start_minute": "START_MINUTE", # The minute of the start time [0 - 59]
"start_second": "START_SECOND", # The second of the start time [0 - 59]
"end_doy": "END_DOY", # Day of year (doy) from the end time [1 - 366]
- # Day of week (dow) from the end time [1 - 7], the start of the week is
- # Monday == 1
- "end_dow": "END_DOW",
+ "end_dow": "END_DOW", # Day of week (dow) from the end time [1 - 7], the
+ # start of the week is Monday == 1
"end_year": "END_YEAR", # The year of the end time [0 - 9999]
"end_month": "END_MONTH", # The month of the end time [1 - 12]
"end_week": "END_WEEK", # Week of year of the end time [1 - 54]
@@ -795,9 +793,10 @@ def __init__(
self.dry_run = (
dry_run # Compute the processes and output but Do not start the processes
)
- # This dictionary stores all processes, as well as the maps to register and
+ self.process_chain_dict = (
+ {}
+ ) # This dictionary stores all processes, as well as the maps to register and
# remove
- self.process_chain_dict = {}
self.process_chain_dict["processes"] = (
[]
) # The mapcalc and v.patch module calls
@@ -925,8 +924,8 @@ def setup_common_granularity(self, expression, stdstype="strds", lexer=None):
if stds.check_temporal_topology() is False:
self.msgr.error(
_(
- "All input space time datasets must have a valid temporal \
- topology."
+ "All input space time datasets must have a valid temporal "
+ "topology."
)
)
return False
@@ -1163,8 +1162,8 @@ def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal="l"):
break
# Append map to result map list.
elif returncode == 1:
- # print(map_new.get_id() + " " + str(
- # map_new.get_temporal_extent_as_tuple()))
+ # print(map_new.get_id() + " " +
+ # str(map_new.get_temporal_extent_as_tuple()))
# print(map_new.condition_value)
# print(map_new.cmd_list)
# resultlist.append(map_new)
@@ -1172,8 +1171,7 @@ def set_temporal_extent_list(self, maplist, topolist=["EQUAL"], temporal="l"):
# Create r.mapcalc expression string for the operation.
# cmdstring = self.build_command_string(
- # s_expr_a = map_new, s_expr_b = map_j,
- # operator = function)
+ # s_expr_a = map_new, s_expr_b = map_j, operator = function)
# Conditional append of module command.
# map_new.cmd_list = cmdstring
if returncode == 0:
@@ -1440,10 +1438,9 @@ def build_spatio_temporal_topology_list(
:return: List of maps from maplistA that fulfil the topological relationships
to maplistB specified in topolist.
- # Example with two lists of maps
-
.. code-block:: python
+ >>> # Example with two lists of maps
>>> import grass.temporal as tgis
>>> tgis.init(True)
>>> l = tgis.TemporalAlgebraParser()
@@ -1987,6 +1984,8 @@ def set_granularity(self, maplistA, maplistB, toperator="l", topolist=["EQUAL"])
if newextent is not None:
start = newextent.get_start_time()
end = newextent.get_end_time()
+ # print(map_i.get_id() + " - start: " + str(start)
+ # + " end: " + str(end))
# Track changes in temporal extents of maps.
if map_start != start or map_end != end:
unchanged = False
@@ -2217,9 +2216,9 @@ def build_condition_list(self, tvarexpr, thenlist, topolist=["EQUAL"]):
"""This function evaluates temporal variable expressions of a conditional
expression in two steps.
At first it combines stepwise the single conditions by their relations with
- LALR. In this process sub condition map lists will be created which will include
- information of the underlying single conditions. Important: The temporal
- relations between conditions are evaluated by implicit aggregation.
+ LALR. In this process sub condition map lists will be created which will
+ include information of the underlying single conditions. Important: The
+ temporal relations between conditions are evaluated by implicit aggregation.
In the second step the aggregated condition map list will be compared with the
map list of conclusion statements by the given temporal relation.
@@ -3434,8 +3433,7 @@ def p_error(self, t):
if t:
raise SyntaxError(
"syntax error on line %d, position %i token %s near '%s' expression "
- "'%s'"
- % (t.lineno, t.lexpos, t.type, t.value, self.expression)
+ "'%s'" % (t.lineno, t.lexpos, t.type, t.value, self.expression)
)
else:
raise SyntaxError("Unexpected syntax error")
diff --git a/python/grass/temporal/temporal_raster3d_algebra.py b/python/grass/temporal/temporal_raster3d_algebra.py
index 536f035130c..88d44768b6a 100644
--- a/python/grass/temporal/temporal_raster3d_algebra.py
+++ b/python/grass/temporal/temporal_raster3d_algebra.py
@@ -10,6 +10,7 @@
:authors: Thomas Leppelt and Soeren Gebbert
"""
+
try:
import ply.yacc as yacc
except ImportError:
diff --git a/python/grass/temporal/testsuite/test_register_function.py b/python/grass/temporal/testsuite/test_register_function.py
index fcf1ad756bf..923e4034027 100644
--- a/python/grass/temporal/testsuite/test_register_function.py
+++ b/python/grass/temporal/testsuite/test_register_function.py
@@ -24,7 +24,7 @@ def setUpClass(cls):
os.putenv("GRASS_OVERWRITE", "1")
# Use always the current mapset as temporal database
cls.runModule("g.gisenv", set="TGIS_USE_CURRENT_MAPSET=1")
- tgis.init()
+ cls.dbif = tgis.init()
cls.use_temp_region()
cls.runModule("g.region", n=80.0, s=0.0, e=120.0, w=0.0, t=1.0, b=0.0, res=10.0)
@@ -72,7 +72,7 @@ def tearDown(self):
self.runModule(
"t.unregister",
type="raster",
- maps="register_map_1,register_map_2",
+ maps="register_map_1,register_map_2,elevation",
quiet=True,
)
self.runModule(
@@ -118,7 +118,8 @@ def test_absolute_time_strds_1(self):
def test_absolute_time_strds_2(self):
"""Test the registration of maps with absolute time in a
space time raster dataset.
- The timestamps are set using the C-Interface beforehand, so that the register function needs
+ The timestamps are set using the C-Interface beforehand,
+ so that the register function needs
to read the timetsamp from the map metadata.
"""
@@ -155,9 +156,10 @@ def test_absolute_time_strds_2(self):
def test_absolute_time_strds_3(self):
"""Test the registration of maps with absolute time in a
- space time raster dataset. The timestamps are set via method arguments and with the
- c-interface. The timestamps of the method arguments should overwrite the
- time stamps set via the C-interface.
+ space time raster dataset. The timestamps are set via method
+ arguments and with the c-interface. The timestamps of the
+ method arguments should overwrite the time stamps set via the
+ C-interface.
"""
ciface = tgis.get_tgis_c_library_interface()
@@ -187,9 +189,10 @@ def test_absolute_time_strds_3(self):
def test_absolute_time_strds_4(self):
"""Test the registration of maps with absolute time in a
- space time raster dataset. The timestamps are set via method arguments and with the
- c-interface. The timestamps of the method arguments should overwrite the
- time stamps set via the C-interface. The C-interface sets relative time stamps.
+ space time raster dataset. The timestamps are set via method
+ arguments and with the c-interface. The timestamps of the method
+ arguments should overwrite the time stamps set via the C-interface.
+ The C-interface sets relative time stamps.
"""
ciface = tgis.get_tgis_c_library_interface()
@@ -258,7 +261,8 @@ def test_absolute_time_1(self):
def test_absolute_time_2(self):
"""Test the registration of maps with absolute time
- using register_maps_in_space_time_dataset() and register_map_object_list() with empty map deletion
+ using register_maps_in_space_time_dataset() and
+ register_map_object_list() with empty map deletion
"""
tgis.register_maps_in_space_time_dataset(
type="raster",
@@ -300,9 +304,58 @@ def test_absolute_time_2(self):
map_3 = tgis.VectorDataset("register_map_null@" + tgis.get_current_mapset())
self.assertEqual(map_3.map_exists(), False)
+ def test_history_raster(self):
+ """Test that raster maps are registered with the history
+ (creator and creation time) of the raster map itself (and from a
+ different mapset (PERMANENT)
+ """
+ tgis.register_maps_in_space_time_dataset(
+ type="raster",
+ name=None,
+ maps="elevation@PERMANENT",
+ start="2001-01-01 10:30:01",
+ increment="1 year",
+ interval=True,
+ dbif=self.dbif,
+ )
+
+ map_1 = tgis.RasterDataset("elevation@PERMANENT")
+ map_1.select(self.dbif, tgis.get_current_mapset())
+ # Test that creation time of the map is used
+ self.assertEqual(
+ map_1.base.get_ctime(), datetime.datetime(2006, 11, 7, 1, 9, 51)
+ )
+ # Test that registered creator of the map is not the current user
+ self.assertEqual(map_1.base.get_creator(), "helena")
+
+ def test_history_vector(self):
+ """Test that vector maps are registered with the history (creator
+ and creation time) of the vector map itself (and from a
+ different mapset (PERMANENT)
+ """
+ tgis.register_maps_in_space_time_dataset(
+ type="vector",
+ name=None,
+ maps="lakes@PERMANENT",
+ start="2001-01-01 10:30:01",
+ increment="1 year",
+ interval=True,
+ dbif=self.dbif,
+ )
+
+ map_1 = tgis.VectorDataset("lakes@PERMANENT")
+ map_1.select(self.dbif, tgis.get_current_mapset())
+ # Test that creation time of the map is used
+ self.assertEqual(
+ map_1.base.get_ctime(), datetime.datetime(2006, 11, 7, 19, 48, 8)
+ )
+ # Test that registered creator of the map is not the current user
+ self.assertTrue(map_1.base.get_creator(), "helena")
+
def test_absolute_time_3(self):
"""Test the registration of maps with absolute time.
- The timestamps are set using the C-Interface beforehand, so that the register function needs
+ The timestamps are set using the C-Interface beforehand,
+ so that the register function needs
to read the timetsamp from the map metadata.
"""
@@ -365,8 +418,8 @@ def test_relative_time_strds_1(self):
def test_relative_time_strds_2(self):
"""Test the registration of maps with relative time in a
- space time raster dataset. The timetsamps are set for the maps using the
- C-interface before registration.
+ space time raster dataset. The timestamps are set for the maps
+ using the C-interface before registration.
"""
ciface = tgis.get_tgis_c_library_interface()
ciface.write_raster_timestamp(
@@ -459,8 +512,8 @@ def test_relative_time_2(self):
self.assertEqual(unit, "seconds")
def test_relative_time_3(self):
- """Test the registration of maps with relative time. The timetsamps are set beforehand using
- the C-interface.
+ """Test the registration of maps with relative time. The
+ timestamps are set beforehand using the C-interface.
"""
ciface = tgis.get_tgis_c_library_interface()
ciface.write_raster_timestamp(
@@ -619,7 +672,8 @@ def test_absolute_time_stvds_1(self):
def test_absolute_time_stvds_2(self):
"""Test the registration of maps with absolute time in a
space time raster dataset.
- The timestamps are set using the C-Interface beforehand, so that the register function needs
+ The timestamps are set using the C-Interface beforehand,
+ so that the register function needs
to read the timetsamp from the map metadata.
"""
@@ -656,9 +710,9 @@ def test_absolute_time_stvds_2(self):
def test_absolute_time_stvds_3(self):
"""Test the registration of maps with absolute time in a
- space time raster dataset. The timestamps are set via method arguments and with the
- c-interface. The timestamps of the method arguments should overwrite the
- time stamps set via the C-interface.
+ space time raster dataset. The timestamps are set via method
+ arguments and with the C-interface. The timestamps of the method
+ arguments should overwrite the time stamps set via the C-interface.
"""
ciface = tgis.get_tgis_c_library_interface()
@@ -687,7 +741,8 @@ def test_absolute_time_stvds_3(self):
self.assertEqual(end, datetime.datetime(2001, 2, 2))
def test_absolute_time_1(self):
- """Register vector maps in the temporal database and in addition in a stvds using the object method
+ """Register vector maps in the temporal database and in addition
+ in a stvds using the object method
:return:
"""
diff --git a/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py b/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py
index fd011a55d53..1ed80cd1316 100644
--- a/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py
+++ b/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py
@@ -7,7 +7,6 @@
:authors: Soeren Gebbert and Thomas Leppelt
"""
-
import grass.script
import grass.temporal as tgis
from grass.gunittest.case import TestCase
diff --git a/python/grass/temporal/unit_tests.py b/python/grass/temporal/unit_tests.py
index fd412ee6cf2..8083680ef3f 100644
--- a/python/grass/temporal/unit_tests.py
+++ b/python/grass/temporal/unit_tests.py
@@ -8,6 +8,7 @@
:authors: Soeren Gebbert
"""
+
import copy
from datetime import datetime
import grass.script.core as core
diff --git a/raster/r.basins.fill/testsuite/testrbf.py b/raster/r.basins.fill/testsuite/testrbf.py
index fdbcd4b548f..b9937b05689 100644
--- a/raster/r.basins.fill/testsuite/testrbf.py
+++ b/raster/r.basins.fill/testsuite/testrbf.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
import unittest
from grass.gunittest.case import TestCase
diff --git a/raster/r.external/main.c b/raster/r.external/main.c
index c3ee9b8daf2..baf5b7c8ea0 100644
--- a/raster/r.external/main.c
+++ b/raster/r.external/main.c
@@ -98,10 +98,9 @@ int main(int argc, char *argv[])
flag.o = G_define_flag();
flag.o->key = 'o';
- flag.o->label =
- _("Override projection check (use current location's projection)");
- flag.o->description = _(
- "Assume that the dataset has same projection as the current location");
+ flag.o->label = _("Override projection check (use current project's CRS)");
+ flag.o->description = _("Assume that the dataset has the same coordinate "
+ "reference system as the current project");
flag.j = G_define_flag();
flag.j->key = 'j';
diff --git a/raster/r.external/proj.c b/raster/r.external/proj.c
index 0e38578fe06..7b9b8043133 100644
--- a/raster/r.external/proj.c
+++ b/raster/r.external/proj.c
@@ -130,15 +130,16 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, char *outloc,
if (outloc != NULL) {
/* do not create a xy location if an existing SRS was unreadable */
if (proj_trouble == 2) {
- G_fatal_error(_("Unable to convert input map projection to GRASS "
- "format; cannot create new location."));
+ G_fatal_error(
+ _("Unable to convert input map coordinate reference "
+ "system to GRASS format; cannot create new project."));
}
else {
if (0 != G_make_location_crs(outloc, cellhd, proj_info, proj_units,
srid, wkt)) {
- G_fatal_error(_("Unable to create new location <%s>"), outloc);
+ G_fatal_error(_("Unable to create new project <%s>"), outloc);
}
- G_message(_("Location <%s> created"), outloc);
+ G_message(_("Project <%s> created"), outloc);
G_unset_window(); /* new location, projection, and window */
G_get_window(cellhd);
@@ -195,14 +196,15 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, char *outloc,
proj_info, proj_units)) != 1) {
int i_value;
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg,
+ _("Coordinate reference system of dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd->proj || err != -2) {
/* error in proj_info */
if (loc_proj_info != NULL) {
- strcat(error_msg, _("Location PROJ_INFO is:\n"));
+ strcat(error_msg, _("Project PROJ_INFO is:\n"));
for (i_value = 0; i_value < loc_proj_info->nitems;
i_value++)
sprintf(error_msg + strlen(error_msg), "%s: %s\n",
@@ -211,22 +213,22 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, char *outloc,
strcat(error_msg, "\n");
}
else {
- strcat(error_msg, _("Location PROJ_INFO is:\n"));
+ strcat(error_msg, _("Project PROJ_INFO is:\n"));
if (loc_wind.proj == PROJECTION_XY)
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (unreferenced/unknown)\n",
+ "Project proj = %d (unreferenced/unknown)\n",
loc_wind.proj);
else if (loc_wind.proj == PROJECTION_LL)
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (lat/long)\n",
+ "Project proj = %d (lat/long)\n",
loc_wind.proj);
else if (loc_wind.proj == PROJECTION_UTM)
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (UTM), zone = %d\n",
+ "Project proj = %d (UTM), zone = %d\n",
loc_wind.proj, cellhd->zone);
else
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (unknown), zone = %d\n",
+ "Project proj = %d (unknown), zone = %d\n",
loc_wind.proj, cellhd->zone);
}
@@ -300,7 +302,7 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, char *outloc,
else {
/* error in proj_units */
if (loc_proj_units != NULL) {
- strcat(error_msg, "Location PROJ_UNITS is:\n");
+ strcat(error_msg, "Project PROJ_UNITS is:\n");
for (i_value = 0; i_value < loc_proj_units->nitems;
i_value++)
sprintf(error_msg + strlen(error_msg), "%s: %s\n",
@@ -318,13 +320,14 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, char *outloc,
}
}
if (!check_only) {
- strcat(error_msg, _("\nIn case of no significant differences "
- "in the projection definitions,"
- " use the -o flag to ignore them and use"
- " current location definition.\n"));
- strcat(error_msg, _("Consider generating a new location from "
+ strcat(error_msg,
+ _("\nIn case of no significant differences "
+ "in the coordinate reference system definitions,"
+ " use the -o flag to ignore them and use"
+ " current project definition.\n"));
+ strcat(error_msg, _("Consider generating a new project from "
"the input dataset using "
- "the 'location' parameter.\n"));
+ "the 'project' parameter.\n"));
}
if (check_only)
@@ -342,8 +345,8 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, char *outloc,
msg_fn = G_message;
else
msg_fn = G_verbose_message;
- msg_fn(_("Projection of input dataset and current location "
- "appear to match"));
+ msg_fn(_("Coordinate reference system of input dataset and current "
+ "project appear to match"));
if (check_only) {
GDALClose(hDS);
exit(EXIT_SUCCESS);
diff --git a/raster/r.external/testsuite/test_r_external.py b/raster/r.external/testsuite/test_r_external.py
index 839a724a5b7..a22498eb773 100644
--- a/raster/r.external/testsuite/test_r_external.py
+++ b/raster/r.external/testsuite/test_r_external.py
@@ -2,6 +2,7 @@
@author Markus Neteler
"""
+
from grass.gunittest.case import TestCase
diff --git a/raster/r.gwflow/testsuite/validation_7x7_grid.py b/raster/r.gwflow/testsuite/validation_7x7_grid.py
index f4595eaf421..6d632092300 100644
--- a/raster/r.gwflow/testsuite/validation_7x7_grid.py
+++ b/raster/r.gwflow/testsuite/validation_7x7_grid.py
@@ -7,6 +7,7 @@
@author Soeren Gebbert
"""
+
from grass.gunittest.case import TestCase
diff --git a/raster/r.horizon/testsuite/test_r_horizon.py b/raster/r.horizon/testsuite/test_r_horizon.py
index 4118c1cb203..846988401dc 100644
--- a/raster/r.horizon/testsuite/test_r_horizon.py
+++ b/raster/r.horizon/testsuite/test_r_horizon.py
@@ -11,6 +11,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
import json
from grass.gunittest.case import TestCase
diff --git a/raster/r.in.ascii/testsuite/test_r_in_ascii.py b/raster/r.in.ascii/testsuite/test_r_in_ascii.py
index 151b6ff7978..20e0c2a8f9e 100644
--- a/raster/r.in.ascii/testsuite/test_r_in_ascii.py
+++ b/raster/r.in.ascii/testsuite/test_r_in_ascii.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.script.core import read_command
diff --git a/raster/r.in.gdal/testsuite/test_r_in_gdal.py b/raster/r.in.gdal/testsuite/test_r_in_gdal.py
index 3e3f6bcd554..2b8bee0982a 100644
--- a/raster/r.in.gdal/testsuite/test_r_in_gdal.py
+++ b/raster/r.in.gdal/testsuite/test_r_in_gdal.py
@@ -2,6 +2,7 @@
@author Soeren Gebbert
"""
+
from grass.gunittest.case import TestCase
diff --git a/raster/r.in.lidar/main.c b/raster/r.in.lidar/main.c
index 9c7d4cdad8f..68d3a0fcd1b 100644
--- a/raster/r.in.lidar/main.c
+++ b/raster/r.in.lidar/main.c
@@ -300,9 +300,10 @@ int main(int argc, char *argv[])
over_flag = G_define_flag();
over_flag->key = 'o';
over_flag->label =
- _("Override projection check (use current location's projection)");
- over_flag->description = _(
- "Assume that the dataset has same projection as the current location");
+ _("Override projection check (use current project's CRS)");
+ over_flag->description =
+ _("Assume that the dataset has the same coordinate reference system as "
+ "the current project");
scan_flag = G_define_flag();
scan_flag->key = 's';
diff --git a/raster/r.in.lidar/projection.c b/raster/r.in.lidar/projection.c
index faf123db11b..a3c4ff057b2 100644
--- a/raster/r.in.lidar/projection.c
+++ b/raster/r.in.lidar/projection.c
@@ -29,8 +29,8 @@ void projection_mismatch_report(struct Cell_head cellhd,
int i_value;
char error_msg[8192];
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg, _("Coordinate reference system of dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd.proj || err != -2) {
@@ -86,12 +86,12 @@ void projection_mismatch_report(struct Cell_head cellhd,
}
}
sprintf(error_msg + strlen(error_msg),
- _("\nIn case of no significant differences in the projection "
- "definitions,"
+ _("\nIn case of no significant differences"
+ " in the coordinate reference system definitions,"
" use the -o flag to ignore them and use"
- " current location definition.\n"));
+ " current project definition.\n"));
strcat(error_msg,
- _("Consider generating a new location with 'location' parameter"
+ _("Consider generating a new project with 'project' parameter"
" from input data set.\n"));
G_fatal_error("%s", error_msg);
}
@@ -132,7 +132,8 @@ void projection_check_wkt(struct Cell_head cellhd, struct Cell_head loc_wind,
loc_proj_units, proj_info, proj_units, err);
}
else if (verbose) {
- G_message(_("Projection of input dataset and current location "
- "appear to match"));
+ G_message(_(
+ "Coordinate reference system of input dataset and current project "
+ "appear to match"));
}
}
diff --git a/raster/r.in.lidar/r.in.lidar.html b/raster/r.in.lidar/r.in.lidar.html
index ff32c8291c2..6cff187c089 100644
--- a/raster/r.in.lidar/r.in.lidar.html
+++ b/raster/r.in.lidar/r.in.lidar.html
@@ -464,7 +464,7 @@ Serpent Mound dataset
# using v.in.lidar to create a new project
# create project with CRS information of the LAS data
-v.in.lidar -i input="Serpent Mound Model LAS Data.las" location=Serpent_Mound
+v.in.lidar -i input="Serpent Mound Model LAS Data.las" project=Serpent_Mound
# quit and restart GRASS in the newly created project "Serpent_Mound"
diff --git a/raster/r.in.pdal/main.cpp b/raster/r.in.pdal/main.cpp
index 63ab5c19f03..093b17258e1 100644
--- a/raster/r.in.pdal/main.cpp
+++ b/raster/r.in.pdal/main.cpp
@@ -248,10 +248,10 @@ int main(int argc, char *argv[])
reproject_flag->key = 'w';
reproject_flag->label =
- _("Reproject to location's coordinate system if needed");
+ _("Reproject to project's coordinate system if needed");
reproject_flag->description =
_("Reprojects input dataset to the coordinate system of"
- " the GRASS location (by default only datasets with the"
+ " the GRASS project (by default only datasets with"
" matching coordinate system can be imported");
reproject_flag->guisection = _("Projection");
@@ -393,9 +393,10 @@ int main(int argc, char *argv[])
over_flag->key = 'o';
over_flag->label =
- _("Override projection check (use current location's projection)");
- over_flag->description = _(
- "Assume that the dataset has same projection as the current location");
+ _("Override projection check (use current project's CRS)");
+ over_flag->description =
+ _("Assume that the dataset has the same coordinate reference system as "
+ "the current project");
over_flag->guisection = _("Projection");
Flag *base_rast_res_flag = G_define_flag();
@@ -731,7 +732,7 @@ int main(int argc, char *argv[])
// we reproject when requested regardless of the input projection
if (reproject_flag->answer) {
- G_message(_("Reprojecting the input to the location projection"));
+ G_message(_("Reprojecting the input to the project's CRS"));
char *proj_wkt = location_projection_as_wkt(false);
pdal::Options o4;
@@ -781,8 +782,8 @@ int main(int argc, char *argv[])
// getting projection is possible only after prepare
if (over_flag->answer) {
G_important_message(_("Overriding projection check and assuming"
- " that the projection of input matches"
- " the location projection"));
+ " that the CRS of input matches"
+ " the project's CRS"));
}
else if (!reproject_flag->answer) {
pdal::SpatialReference spatial_reference =
diff --git a/raster/r.in.pdal/projection.c b/raster/r.in.pdal/projection.c
index 244ee323afb..25e6da8e25e 100644
--- a/raster/r.in.pdal/projection.c
+++ b/raster/r.in.pdal/projection.c
@@ -27,8 +27,8 @@ void projection_mismatch_report(struct Cell_head cellhd,
int i_value;
char error_msg[8192];
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg, _("Coordinate reference system of dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd.proj || err != -2) {
@@ -84,12 +84,12 @@ void projection_mismatch_report(struct Cell_head cellhd,
}
}
sprintf(error_msg + strlen(error_msg),
- _("\nIn case of no significant differences in the projection "
- "definitions,"
+ _("\nIn case of no significant differences"
+ " in the coordinate reference system definitions,"
" use the -o flag to ignore them and use"
- " current location definition.\n"));
+ " current project definition.\n"));
strcat(error_msg,
- _("Consider generating a new location with 'location' parameter"
+ _("Consider generating a new project with 'project' parameter"
" from input data set.\n"));
G_fatal_error("%s", error_msg);
}
@@ -131,8 +131,8 @@ void projection_check_wkt(struct Cell_head cellhd, struct Cell_head loc_wind,
}
else {
if (verbose) {
- G_message(_("Projection of input dataset and current location "
- "appear to match"));
+ G_message(_("Coordinate reference system of input dataset and "
+ "current project appear to match"));
}
}
}
diff --git a/raster/r.in.pdal/r.in.pdal.html b/raster/r.in.pdal/r.in.pdal.html
index 3dd9d068ac7..92cd25205e8 100644
--- a/raster/r.in.pdal/r.in.pdal.html
+++ b/raster/r.in.pdal/r.in.pdal.html
@@ -522,7 +522,7 @@ Serpent Mound dataset
# using v.in.lidar to create a new project
# create a project with CRS information of the LAS data
-v.in.lidar -i input="Serpent Mound Model LAS Data.las" location=Serpent_Mound
+v.in.lidar -i input="Serpent Mound Model LAS Data.las" project=Serpent_Mound
# quit and restart GRASS in the newly created project "Serpent_Mound"
diff --git a/raster/r.info/testsuite/test_r_info.py b/raster/r.info/testsuite/test_r_info.py
index 05953ae56b4..a4d554232dd 100644
--- a/raster/r.info/testsuite/test_r_info.py
+++ b/raster/r.info/testsuite/test_r_info.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.gmodules import SimpleModule
diff --git a/raster/r.random.cells/testsuite/test_random_cells.py b/raster/r.random.cells/testsuite/test_random_cells.py
index 9faeb3b0135..0d4ca4379e5 100644
--- a/raster/r.random.cells/testsuite/test_random_cells.py
+++ b/raster/r.random.cells/testsuite/test_random_cells.py
@@ -12,7 +12,6 @@
for details.
"""
-
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/raster/r.random/testsuite/testrandom.py b/raster/r.random/testsuite/testrandom.py
index 791aebfa669..e2bc2e413a3 100644
--- a/raster/r.random/testsuite/testrandom.py
+++ b/raster/r.random/testsuite/testrandom.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
diff --git a/raster/r.reclass/testsuite/test_r_reclass.py b/raster/r.reclass/testsuite/test_r_reclass.py
index 71d63d1c4bb..3f4ecfdf6a3 100644
--- a/raster/r.reclass/testsuite/test_r_reclass.py
+++ b/raster/r.reclass/testsuite/test_r_reclass.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
diff --git a/raster/r.series.interp/testsuite/interp_test.py b/raster/r.series.interp/testsuite/interp_test.py
index 017912172be..e4cadd251cd 100644
--- a/raster/r.series.interp/testsuite/interp_test.py
+++ b/raster/r.series.interp/testsuite/interp_test.py
@@ -1,6 +1,7 @@
"""Test of r.series.interp
@author Soeren Gebbert
"""
+
from grass.gunittest.case import TestCase
diff --git a/raster/r.support/testsuite/test_r_support.py b/raster/r.support/testsuite/test_r_support.py
index f7b7dd9e917..9a024c4a723 100644
--- a/raster/r.support/testsuite/test_r_support.py
+++ b/raster/r.support/testsuite/test_r_support.py
@@ -8,6 +8,7 @@
Read the file COPYING that comes with GRASS
for details
"""
+
import random
import string
diff --git a/raster/r.texture/testsuite/test_texture.py b/raster/r.texture/testsuite/test_texture.py
index af24229e9ba..378eaaeabb5 100644
--- a/raster/r.texture/testsuite/test_texture.py
+++ b/raster/r.texture/testsuite/test_texture.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
diff --git a/raster/r.tile/testsuite/testrt.py b/raster/r.tile/testsuite/testrt.py
index c1da1d10cdf..6cb5a91c296 100644
--- a/raster/r.tile/testsuite/testrt.py
+++ b/raster/r.tile/testsuite/testrt.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/raster/r.to.vect/testsuite/test_r_to_vect.py b/raster/r.to.vect/testsuite/test_r_to_vect.py
index 57de45e4b77..7ba284d0261 100644
--- a/raster/r.to.vect/testsuite/test_r_to_vect.py
+++ b/raster/r.to.vect/testsuite/test_r_to_vect.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/raster/r.univar/testsuite/test_r_univar.py b/raster/r.univar/testsuite/test_r_univar.py
index 368ff3faae0..c03aea5dcfa 100644
--- a/raster/r.univar/testsuite/test_r_univar.py
+++ b/raster/r.univar/testsuite/test_r_univar.py
@@ -2,6 +2,7 @@
@author Soeren Gebbert
"""
+
from grass.gunittest.case import TestCase
diff --git a/raster/r.what/testsuite/testrw.py b/raster/r.what/testsuite/testrw.py
index f63ae5dfe30..8184f534720 100644
--- a/raster/r.what/testsuite/testrw.py
+++ b/raster/r.what/testsuite/testrw.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
diff --git a/raster3d/r3.flow/testsuite/r3flow_test.py b/raster3d/r3.flow/testsuite/r3flow_test.py
index 8385f10559e..f7d013f38bd 100644
--- a/raster3d/r3.flow/testsuite/r3flow_test.py
+++ b/raster3d/r3.flow/testsuite/r3flow_test.py
@@ -3,6 +3,7 @@
@author Anna Petrasova
"""
+
import os
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/raster3d/r3.gradient/testsuite/r3gradient_test.py b/raster3d/r3.gradient/testsuite/r3gradient_test.py
index 9d0814dac78..d41e0a74baa 100644
--- a/raster3d/r3.gradient/testsuite/r3gradient_test.py
+++ b/raster3d/r3.gradient/testsuite/r3gradient_test.py
@@ -3,6 +3,7 @@
@author Anna Petrasova
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/raster3d/r3.in.lidar/main.c b/raster3d/r3.in.lidar/main.c
index cd622a6098f..6170a3f50ba 100644
--- a/raster3d/r3.in.lidar/main.c
+++ b/raster3d/r3.in.lidar/main.c
@@ -287,9 +287,10 @@ int main(int argc, char *argv[])
over_flag = G_define_flag();
over_flag->key = 'o';
over_flag->label =
- _("Override projection check (use current location's projection)");
- over_flag->description = _(
- "Assume that the dataset has same projection as the current location");
+ _("Override projection check (use current projects's CRS)");
+ over_flag->description =
+ _("Assume that the dataset has the same coordinate "
+ "reference system as the current project");
print_flag = G_define_flag();
print_flag->key = 'p';
diff --git a/raster3d/r3.in.lidar/projection.c b/raster3d/r3.in.lidar/projection.c
index 40eb4b6e289..a3ebea5d7f4 100644
--- a/raster3d/r3.in.lidar/projection.c
+++ b/raster3d/r3.in.lidar/projection.c
@@ -30,8 +30,8 @@ void projection_mismatch_report(struct Cell_head cellhd,
int i_value;
char error_msg[8192];
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg, _("Coordinate reference system of dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd.proj || err != -2) {
@@ -87,12 +87,12 @@ void projection_mismatch_report(struct Cell_head cellhd,
}
}
sprintf(error_msg + strlen(error_msg),
- _("\nIn case of no significant differences in the projection "
- "definitions,"
+ _("\nIn case of no significant differences in the"
+ " coordinate reference system definitions,"
" use the -o flag to ignore them and use"
- " current location definition.\n"));
+ " current project definition.\n"));
strcat(error_msg,
- _("Consider generating a new location with 'location' parameter"
+ _("Consider generating a new project with 'project' parameter"
" from input data set.\n"));
G_fatal_error("%s", error_msg);
}
@@ -133,7 +133,8 @@ void projection_check_wkt(struct Cell_head cellhd, struct Cell_head loc_wind,
loc_proj_units, proj_info, proj_units, err);
}
else if (verbose) {
- G_message(_("Projection of input dataset and current location "
- "appear to match"));
+ G_message(_(
+ "Coordinate reference system of input dataset and current project "
+ "appear to match"));
}
}
diff --git a/scripts/r.fillnulls/testsuite/test_r_fillnulls.py b/scripts/r.fillnulls/testsuite/test_r_fillnulls.py
index 8cfed138f4e..975fd5330f2 100644
--- a/scripts/r.fillnulls/testsuite/test_r_fillnulls.py
+++ b/scripts/r.fillnulls/testsuite/test_r_fillnulls.py
@@ -3,6 +3,7 @@
@author: Sanjeet Bhatti
"""
+
import os
from grass.gunittest.case import TestCase
diff --git a/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py b/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py
index 70da5f40b11..d400ccc7980 100644
--- a/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py
+++ b/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
diff --git a/scripts/r.reclass.area/testsuite/testrra.py b/scripts/r.reclass.area/testsuite/testrra.py
index 6c7822c0f6c..e6e2300875b 100644
--- a/scripts/r.reclass.area/testsuite/testrra.py
+++ b/scripts/r.reclass.area/testsuite/testrra.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/scripts/r.unpack/r.unpack.py b/scripts/r.unpack/r.unpack.py
index f195ebc151f..a19123b28f0 100644
--- a/scripts/r.unpack/r.unpack.py
+++ b/scripts/r.unpack/r.unpack.py
@@ -30,8 +30,8 @@
# %end
# %flag
# % key: o
-# % label: Override projection check (use current location's projection)
-# % description: Assume that the dataset has same projection as the current location
+# % label: Override projection check (use current projects's CRS)
+# % description: Assume that the dataset has same coordinate reference system as the current project
# % guisection: Output settings
# %end
# %flag
@@ -140,9 +140,7 @@ def main():
# check projection compatibility in a rather crappy way
if flags["o"]:
- grass.warning(
- _("Overriding projection check (using current location's projection).")
- )
+ grass.warning(_("Overriding projection check (using current project's CRS)."))
else:
diff_result_1 = diff_result_2 = None
@@ -156,7 +154,7 @@ def main():
grass.fatal(
_(
"PROJ_INFO file is missing, unpack raster map in XY "
- "(unprojected) location."
+ "(unprojected) project."
)
)
skip_projection_check = True # XY location
@@ -180,22 +178,23 @@ def main():
grass.warning(
_(
"Difference between PROJ_INFO file of packed map "
- "and of current location:\n{diff}"
+ "and of current project:\n{diff}"
).format(diff="".join(diff_result_1))
)
if diff_result_2:
grass.warning(
_(
"Difference between PROJ_UNITS file of packed map "
- "and of current location:\n{diff}"
+ "and of current project:\n{diff}"
).format(diff="".join(diff_result_2))
)
grass.fatal(
_(
- "Projection of dataset does not appear to match current "
- "location. In case of no significant differences in the "
- "projection definitions, use the -o flag to ignore them and "
- "use current location definition."
+ "Coordinate reference system of dataset does"
+ " not appear to match current project."
+ " In case of no significant differences in the CRS definitions,"
+ " use the -o flag to ignore them and use"
+ " current project definition."
)
)
diff --git a/scripts/v.db.addcolumn/v.db.addcolumn.py b/scripts/v.db.addcolumn/v.db.addcolumn.py
index 2ce1a3eedc2..8d8e322118c 100755
--- a/scripts/v.db.addcolumn/v.db.addcolumn.py
+++ b/scripts/v.db.addcolumn/v.db.addcolumn.py
@@ -42,6 +42,8 @@
import atexit
import os
+import re
+
from grass.exceptions import CalledModuleError
import grass.script as grass
@@ -98,17 +100,26 @@ def main():
column_existing = grass.vector_columns(map, int(layer)).keys()
add_str = "BEGIN TRANSACTION\n"
+ pattern = re.compile(r"\s+")
for col in columns:
if not col:
grass.fatal(_("There is an empty column. Did you leave a trailing comma?"))
- col_name = col.split(" ")[0].strip()
+ whitespace = re.search(pattern, col)
+ if not whitespace:
+ grass.fatal(
+ _(
+ "Incorrect new column(s) format, use"
+ " <'name type [,name type, ...]'> format, please."
+ )
+ )
+ col_name, col_type = col.split(whitespace.group(0), 1)
if col_name in column_existing:
grass.error(
_("Column <{}> is already in the table. Skipping.").format(col_name)
)
continue
grass.verbose(_("Adding column <{}> to the table").format(col_name))
- add_str += f"ALTER TABLE {table} ADD COLUMN {col};\n"
+ add_str += f'ALTER TABLE {table} ADD COLUMN "{col_name}" {col_type};\n'
add_str += "END TRANSACTION"
sql_file = grass.tempfile()
rm_files.append(sql_file)
diff --git a/scripts/v.db.dropcolumn/v.db.dropcolumn.py b/scripts/v.db.dropcolumn/v.db.dropcolumn.py
index 937f573006c..b408c83395a 100755
--- a/scripts/v.db.dropcolumn/v.db.dropcolumn.py
+++ b/scripts/v.db.dropcolumn/v.db.dropcolumn.py
@@ -96,11 +96,11 @@ def main():
# see db_sqltype_name() for type names
if f[1] == "CHARACTER":
# preserve field length for sql type "CHARACTER"
- coltypes.append("%s %s(%s)" % (f[0], f[1], f[2]))
+ coltypes.append(f'"{f[0]}" {f[1]}({f[2]})')
else:
- coltypes.append("%s %s" % (f[0], f[1]))
+ coltypes.append(f'"{f[0]}" {f[1]}')
- colnames = ", ".join(colnames)
+ colnames = ", ".join([f'"{col}"' for col in colnames])
coltypes = ", ".join(coltypes)
cmds = [
@@ -119,7 +119,7 @@ def main():
table=table, coldef=coltypes, colnames=colnames, keycol=keycol
)
else:
- sql = "ALTER TABLE %s DROP COLUMN %s" % (table, column)
+ sql = f'ALTER TABLE {table} DROP COLUMN "{column}"'
try:
grass.write_command(
diff --git a/scripts/v.db.renamecolumn/v.db.renamecolumn.py b/scripts/v.db.renamecolumn/v.db.renamecolumn.py
index 0309cff406a..87f1850a57c 100755
--- a/scripts/v.db.renamecolumn/v.db.renamecolumn.py
+++ b/scripts/v.db.renamecolumn/v.db.renamecolumn.py
@@ -103,12 +103,12 @@ def main():
# some tricks
if driver in ["sqlite", "dbf"]:
if oldcoltype.upper() == "CHARACTER":
- colspec = "%s varchar(%s)" % (newcol, oldcollength)
+ colspec = f"{newcol} varchar({oldcollength})"
else:
- colspec = "%s %s" % (newcol, oldcoltype)
+ colspec = f"{newcol} {oldcoltype}"
grass.run_command("v.db.addcolumn", map=map, layer=layer, column=colspec)
- sql = "UPDATE %s SET %s=%s" % (table, newcol, oldcol)
+ sql = f'UPDATE {table} SET "{newcol}"="{oldcol}"'
grass.write_command(
"db.execute", input="-", database=database, driver=driver, stdin=sql
)
@@ -119,12 +119,12 @@ def main():
else:
newcoltype = oldcoltype
- sql = "ALTER TABLE %s CHANGE %s %s %s" % (table, oldcol, newcol, newcoltype)
+ sql = f'ALTER TABLE {table} CHANGE "{oldcol}" "{newcol}" {newcoltype}'
grass.write_command(
"db.execute", input="-", database=database, driver=driver, stdin=sql
)
else:
- sql = "ALTER TABLE %s RENAME %s TO %s" % (table, oldcol, newcol)
+ sql = f'ALTER TABLE {table} RENAME "{oldcol}" TO "{newcol}"'
grass.write_command(
"db.execute", input="-", database=database, driver=driver, stdin=sql
)
diff --git a/scripts/v.import/v.import.html b/scripts/v.import/v.import.html
index 072b92e5529..a530f5f3662 100644
--- a/scripts/v.import/v.import.html
+++ b/scripts/v.import/v.import.html
@@ -64,46 +64,6 @@ EXAMPLE
v.import input=research_area.shp output=research_area extent=input
-ERROR MESSAGES
-
-SQL syntax errors
-
-Depending on the currently selected SQL driver, error messages such as follows may arise:
-
-
-DBMI-SQLite driver error:
-Error in sqlite3_prepare():
-near "ORDER": syntax error
-
-
-Or:
-
-
-DBMI-DBF driver error:
-SQL parser error:
-syntax error, unexpected DESC, expecting NAME processing 'DESC
-
-
-This indicates that a column name in the input dataset corresponds to a reserved
-SQL word (here: 'ORDER' and 'DESC' respectively). A different column name has to be
-used in this case. The columns parameter can be used to assign different
-column names on the fly in order to avoid using reserved SQL words.
-
-For a list of SQL reserved words for SQLite (the default driver),
-see here.
-
-Projection errors
-
-
-Projection of dataset does not appear to match the current project.
-
-
-Here you need to create or use a project whose CRS matches that
-of the vector data you wish to import. Try using location parameter to
-create a new project based upon the CRS information in the file. If
-desired, you can then re-project it to another project
-with v.proj.
-
SEE ALSO
diff --git a/scripts/v.rast.stats/testsuite/test_v_rast_stats.py b/scripts/v.rast.stats/testsuite/test_v_rast_stats.py
index 4b411bf6666..ca3111d14d8 100644
--- a/scripts/v.rast.stats/testsuite/test_v_rast_stats.py
+++ b/scripts/v.rast.stats/testsuite/test_v_rast_stats.py
@@ -2,6 +2,7 @@
@author Soeren Gebbert
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.gmodules import SimpleModule
from grass.pygrass.vector import VectorTopo
diff --git a/scripts/v.unpack/v.unpack.py b/scripts/v.unpack/v.unpack.py
index 6fed249ccf7..bd350676444 100644
--- a/scripts/v.unpack/v.unpack.py
+++ b/scripts/v.unpack/v.unpack.py
@@ -32,8 +32,8 @@
# %end
# %flag
# % key: o
-# % label: Override projection check (use current location's projection)
-# % description: Assume that the dataset has same projection as the current location
+# % label: Override projection check (use current projects's CRS)
+# % description: Assume that the dataset has same coordinate reference system as the current project
# % guisection: Output settings
# %end
# %flag
@@ -155,7 +155,7 @@ def main():
grass.fatal(
_(
"PROJ_INFO file is missing, unpack vector map in XY (unprojected) "
- "location."
+ "project."
)
)
skip_projection_check = True # XY location
@@ -186,22 +186,23 @@ def main():
grass.warning(
_(
"Difference between PROJ_INFO file of packed map "
- "and of current location:\n{diff}"
+ "and of current project:\n{diff}"
).format(diff="".join(diff_result_1))
)
if diff_result_2:
grass.warning(
_(
"Difference between PROJ_UNITS file of packed map "
- "and of current location:\n{diff}"
+ "and of current project:\n{diff}"
).format(diff="".join(diff_result_2))
)
grass.fatal(
_(
- "Projection of dataset does not appear to match current "
- "location. In case of no significant differences in the "
- "projection definitions, use the -o flag to ignore them and "
- "use current location definition."
+ "Coordinate reference system of dataset does not"
+ " appear to match current project."
+ " In case of no significant differences in the CRS definitions,"
+ " use the -o flag to ignore them and use"
+ " current project definition."
)
)
diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py
index 2056a654f7c..c5eb4618d92 100644
--- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py
+++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py
index f70c150c7c0..ac6471398ad 100644
--- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py
+++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py
index 265d4f82465..fe53844feea 100644
--- a/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py
+++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.rast.series/testsuite/test_series.py b/temporal/t.rast.series/testsuite/test_series.py
index 4eb41f80f1a..7b9df7921b7 100644
--- a/temporal/t.rast.series/testsuite/test_series.py
+++ b/temporal/t.rast.series/testsuite/test_series.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py b/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py
index 59d47a1dacd..980ec553119 100644
--- a/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py
+++ b/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py
@@ -7,7 +7,6 @@
:authors: Soeren Gebbert and Thomas Leppelt
"""
-
import grass.script
import grass.temporal as tgis
from grass.gunittest.case import TestCase
diff --git a/temporal/t.shift/testsuite/test_shift.py b/temporal/t.shift/testsuite/test_shift.py
index 1c1f29f03d9..eff9a5f5702 100644
--- a/temporal/t.shift/testsuite/test_shift.py
+++ b/temporal/t.shift/testsuite/test_shift.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.snap/testsuite/test_snap.py b/temporal/t.snap/testsuite/test_snap.py
index e16acc52a57..5d8c0bbe166 100644
--- a/temporal/t.snap/testsuite/test_snap.py
+++ b/temporal/t.snap/testsuite/test_snap.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.support/testsuite/test_support_str3ds.py b/temporal/t.support/testsuite/test_support_str3ds.py
index 4e2a1d30123..613b5e9bbc3 100644
--- a/temporal/t.support/testsuite/test_support_str3ds.py
+++ b/temporal/t.support/testsuite/test_support_str3ds.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.support/testsuite/test_support_strds.py b/temporal/t.support/testsuite/test_support_strds.py
index a618f94bc5b..40692693c34 100644
--- a/temporal/t.support/testsuite/test_support_strds.py
+++ b/temporal/t.support/testsuite/test_support_strds.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.support/testsuite/test_support_stvds.py b/temporal/t.support/testsuite/test_support_stvds.py
index 256e3a9b98f..2cd973c2119 100644
--- a/temporal/t.support/testsuite/test_support_stvds.py
+++ b/temporal/t.support/testsuite/test_support_stvds.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/temporal/t.unregister/testsuite/test_unregister.py b/temporal/t.unregister/testsuite/test_unregister.py
index 6cf54e482e2..fa011b9edaa 100644
--- a/temporal/t.unregister/testsuite/test_unregister.py
+++ b/temporal/t.unregister/testsuite/test_unregister.py
@@ -7,6 +7,7 @@
:authors: Soeren Gebbert
"""
+
import os
import grass.pygrass.modules as pymod
import grass.temporal as tgis
diff --git a/vector/v.external/args.c b/vector/v.external/args.c
index 798982f2c15..7f482f836e6 100644
--- a/vector/v.external/args.c
+++ b/vector/v.external/args.c
@@ -46,9 +46,10 @@ void parse_args(int argc, char **argv, struct _options *options,
flags->override = G_define_flag();
flags->override->key = 'o';
flags->override->label =
- _("Override projection check (use current location's projection)");
- flags->override->description = _("Assume that the dataset has the same "
- "projection as the current location");
+ _("Override projection check (use current project's CRS)");
+ flags->override->description =
+ _("Assume that the dataset has the same "
+ "coordinate reference system as the current project");
flags->proj = G_define_flag();
flags->proj->key = 'j';
diff --git a/vector/v.external/proj.c b/vector/v.external/proj.c
index b1eae407c35..625482fee5e 100644
--- a/vector/v.external/proj.c
+++ b/vector/v.external/proj.c
@@ -163,15 +163,15 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer,
/* do not create a xy location because this can mean that the
* real SRS has not been recognized or is missing */
if (proj_trouble) {
- G_fatal_error(_("Unable to convert input map projection to GRASS "
- "format; cannot create new location."));
+ G_fatal_error(_("Unable to convert input map CRS to GRASS "
+ "format; cannot create new project."));
}
else {
if (0 != G_make_location_crs(outloc, cellhd, proj_info, proj_units,
srid, wkt)) {
- G_fatal_error(_("Unable to create new location <%s>"), outloc);
+ G_fatal_error(_("Unable to create new project <%s>"), outloc);
}
- G_message(_("Location <%s> created"), outloc);
+ G_message(_("Project <%s> created"), outloc);
G_unset_window(); /* new location, projection, and window */
G_get_window(cellhd);
@@ -232,14 +232,15 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer,
proj_info, proj_units)) != 1) {
int i_value;
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg,
+ _("Coordinate reference system of dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd->proj || err != -2) {
/* error in proj_info */
if (loc_proj_info != NULL) {
- strcat(error_msg, _("Location PROJ_INFO is:\n"));
+ strcat(error_msg, _("Project PROJ_INFO is:\n"));
for (i_value = 0; i_value < loc_proj_info->nitems;
i_value++)
sprintf(error_msg + strlen(error_msg), "%s: %s\n",
@@ -248,22 +249,22 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer,
strcat(error_msg, "\n");
}
else {
- strcat(error_msg, _("Location PROJ_INFO is:\n"));
+ strcat(error_msg, _("Project PROJ_INFO is:\n"));
if (loc_wind.proj == PROJECTION_XY)
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (unreferenced/unknown)\n",
+ "Project proj = %d (unreferenced/unknown)\n",
loc_wind.proj);
else if (loc_wind.proj == PROJECTION_LL)
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (lat/long)\n",
+ "Project proj = %d (lat/long)\n",
loc_wind.proj);
else if (loc_wind.proj == PROJECTION_UTM)
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (UTM), zone = %d\n",
+ "Project proj = %d (UTM), zone = %d\n",
loc_wind.proj, cellhd->zone);
else
sprintf(error_msg + strlen(error_msg),
- "Location proj = %d (unknown), zone = %d\n",
+ "Project proj = %d (unknown), zone = %d\n",
loc_wind.proj, cellhd->zone);
}
@@ -337,7 +338,7 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer,
else {
/* error in proj_units */
if (loc_proj_units != NULL) {
- strcat(error_msg, "Location PROJ_UNITS is:\n");
+ strcat(error_msg, "Project PROJ_UNITS is:\n");
for (i_value = 0; i_value < loc_proj_units->nitems;
i_value++)
sprintf(error_msg + strlen(error_msg), "%s: %s\n",
@@ -355,13 +356,14 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer,
}
}
if (!check_only) {
- strcat(error_msg, _("\nIn case of no significant differences "
- "in the projection definitions,"
- " use the -o flag to ignore them and use"
- " current location definition.\n"));
- strcat(error_msg, _("Consider generating a new location from "
+ strcat(error_msg,
+ _("\nIn case of no significant differences "
+ "in the coordinate reference system definitions,"
+ " use the -o flag to ignore them and use"
+ " current project definition.\n"));
+ strcat(error_msg, _("Consider generating a new project from "
"the input dataset using "
- "the 'location' parameter.\n"));
+ "the 'project' parameter.\n"));
}
if (check_only)
@@ -379,8 +381,8 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer,
msg_fn = G_message;
else
msg_fn = G_verbose_message;
- msg_fn(_("Projection of input dataset and current location "
- "appear to match"));
+ msg_fn(_("Coordinate reference system of input dataset and current "
+ "project appear to match"));
if (check_only) {
GDALClose(hDS);
exit(EXIT_SUCCESS);
diff --git a/vector/v.extract/testsuite/test_v_extract.py b/vector/v.extract/testsuite/test_v_extract.py
index ff0c8b590a3..d266e8ad649 100644
--- a/vector/v.extract/testsuite/test_v_extract.py
+++ b/vector/v.extract/testsuite/test_v_extract.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
import os
from grass.gunittest.case import TestCase
from grass.gunittest.gmodules import SimpleModule
diff --git a/vector/v.fill.holes/examples.ipynb b/vector/v.fill.holes/examples.ipynb
index 28d86332b0a..fcc006501e4 100644
--- a/vector/v.fill.holes/examples.ipynb
+++ b/vector/v.fill.holes/examples.ipynb
@@ -82,7 +82,7 @@
"outputs": [],
"source": [
"!g.region vector=data grow=3 res=1\n",
- "text_position = (75,5)"
+ "text_position = (75, 5)"
]
},
{
@@ -144,7 +144,7 @@
"source": [
"!g.region vector=dissolve_data grow=2 res=1\n",
"\n",
- "text_position = (75,5)\n",
+ "text_position = (75, 5)\n",
"\n",
"plot = gj.Map(use_region=True, width=700)\n",
"plot.d_background(color=\"white\")\n",
@@ -209,7 +209,7 @@
"plot = gj.Map(use_region=True, width=700)\n",
"plot.d_background(color=\"white\")\n",
"plot.d_vect(map=\"lakes_only\", legend_label=\"Original\")\n",
- "plot.d_legend_vect(flags=\"b\", at=(60,10))\n",
+ "plot.d_legend_vect(flags=\"b\", at=(60, 10))\n",
"plot.show()"
]
},
@@ -231,7 +231,7 @@
"plot = gj.Map(use_region=True, width=700)\n",
"plot.d_background(color=\"white\")\n",
"plot.d_vect(map=\"lakes_filled\", legend_label=\"Filled\")\n",
- "plot.d_legend_vect(flags=\"b\", at=(60,10))\n",
+ "plot.d_legend_vect(flags=\"b\", at=(60, 10))\n",
"plot.show()"
]
},
@@ -253,7 +253,7 @@
"plot = gj.Map(use_region=True, width=700)\n",
"plot.d_background(color=\"white\")\n",
"plot.d_vect(map=\"lakes_dissolved\", legend_label=\"Dissolved\")\n",
- "plot.d_legend_vect(flags=\"b\", at=(60,10))\n",
+ "plot.d_legend_vect(flags=\"b\", at=(60, 10))\n",
"plot.show()"
]
},
@@ -265,9 +265,17 @@
"source": [
"plot = gj.Map(use_region=True, width=1024)\n",
"plot.d_background(color=\"#E28A2B\")\n",
- "plot.d_vect(map=\"lakes_filled\", color=\"none\", fill_color=\"#384C6B\", legend_label=\"Filled\")\n",
- "plot.d_vect(map=\"lakes_only\", color=\"#859BBA\", fill_color=\"none\", width=2, legend_label=\"Original\")\n",
- "plot.d_legend_vect(flags=\"b\", at=(80,85), fontsize=22, symbol_size=35)\n",
+ "plot.d_vect(\n",
+ " map=\"lakes_filled\", color=\"none\", fill_color=\"#384C6B\", legend_label=\"Filled\"\n",
+ ")\n",
+ "plot.d_vect(\n",
+ " map=\"lakes_only\",\n",
+ " color=\"#859BBA\",\n",
+ " fill_color=\"none\",\n",
+ " width=2,\n",
+ " legend_label=\"Original\",\n",
+ ")\n",
+ "plot.d_legend_vect(flags=\"b\", at=(80, 85), fontsize=22, symbol_size=35)\n",
"filename = \"v_fill_holes.png\"\n",
"plot.save(filename)\n",
"!mogrify -trim {filename}\n",
diff --git a/vector/v.in.lidar/main.c b/vector/v.in.lidar/main.c
index 76bc0ef540e..8db7d1e3ee6 100644
--- a/vector/v.in.lidar/main.c
+++ b/vector/v.in.lidar/main.c
@@ -270,10 +270,10 @@ int main(int argc, char *argv[])
limit_opt->guisection = _("Decimation");
outloc_opt = G_define_option();
- outloc_opt->key = "location";
+ outloc_opt->key = "project";
outloc_opt->type = TYPE_STRING;
outloc_opt->required = NO;
- outloc_opt->description = _("Name for new location to create");
+ outloc_opt->description = _("Name for new project (location) to create");
outloc_opt->key_desc = "name";
print_flag = G_define_flag();
@@ -319,15 +319,16 @@ int main(int argc, char *argv[])
over_flag = G_define_flag();
over_flag->key = 'o';
over_flag->label =
- _("Override projection check (use current location's projection)");
- over_flag->description = _(
- "Assume that the dataset has same projection as the current location");
+ _("Override projection check (use current project's CRS)");
+ over_flag->description =
+ _("Assume that the dataset has the same coordinate reference system as "
+ "the current project");
no_import_flag = G_define_flag();
no_import_flag->key = 'i';
- no_import_flag->description = _(
- "Create the location specified by the \"location\" parameter and exit."
- " Do not import the vector data.");
+ no_import_flag->description =
+ _("Create the project specified by the \"project\" parameter and exit."
+ " Do not import the vector data.");
no_import_flag->suppress_required = YES;
G_option_exclusive(skip_opt, preserve_opt, NULL);
@@ -512,16 +513,16 @@ int main(int argc, char *argv[])
* assume the user has a terminal open */
if (GPJ_wkt_to_grass(&cellhd, &proj_info, &proj_units, projstr, 0) <
0) {
- G_fatal_error(_("Unable to convert input map projection to GRASS "
- "format; cannot create new location."));
+ G_fatal_error(_("Unable to convert input map CRS to GRASS "
+ "format; cannot create new project."));
}
else {
if (0 != G_make_location(outloc_opt->answer, &cellhd, proj_info,
proj_units)) {
- G_fatal_error(_("Unable to create new location <%s>"),
+ G_fatal_error(_("Unable to create new project <%s>"),
outloc_opt->answer);
}
- G_message(_("Location <%s> created"), outloc_opt->answer);
+ G_message(_("Project <%s> created"), outloc_opt->answer);
}
/* If the i flag is set, clean up? and exit here */
@@ -529,7 +530,7 @@ int main(int argc, char *argv[])
exit(EXIT_SUCCESS);
/* TODO: */
- G_warning("Import into new location not yet implemented");
+ G_warning("Import into new project not yet implemented");
/* at this point the module should be using G_create_alt_env()
to change context to the newly created location; once done
it should switch back with G_switch_env(). See r.in.gdal */
diff --git a/vector/v.in.lidar/projection.c b/vector/v.in.lidar/projection.c
index 44dc7c680d3..aba51081b91 100644
--- a/vector/v.in.lidar/projection.c
+++ b/vector/v.in.lidar/projection.c
@@ -27,8 +27,8 @@ void projection_mismatch_report(struct Cell_head cellhd,
int i_value;
char error_msg[8192];
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg, _("Coordinate reference system of dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd.proj || err != -2) {
@@ -84,12 +84,12 @@ void projection_mismatch_report(struct Cell_head cellhd,
}
}
sprintf(error_msg + strlen(error_msg),
- _("\nIn case of no significant differences in the projection "
- "definitions,"
+ _("\nIn case of no significant differences"
+ " in the coordinate reference system definitions,"
" use the -o flag to ignore them and use"
- " current location definition.\n"));
+ " current project definition.\n"));
strcat(error_msg,
- _("Consider generating a new location with 'location' parameter"
+ _("Consider generating a new project with 'project' parameter"
" from input data set.\n"));
G_fatal_error("%s", error_msg);
}
@@ -130,7 +130,8 @@ void projection_check_wkt(struct Cell_head cellhd, struct Cell_head loc_wind,
loc_proj_units, proj_info, proj_units, err);
}
else if (verbose) {
- G_message(_("Projection of input dataset and current location "
- "appear to match"));
+ G_message(_(
+ "Coordinate reference system of input dataset and current project "
+ "appear to match"));
}
}
diff --git a/vector/v.in.lidar/v.in.lidar.html b/vector/v.in.lidar/v.in.lidar.html
index 04c76c0e281..72177b9f5ed 100644
--- a/vector/v.in.lidar/v.in.lidar.html
+++ b/vector/v.in.lidar/v.in.lidar.html
@@ -91,7 +91,7 @@ Project Creation
If the user wishes to import the data with the full CRS definition,
it is possible to have v.in.lidar automatically create a new project based
on the CRS and extents of the file being read. This is accomplished
-by passing the name to be used for the new project via the location
+by passing the name to be used for the new project via the project
parameter. Upon completion of the command, a new project will have been
created (with only a PERMANENT mapset), and the vector map will have been
imported with the indicated output name into the PERMANENT mapset.
@@ -116,7 +116,7 @@
EXAMPLE
v.in.lidar -p input="Serpent Mound Model LAS Data.las"
# create a project with CRS information of the LAS data
- v.in.lidar -i input="Serpent Mound Model LAS Data.las" location=Serpent_Mound
+ v.in.lidar -i input="Serpent Mound Model LAS Data.las" project=Serpent_Mound
# quit and restart GRASS in the newly created project "Serpent_Mound"
# real import of LiDAR LAS data, without topology and without attribute table
diff --git a/vector/v.in.ogr/testsuite/test_v_in_ogr.py b/vector/v.in.ogr/testsuite/test_v_in_ogr.py
index 7257c44b0ee..167cd8747e8 100644
--- a/vector/v.in.ogr/testsuite/test_v_in_ogr.py
+++ b/vector/v.in.ogr/testsuite/test_v_in_ogr.py
@@ -2,6 +2,7 @@
@author Markus Neteler
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.gmodules import SimpleModule
diff --git a/vector/v.in.pdal/main.cpp b/vector/v.in.pdal/main.cpp
index 9348463ecc3..0f48e1d5fea 100644
--- a/vector/v.in.pdal/main.cpp
+++ b/vector/v.in.pdal/main.cpp
@@ -212,19 +212,20 @@ int main(int argc, char *argv[])
Flag *reproject_flag = G_define_flag();
reproject_flag->key = 'w';
reproject_flag->label =
- _("Reproject to location's coordinate system if needed");
+ _("Reproject to projects's coordinate system if needed");
reproject_flag->description =
_("Reprojects input dataset to the coordinate system of"
- " the GRASS location (by default only datasets with the"
+ " the GRASS project (by default only datasets with the"
" matching coordinate system can be imported");
reproject_flag->guisection = _("Projection");
Flag *over_flag = G_define_flag();
over_flag->key = 'o';
over_flag->label =
- _("Override projection check (use current location's projection)");
- over_flag->description = _(
- "Assume that the dataset has same projection as the current location");
+ _("Override projection check (use current project's CRS)");
+ over_flag->description =
+ _("Assume that the dataset has the same coordinate reference system as "
+ "the current project");
over_flag->guisection = _("Projection");
// TODO: from the API it seems that also prj file path and proj string will
@@ -347,7 +348,7 @@ int main(int argc, char *argv[])
// we reproject when requested regardless the input projection
if (reproject_flag->answer) {
- G_message(_("Reprojecting the input to the location projection"));
+ G_message(_("Reprojecting the input to the project's CRS"));
char *proj_wkt = location_projection_as_wkt(false);
pdal::Options o4;
// TODO: try catch for user input error
@@ -370,8 +371,8 @@ int main(int argc, char *argv[])
// getting projection is possible only after prepare
if (over_flag->answer) {
G_important_message(_("Overriding projection check and assuming"
- " that the projection of input matches"
- " the location projection"));
+ " that the CRS of input matches"
+ " the project's CRS"));
}
else if (!reproject_flag->answer) {
pdal::SpatialReference spatial_reference =
diff --git a/vector/v.in.pdal/projection.c b/vector/v.in.pdal/projection.c
index 244ee323afb..aa811a0a409 100644
--- a/vector/v.in.pdal/projection.c
+++ b/vector/v.in.pdal/projection.c
@@ -27,8 +27,8 @@ void projection_mismatch_report(struct Cell_head cellhd,
int i_value;
char error_msg[8192];
- strcpy(error_msg, _("Projection of dataset does not"
- " appear to match current location.\n\n"));
+ strcpy(error_msg, _("Coordinate reference system of the dataset does not"
+ " appear to match current project.\n\n"));
/* TODO: output this info sorted by key: */
if (loc_wind.proj != cellhd.proj || err != -2) {
@@ -84,12 +84,12 @@ void projection_mismatch_report(struct Cell_head cellhd,
}
}
sprintf(error_msg + strlen(error_msg),
- _("\nIn case of no significant differences in the projection "
- "definitions,"
+ _("\nIn case of no significant differences"
+ " in the coordinate reference system definitions,"
" use the -o flag to ignore them and use"
- " current location definition.\n"));
+ " current project definition.\n"));
strcat(error_msg,
- _("Consider generating a new location with 'location' parameter"
+ _("Consider generating a new project with 'project' parameter"
" from input data set.\n"));
G_fatal_error("%s", error_msg);
}
@@ -131,8 +131,8 @@ void projection_check_wkt(struct Cell_head cellhd, struct Cell_head loc_wind,
}
else {
if (verbose) {
- G_message(_("Projection of input dataset and current location "
- "appear to match"));
+ G_message(_("Coordinate reference system of the input dataset and "
+ "current project appear to match"));
}
}
}
diff --git a/vector/v.to.rast/testsuite/test_v_to_rast.py b/vector/v.to.rast/testsuite/test_v_to_rast.py
index 273c77983d8..352b8c578f3 100644
--- a/vector/v.to.rast/testsuite/test_v_to_rast.py
+++ b/vector/v.to.rast/testsuite/test_v_to_rast.py
@@ -11,6 +11,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
diff --git a/vector/v.univar/testsuite/v_univar_test.py b/vector/v.univar/testsuite/v_univar_test.py
index 3b9c75b7d70..33fd0425c1d 100644
--- a/vector/v.univar/testsuite/v_univar_test.py
+++ b/vector/v.univar/testsuite/v_univar_test.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
diff --git a/vector/v.vect.stats/testsuite/test_vect_stats.py b/vector/v.vect.stats/testsuite/test_vect_stats.py
index 8d7cf0e6c18..fe982ceff33 100644
--- a/vector/v.vect.stats/testsuite/test_vect_stats.py
+++ b/vector/v.vect.stats/testsuite/test_vect_stats.py
@@ -8,6 +8,7 @@
License (>=v2). Read the file COPYING that comes with GRASS
for details.
"""
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule