Closed anitagraser closed 1 year ago
Yes!!! I hadn't so far because of the dependency on hvplot
, which has a large footprint (hence #78
) but now it seems to be decoupled, absolutely. I'll add it to the wishlist (#80 ). How should I install it? movingpandas
will do or is there any further spec for only installing the base?
Great. Yes, adding the movingpandas package should be sufficient to give you the base functionality without interactive plotting
I'm trying this but I must be missing something. I add it on my environment.yml
file and appears to build OK, but when I try to import it inside the resulting container, I get the following:
In [1]: import movingpandas
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import movingpandas
File /opt/conda/envs/gds/lib/python3.9/site-packages/movingpandas/__init__.py:16
7 from .trajectory_generalizer import ( # noqa F401
8 TrajectoryGeneralizer,
9 MaxDistanceGeneralizer,
(...)
13 TopDownTimeRatioGeneralizer,
14 )
15 from .trajectory_collection import TrajectoryCollection # noqa F401
---> 16 from .io import read_mf_json # noqa F401
17 from .trajectory_aggregator import TrajectoryCollectionAggregator # noqa F401
18 from .trajectory_splitter import ( # noqa F401
19 TrajectorySplitter,
20 TemporalSplitter,
(...)
23 StopSplitter,
24 )
File /opt/conda/envs/gds/lib/python3.9/site-packages/movingpandas/io.py:19
5 from pandas import DataFrame
7 from movingpandas import Trajectory, TrajectoryCollection
10 def gdf_to_mf_json(
11 gdf: GeoDataFrame,
12 traj_id_column: str,
13 datetime_column: str,
14 temporal_columns: list = None,
15 temporal_columns_static_fields: Dict[str, Dict] = None,
16 interpolation: str = None,
17 crs=None,
18 trs=None,
---> 19 datetime_encoder: Callable[[any], str | int] = None,
20 ) -> dict:
21 """
22 Converts a GeoDataFrame to a dictionary compatible with the Moving Features JSON
23 (MF-JSON) specification.
(...)
44 dict: The MF-JSON representation of the GeoDataFrame as a dictionary.
45 """
47 _raise_error_if_invalid_arguments(gdf, datetime_column, traj_id_column)
TypeError: unsupported operand type(s) for |: 'type' and 'type'
In [2]:
This has installed movingpandas
version 0.17.0 and the full conda list
is available below:
Any idea why I'm hitting this?
Looks like | was added in python 3.10, so not available in earlier python versions (https://github.com/tiangolo/typer/issues/371)
That particular io module is new, so we haven't had much feedback yet but we should probably better catch that error and not limit ourselves to 3.10.
Unfortunately, a reasonable part of the stack (still) relies on <3.0:
And it'd be pretty disruptive to drop all those dependencies. Do you see any way we could make this work?
support for 3.9 should be easy enough. I'll look into it tomorrow
Fantastic! I'll be working on this probably for the next week if not two, so there's some flexibility. It'd be very cool to add movingpandas
to 10.0 (!) :-)
Great. Please give 0.17.1 a try: https://anaconda.org/conda-forge/movingpandas
This does seem to work! the package imports without any errors :-) Do you have any notebook with a demo that doesn’t rely on interactive plotting (or a test suite) I can run to confirm it works as expected?
]d[
On Sat, 26 Aug 2023 at 09:36, Anita Graser @.***> wrote:
Great. Please give 0.17.1 a try: https://anaconda.org/conda-forge/movingpandas
— Reply to this email directly, view it on GitHub https://github.com/darribas/gds_env/issues/81#issuecomment-1694229057, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADF4U5KRVN6GPTCEFZGYOTXXGYRXANCNFSM6AAAAAAYJNJZBI . You are receiving this because you commented.Message ID: @.***>
Sure. This one, for example: https://github.com/movingpandas/movingpandas-examples/blob/main/1-tutorials/3-extracting-mover-positions.ipynb only has an unused hvplot import which you could remove to test the import. Also, the whole unit test suit is created so that it runs without plotting dependencies.
Yep! I confirm the notebook runs OK, movingpandas
is in the mix for 10.0 as of 425c9567354a154568289b8adc3a7c03a5145d9c!
Thank you, Dani! I'm very excited to take this on a test drive :-)
Hi Dani. Would you consider adding MovingPandas to the Python stack?
Comparing https://github.com/darribas/gds_env/blob/master/gds_py/gds_py.yml and https://github.com/movingpandas/movingpandas/blob/main/environment-minimum.yml, I think there shouldn't be any blockers