[GRASS-dev] [GRASS GIS] #3338: UnicodeDecodeError when registering maps in a STRDS using a translated version of GRASS
GRASS GIS
trac at osgeo.org
Wed Apr 26 13:27:49 PDT 2017
#3338: UnicodeDecodeError when registering maps in a STRDS using a translated
version of GRASS
-----------------------+--------------------------------------------
Reporter: lrntct | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.2.2
Component: Temporal | Version: 7.2.0
Resolution: | Keywords: translation UnicodeDecodeError
CPU: x86-64 | Platform: Linux
-----------------------+--------------------------------------------
Comment (by lrntct):
Below is a minimum working example. Try to run it with a Spanish locale,
it will fail. In English, it will run OK.
{{{
import grass.temporal as tgis
import grass.script as gscript
import grass.pygrass.utils as gutils
def create_map_list():
"""Create a list with random raster maps"""
map_list = []
for i in range(5):
map_name = 'map_test{}'.format(i)
map_id = '{}@{}'.format(map_name, gutils.getenv('MAPSET'))
# create random raster map
gscript.run_command('r.random.surface', output=map_name,
overwrite=OVR)
# populate list
map_list.append((map_id, i))
return map_list
def register_maps_in_stds(stds_id, map_list):
"""Create a STDS, create one RasterDataset for each map and
register them in the temporal database
"""
# create stds
stds = tgis.open_new_stds(stds_id, 'strds', 'relative',
"test", "", "mean", overwrite=OVR)
# populate MapDataset objects list
map_dts_lst = []
for map_id, map_time in map_list:
# create MapDataset
map_dts = tgis.RasterDataset(map_id)
# load spatial data from map
map_dts.load()
# set time
map_dts.set_relative_time(map_time, None, 'seconds')
# populate the list
map_dts_lst.append(map_dts)
# Register the maps
tgis.register.register_map_object_list('raster', map_dts_lst, stds,
delete_empty=True,
unit='seconds')
tgis.init()
register_maps_in_stds('strds_test', create_map_list())
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3338#comment:1>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list