mie-lab / trackintel

trackintel is a framework for spatio-temporal analysis of movement trajectory and mobility data.
MIT License
206 stars 50 forks source link

Remove `_check` from trackintel classes #534

Closed bifbof closed 1 year ago

bifbof commented 1 year ago

Currently we use _check to test if the class invariants still hold and if not fallback to GeoDataFrame/DataFrame. This is nice one hand as we always know that the data will be correct (up to a certain point → e.g. we don't check for geometry in the _constructor) The negative is that for TripsGeoDataFrame a line of code can have 4 different output types and you have to keep in mind what is what, such that you don't call generate_tours on a GeoDataframe. This is can be a significant cognitive load. In total we would have three different class types (Positionfixes, TripsGeoDataFrames, Tours) that have three different patterns how they fallback and to what. This is quite hard to explain. If we would remove _check then we would only have to explain that TripsGeoDataFrame fallback to TripsDataFrame and the rest would be equivalent to GeoPandas. Additionally we could call the validate in each method to assure the data is in the right shape.