-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Message from user Arky (@cleemansen)
Guess this issue has already been reported. Using add_speed() with MoveApps Python SDK results in crs_units error.
Any workaround would be highly appreciated.
app.py
from sdk.moveapps_spec import hook_impl
from movingpandas import TrajectoryCollection
import movingpandas as mpd
import logging
class App(object):
def __init__(self, moveapps_io):
self.moveapps_io = moveapps_io
logging.info(mpd.show_versions())
@hook_impl
def execute(self, data: TrajectoryCollection, config: dict) -> TrajectoryCollection:
""" Testcase """
data.add_speed()
logging.info(f'Welcome to the {config}')
# return some useful data for next apps in the workflow
return data
####################
Console Output
$ python sdk.py
MovingPandas 0.16.0
SYSTEM INFO
python : 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
executable : /usr/bin/python
machine : Linux-5.19.0-43-generic-x86_64-with-glibc2.35
GEOS, GDAL, PROJ INFO
GEOS : None
GEOS lib : None
GDAL : 3.6.4
GDAL data dir: /usr/local/lib/python3.10/dist-packages/fiona/gdal_data
PROJ : 9.2.0
PROJ data dir:
/usr/local/lib/python3.10/dist-packages/pyproj/proj_dir/share/proj
PYTHON DEPENDENCIES
geopandas : 0.13.0
pandas : 1.5.2
fiona : 1.9.4.post1
numpy : 1.24.3
shapely : 2.0.1
rtree : 1.0.1
pyproj : 3.5.0
matplotlib : 3.7.1
mapclassify: None
geopy : 2.3.0
holoviews : 1.16.0
hvplot : 0.8.3
geoviews : 1.10.0
stonesoup : None
Traceback (most recent call last):
File "/home/arky/Code/Python/MoveApps/myrepo/sdk.py", line 30, in
<module>
sdk = MoveAppsSdk(active_hooks=hooks)
File "/home/arky/Code/Python/MoveApps/myrepo/sdk.py", line 23, in
__init__
executor.execute()
File
"/home/arky/Code/Python/MoveApps/myrepo/sdk/moveapps_execution.py", line
33, in execute
raise exception
File
"/home/arky/Code/Python/MoveApps/myrepo/sdk/moveapps_execution.py", line
29, in execute
output = self.__call_app(data)
File
"/home/arky/Code/Python/MoveApps/myrepo/sdk/moveapps_execution.py", line
76, in __call_app
outputs = self._pm.hook.execute(data=data,
config=self.env.app_configuration)
File "/usr/lib/python3/dist-packages/pluggy/hooks.py", line 286, in
__call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 92, in
_hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/lib/python3/dist-packages/pluggy/manager.py", line 83, in
<lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 208, in
_multicall
return outcome.get_result()
File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 80, in
get_result
raise ex[1].with_traceback(ex[2])
File "/usr/lib/python3/dist-packages/pluggy/callers.py", line 187, in
_multicall
res = hook_impl.function(*args)
File "/home/arky/Code/Python/MoveApps/myrepo/app/app.py", line 16, in
execute
data.add_speed()
File
"/usr/local/lib/python3.10/dist-packages/movingpandas/trajectory_collection.py",
line 391, in add_speed
traj.add_speed(overwrite)
File
"/usr/local/lib/python3.10/dist-packages/movingpandas/trajectory.py",
line 1232, in add_speed
conversion = get_conversion(units, self.crs_units)
AttributeError: 'Trajectory' object has no attribute 'crs_units'