Opened 5 years ago

Closed 5 years ago

#3682 closed defect (fixed)

t.rast.algebra: Error wrong type of input

Reported by: veroandreo Owned by: grass-dev@…
Priority: major Milestone: 7.8.0
Component: Temporal Version: svn-trunk
Keywords: t.rast.algebra, python3 Cc:
CPU: Unspecified Platform: Unspecified

Description (last modified by neteler)

When running any expression with G7:t.rast.algebra in trunk, I get ERROR: Wrong type of input. Here's how to reproduce:

# NC location:
g.region raster=elevation -p
for map in `seq 1 10` ; do r.mapcalc "prueba_${map} = ${map}" ; done
t.create output=A type=strds temporaltype=absolute title="test" description="test"
t.register input=A maps=`g.list rast pat=prueba* sep=, map=.` start="2000-01-01" increment="1 months" -i

t.rast.algebra expression="test = (A[1] - A[0]) / 2" basename=test suffix=gran
t.rast.algebra expression="test = A * 2" basename=test suffix=gran

Both algebra commands yield the following error:

ERROR: Wrong type of input A
Traceback (most recent call last):
  File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-gnu/scripts/t.rast.algebra", line 132, in <module>
    sys.exit(main())
  File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-gnu/scripts/t.rast.algebra", line 124, in main
    pc = p.parse(expression, basename, grass.script.overwrite())
  File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/temporal_raster_algebra.py", line 112, in parse
    self.parser.parse(expression)
  File "/usr/lib/python2.7/site-packages/ply/yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/usr/lib/python2.7/site-packages/ply/yacc.py", line 1118, in parseopt_notrack
    p.callable(pslice)
  File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/temporal_raster_algebra.py", line 137, in p_ts_neighbour_operation
    maplist = self.check_stds(t[1])
  File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/temporal_algebra.py", line 1226, in check_stds
    self.msgr.fatal(_("Wrong type of input " + str(input)))
  File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/messages/__init__.py", line 269, in fatal
    raise FatalError(message)
grass.exceptions.FatalError: Wrong type of input A

Is this related to the python3 encoding issues? It works fine in 76 relbranch.

Change History (7)

comment:1 by neteler, 5 years ago

Keywords: python3 added

comment:2 by veroandreo, 5 years ago

Priority: normalmajor

Increasing to major since the error makes it impossible to use G7:t.rast.algebra in trunk

comment:3 by neteler, 5 years ago

Description: modified (diff)

comment:4 by neteler, 5 years ago

I tried to test with Python3 (to see if that works at least) but got stuck due to #3704

comment:5 by neteler, 5 years ago

I tested this again in a virtualenv-3 (see here) and got stuck with

ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_char instance, got bytes

.. an encoding issue?

Full test:

GRASS 7.7.svn (nc_spm_08_grass7):~ > t.create output=A type=strds temporaltype=absolute title="test" description="test"
Process Process-2:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib64/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/c_libraries_interface.py", line 959, in c_library_server
    functions[data[0]](lock, conn, data)
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/c_libraries_interface.py", line 241, in _get_driver_name
    drstring = libtgis.tgis_get_mapset_driver_name(mapset)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_char instance, got bytes
WARNING:root:Needed to restart the libgis server, caller: Server check thread
Traceback (most recent call last):
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/rpc/base.py", line 161, in safe_receive
    ret = self.client_conn.recv()
  File "/usr/lib64/python3.7/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
  File "/usr/lib64/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes
    buf = self._recv(4)
  File "/usr/lib64/python3.7/multiprocessing/connection.py", line 383, in _recv
    raise EOFError
EOFError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/scripts/t.create", line 92, in <module>
    main()
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/scripts/t.create", line 85, in main
    tgis.init()
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/core.py", line 571, in init
    driver_string = ciface.get_driver_name()
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/c_libraries_interface.py", line 1487, in get_driver_name
    return self.safe_receive("get_driver_name")
  File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/etc/python/grass/pygrass/rpc/base.py", line 168, in safe_receive
    raise FatalError("Exception raised: " + str(e) + " Message: " + message)
grass.exceptions.FatalError: Exception raised:  Message: get_driver_name
WARNING:root:Needed to restart the libgis server, caller: Server check thread

comment:6 by veroandreo, 5 years ago

Temporal algebra seems to be working again after r73903

comment:7 by veroandreo, 5 years ago

Resolution: fixed
Status: newclosed

Closing since functionality has been restored after r73903.

Note: See TracTickets for help on using tickets.