linref


Namelinref JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryLinearly referenced data management, manipulation, and operations
upload_time2024-08-20 21:21:48
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License =========== *Copyright (c) 2024 Tariq Shihadah* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords python geospatial linear data event dissolve overlay range numeric interval
VCS
bugtrack_url
requirements numpy matplotlib shapely pandas geopandas rangel scipy build twine ipython
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Overview
========
The ``linref`` library builds on tabular and geospatial libraries ``pandas`` and ``geopandas`` to implement powerful features for linearly referenced data through ``EventsCollection`` and other object classes. Linear referencing operations powered by the ``numpy``, ``shapely``, and ``rangel`` open-source libraries allow for optimized implementations of common and advanced linearly referenced data management, manipulation, and analysis operations.

Some of the main features of this library include:

* Event dissolves using ``EventsCollection.dissolve()``
* Merging and overlaying multiple tables of events with the ``EventsCollection.merge()`` method and the ``EventsMerge`` class API and its many linearly-weighted overlay aggregators
* Linear aggregations of data such as sliding window analysis with the powerful ``EventsMerge.distribute()`` method
* Resegmentation of linear data with ``EventsCollection.to_windows()`` and related methods
* Creating unions of multiple ``EventsCollection`` instances with the ``EventsUnion`` object class.

Code Snippets
=============
Create an events collection for a sample roadway events dataframe with unique  
route identifier represented by the 'Route' column and data for multiple years, 
represented by the 'Year' column. The begin and end mile points are defined by 
the 'Begin' and 'End' columns::

    ec = EventsCollection(df, keys=['Route','Year'], beg='Begin', end='End')

To select events from a specific route and a specific year, indexing for all 
keys can be used, producing an EventsGroup::

    eg = ec['Route 50', 2018]

To select events on all routes but only those from a specific year, indexing 
for only some keys can be used::

    ec_2018 = ec[:, 2018]

To get all events which intersect with a numeric range, the intersecting() 
method can be used on an EventsGroup instance::

    df_intersecting = eg.intersecting(0.5, 1.5, closed='left_mod')

The intersecting() method can also be used for point locations by ommitting the 
second location attribute::

    df_intersecting = eg.intersecting(0.75, closed='both')

The linearly weighted average of one or more attributes can be obtained using 
the overlay_average() method::

    df_overlay = eg.overlay_average(0.5, 1.5, cols=['Speed_Limit','Volume'])

If the events include information on the roadway speed limit and number of 
lanes, they can be dissolved on these attributes. During the dissolve, other 
attributes can be aggregated, providing a list of associated values or 
performing an aggregation function over these values::

    ec_dissolved = ec.dissolve(attr=['Speed_Limit','Lanes'], aggs=['County'])

Version Notes
=============
0.1.1 (2024-08-20)
-------------------
* Addition of array-like, dataframe label-based, and callable ``length`` parameter options to the ``EventsCollection.to_windows()`` method and ``distance`` parameter to the ``EventsCollection.shift()`` method. This allows for the creation of segments based on a variable length. This will be made available to other methods in future versions as well.
* Address ``numpy>=2.x`` compatibility issue in ``EventsCollection.dissolve()`` method which was causing errors in some cases. More fixes related to ``numpy`` updates are expected to come in future versions.
* Address datatype loss issues for LRS columns during ``EventsCollection.to_windows()`` and ``EventsUnion.union()`` methods. This was causing some instances of key columns to be converted to incorrect dtypes.
* Restructure .targets property to be ``keys + [beg, end]`` for more intuitive and consistent performance.
* Addition of ``min`` and ``max`` aggregation methods to the ``EventsMergeAttribute`` class.
* Several example Jupyter Notebooks for common use cases have been added to the ``examples`` folder for user reference. More to come.
* Performance improvements
* Various bug fixes, minor features

0.1.0 (2024-01-16)
-------------------
My heart is in Gaza.

* Initial deployment of synthesis module featuring some tools for generating linear referencing information for chains of linear asset data with geometry but no LRS. These features are currently experimental and outputs should be reviewed for quality and expected outcomes. They will get refined in future versions based on performance in various applications and input from users.
* Addition of ``retain`` parameter to the ``EventsCollection.to_windows()`` method which retains all non-target and non-spatial fields from the original events dataframe when performing the operation. Previously, only newly generated target fields would be present in the output ``EventsCollection``'s events dataframe.
* Fixed implementation of ``EventsCollection.spatials`` property to correctly return a list of spatial column labels (e.g., geometry and route column labels) in the events dataframe. This also corrects ``EventsCollection.others`` which previously incorrectly included these labels.
* Addition of ``EventsCollection.clip()`` method and expansion of the ``EventsCollection.shift()`` method for better parameterization.
* Transition to ``pyproject.toml`` setup with ``setuptools``.
* Performance improvements
* Various bug fixes, minor features
* Why not push to v0.1 finally?

0.0.10 (2023-05-03)
-------------------
Not a lot of updates to share, I guess that's a good thing?

* Minor updates to MLSRoute class to account for deprecation of subscripting MultiLineStrings. Most issues were addressed previously but a few were missed, most notably in the MLSRoute.bearing() method and a couple odd cases in the MLSRoute.cut() method.
* Fix minor issue with EventsCollection.project_parallel() implementation related to unmatched sampling points.
* Addition of EventsFrame.cast_gdf() method to cast events dataframes to geopandas geodataframes in-line.
* Performance improvements
* Various bug fixes, minor features

0.0.9 (2023-03-02)
------------------
First update of 2023. Been a quiet start to the year.

* Add missing .any() aggregation method to EventsMergeAttribute API. Was previously available but missed during a previous update.
* Update documentation
* Performance improvements
* Various bug fixes, minor features

0.0.8.post2 (2022-12-23)
------------------------
Final update of 2022 including small feature updates and bug fixes from 0.0.8. Happy Holidays!

* Add .set_df() method for in-line modification of an EventsFrame's dataframe, inplace or not.
* Addition of suffixes parameter and default setting to EventsUnion.union() method.
* Performance improvements
* Various bug fixes, minor features

0.0.8.post1 (2022-12-16)
------------------------
* Improve performance of .project() method when nearest=False by removing dependence on join_nearby() function and using native gpd features.
* Add .size and .shape properties to EventsFrames and subclasses.
* Various bug fixes, minor features

0.0.8 (2022-12-14)
------------------
* Improve performance of essential .get_group() method, reducing superfluous initialization of empty dataframes and events collections and improving logging of initialized groups.
* Improve performance of .union() method with updated RangeCollection.union() features and optimized iteration and aggregation of unified data. Performance times are significantly improved, especially for large datasets with many events groups.
* Improve distribute method performance which was added in recent versions.
* Drop duplicates in .project() method when using sjoin_nearest with newer versions of geopandas. Improved validation in .project() method, address edge case where projecting geometry column has a non-standard label (e.g., not 'geometry').
* Added .sort() method to events collection. Default sorting methods remain unchanged.
* Added warnings for missing data in target columns when initializing an EventsFrames through standard methods.
* Remove .project_old() method from events collection due to deprecation.
* Performance improvements
* Various bug fixes, minor features

0.0.7 (2022-10-14)
------------------
* Refactoring of EventsMerge system from 2D to 3D vectorized relationships for improved performance and accuracy. API and aggregation methods are largely the same.
* Modified closed parameter use in merge relationships in accordance with rangel v0.0.6, which now performs intersections which honor the closed parameter on the left collection as well as the right collection. This provides more accurate results for events which fall on the edges of intersecting events when using left_mod or right_mod closed parameters.
* Updates to account for rangel 0.0.6 version which is now a minimum version requirement. Added other minimum version requirements for related packages.
* Performance improvements
* Various bug fixes, minor features

0.0.5.post1 (2022-09-06)
------------------------
* Address deprecation of length of and iteration over multi-part geometries in shapely
* Remove code redundancies in linref.events.collection for get_most and get_mode

0.0.5 (2022-09-01)
------------------
* Added sumproduct and count aggregators to EventsMergeAttribute class
* Address deprecation of length of and iteration over multi-part geometries in shapely
* Performance improvements
* Various bug fixes, minor features

0.0.4 (2022-06-24)
------------------
* Minor feature additions
* Performance improvements
* Addition of logos in github repo
* Various bug fixes, minor features

0.0.3 (2022-06-07)
------------------
* Various updates for geopandas 0.10+ dependency including improved performance of project methods
* Automatic sorting of events dataframe prior to performing dissolve
* Performance improvements
* Various bug fixes, minor features

0.0.2 (2022-04-11)
------------------
* Various bug fixes, minor features

0.0.1 (2022-03-31)
------------------
* Original experimental release.

Future improvements
===================
* Check spatial continuity of events groups. This may apply at instantiation of ``EventsCollection``.
* Unify direction of opposing routes which converge/diverge at a point (e.g., W Main St and E Main St).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "linref",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, geospatial, linear, data, event, dissolve, overlay, range, numeric, interval",
    "author": null,
    "author_email": "Tariq Shihadah <tariq.shihadah@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/93/b62d4a1ee5c066f3821b6e8db25a822391fab19c49bc3ac0b797cabcc887/linref-0.1.1.tar.gz",
    "platform": null,
    "description": "Overview\n========\nThe ``linref`` library builds on tabular and geospatial libraries ``pandas`` and ``geopandas`` to implement powerful features for linearly referenced data through ``EventsCollection`` and other object classes. Linear referencing operations powered by the ``numpy``, ``shapely``, and ``rangel`` open-source libraries allow for optimized implementations of common and advanced linearly referenced data management, manipulation, and analysis operations.\n\nSome of the main features of this library include:\n\n* Event dissolves using ``EventsCollection.dissolve()``\n* Merging and overlaying multiple tables of events with the ``EventsCollection.merge()`` method and the ``EventsMerge`` class API and its many linearly-weighted overlay aggregators\n* Linear aggregations of data such as sliding window analysis with the powerful ``EventsMerge.distribute()`` method\n* Resegmentation of linear data with ``EventsCollection.to_windows()`` and related methods\n* Creating unions of multiple ``EventsCollection`` instances with the ``EventsUnion`` object class.\n\nCode Snippets\n=============\nCreate an events collection for a sample roadway events dataframe with unique  \nroute identifier represented by the 'Route' column and data for multiple years, \nrepresented by the 'Year' column. The begin and end mile points are defined by \nthe 'Begin' and 'End' columns::\n\n    ec = EventsCollection(df, keys=['Route','Year'], beg='Begin', end='End')\n\nTo select events from a specific route and a specific year, indexing for all \nkeys can be used, producing an EventsGroup::\n\n    eg = ec['Route 50', 2018]\n\nTo select events on all routes but only those from a specific year, indexing \nfor only some keys can be used::\n\n    ec_2018 = ec[:, 2018]\n\nTo get all events which intersect with a numeric range, the intersecting() \nmethod can be used on an EventsGroup instance::\n\n    df_intersecting = eg.intersecting(0.5, 1.5, closed='left_mod')\n\nThe intersecting() method can also be used for point locations by ommitting the \nsecond location attribute::\n\n    df_intersecting = eg.intersecting(0.75, closed='both')\n\nThe linearly weighted average of one or more attributes can be obtained using \nthe overlay_average() method::\n\n    df_overlay = eg.overlay_average(0.5, 1.5, cols=['Speed_Limit','Volume'])\n\nIf the events include information on the roadway speed limit and number of \nlanes, they can be dissolved on these attributes. During the dissolve, other \nattributes can be aggregated, providing a list of associated values or \nperforming an aggregation function over these values::\n\n    ec_dissolved = ec.dissolve(attr=['Speed_Limit','Lanes'], aggs=['County'])\n\nVersion Notes\n=============\n0.1.1 (2024-08-20)\n-------------------\n* Addition of array-like, dataframe label-based, and callable ``length`` parameter options to the ``EventsCollection.to_windows()`` method and ``distance`` parameter to the ``EventsCollection.shift()`` method. This allows for the creation of segments based on a variable length. This will be made available to other methods in future versions as well.\n* Address ``numpy>=2.x`` compatibility issue in ``EventsCollection.dissolve()`` method which was causing errors in some cases. More fixes related to ``numpy`` updates are expected to come in future versions.\n* Address datatype loss issues for LRS columns during ``EventsCollection.to_windows()`` and ``EventsUnion.union()`` methods. This was causing some instances of key columns to be converted to incorrect dtypes.\n* Restructure .targets property to be ``keys + [beg, end]`` for more intuitive and consistent performance.\n* Addition of ``min`` and ``max`` aggregation methods to the ``EventsMergeAttribute`` class.\n* Several example Jupyter Notebooks for common use cases have been added to the ``examples`` folder for user reference. More to come.\n* Performance improvements\n* Various bug fixes, minor features\n\n0.1.0 (2024-01-16)\n-------------------\nMy heart is in Gaza.\n\n* Initial deployment of synthesis module featuring some tools for generating linear referencing information for chains of linear asset data with geometry but no LRS. These features are currently experimental and outputs should be reviewed for quality and expected outcomes. They will get refined in future versions based on performance in various applications and input from users.\n* Addition of ``retain`` parameter to the ``EventsCollection.to_windows()`` method which retains all non-target and non-spatial fields from the original events dataframe when performing the operation. Previously, only newly generated target fields would be present in the output ``EventsCollection``'s events dataframe.\n* Fixed implementation of ``EventsCollection.spatials`` property to correctly return a list of spatial column labels (e.g., geometry and route column labels) in the events dataframe. This also corrects ``EventsCollection.others`` which previously incorrectly included these labels.\n* Addition of ``EventsCollection.clip()`` method and expansion of the ``EventsCollection.shift()`` method for better parameterization.\n* Transition to ``pyproject.toml`` setup with ``setuptools``.\n* Performance improvements\n* Various bug fixes, minor features\n* Why not push to v0.1 finally?\n\n0.0.10 (2023-05-03)\n-------------------\nNot a lot of updates to share, I guess that's a good thing?\n\n* Minor updates to MLSRoute class to account for deprecation of subscripting MultiLineStrings. Most issues were addressed previously but a few were missed, most notably in the MLSRoute.bearing() method and a couple odd cases in the MLSRoute.cut() method.\n* Fix minor issue with EventsCollection.project_parallel() implementation related to unmatched sampling points.\n* Addition of EventsFrame.cast_gdf() method to cast events dataframes to geopandas geodataframes in-line.\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.9 (2023-03-02)\n------------------\nFirst update of 2023. Been a quiet start to the year.\n\n* Add missing .any() aggregation method to EventsMergeAttribute API. Was previously available but missed during a previous update.\n* Update documentation\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.8.post2 (2022-12-23)\n------------------------\nFinal update of 2022 including small feature updates and bug fixes from 0.0.8. Happy Holidays!\n\n* Add .set_df() method for in-line modification of an EventsFrame's dataframe, inplace or not.\n* Addition of suffixes parameter and default setting to EventsUnion.union() method.\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.8.post1 (2022-12-16)\n------------------------\n* Improve performance of .project() method when nearest=False by removing dependence on join_nearby() function and using native gpd features.\n* Add .size and .shape properties to EventsFrames and subclasses.\n* Various bug fixes, minor features\n\n0.0.8 (2022-12-14)\n------------------\n* Improve performance of essential .get_group() method, reducing superfluous initialization of empty dataframes and events collections and improving logging of initialized groups.\n* Improve performance of .union() method with updated RangeCollection.union() features and optimized iteration and aggregation of unified data. Performance times are significantly improved, especially for large datasets with many events groups.\n* Improve distribute method performance which was added in recent versions.\n* Drop duplicates in .project() method when using sjoin_nearest with newer versions of geopandas. Improved validation in .project() method, address edge case where projecting geometry column has a non-standard label (e.g., not 'geometry').\n* Added .sort() method to events collection. Default sorting methods remain unchanged.\n* Added warnings for missing data in target columns when initializing an EventsFrames through standard methods.\n* Remove .project_old() method from events collection due to deprecation.\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.7 (2022-10-14)\n------------------\n* Refactoring of EventsMerge system from 2D to 3D vectorized relationships for improved performance and accuracy. API and aggregation methods are largely the same.\n* Modified closed parameter use in merge relationships in accordance with rangel v0.0.6, which now performs intersections which honor the closed parameter on the left collection as well as the right collection. This provides more accurate results for events which fall on the edges of intersecting events when using left_mod or right_mod closed parameters.\n* Updates to account for rangel 0.0.6 version which is now a minimum version requirement. Added other minimum version requirements for related packages.\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.5.post1 (2022-09-06)\n------------------------\n* Address deprecation of length of and iteration over multi-part geometries in shapely\n* Remove code redundancies in linref.events.collection for get_most and get_mode\n\n0.0.5 (2022-09-01)\n------------------\n* Added sumproduct and count aggregators to EventsMergeAttribute class\n* Address deprecation of length of and iteration over multi-part geometries in shapely\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.4 (2022-06-24)\n------------------\n* Minor feature additions\n* Performance improvements\n* Addition of logos in github repo\n* Various bug fixes, minor features\n\n0.0.3 (2022-06-07)\n------------------\n* Various updates for geopandas 0.10+ dependency including improved performance of project methods\n* Automatic sorting of events dataframe prior to performing dissolve\n* Performance improvements\n* Various bug fixes, minor features\n\n0.0.2 (2022-04-11)\n------------------\n* Various bug fixes, minor features\n\n0.0.1 (2022-03-31)\n------------------\n* Original experimental release.\n\nFuture improvements\n===================\n* Check spatial continuity of events groups. This may apply at instantiation of ``EventsCollection``.\n* Unify direction of opposing routes which converge/diverge at a point (e.g., W Main St and E Main St).\n",
    "bugtrack_url": null,
    "license": "MIT License ===========  *Copyright (c) 2024 Tariq Shihadah*  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Linearly referenced data management, manipulation, and operations",
    "version": "0.1.1",
    "project_urls": {
        "documentation": "https://linref.readthedocs.io/",
        "repository": "https://github.com/tariqshihadah/linref"
    },
    "split_keywords": [
        "python",
        " geospatial",
        " linear",
        " data",
        " event",
        " dissolve",
        " overlay",
        " range",
        " numeric",
        " interval"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4af5b61800192fba7278c731f7d71b404081ef7a294ce681a52560fbb183937a",
                "md5": "d5a8581fcd752830c420d339d0cbfee7",
                "sha256": "0e7bda266d2d1a0d71252fcf717f8f4ed2da51ba878c87718ab5cc7a4fc8c193"
            },
            "downloads": -1,
            "filename": "linref-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d5a8581fcd752830c420d339d0cbfee7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 63849,
            "upload_time": "2024-08-20T21:21:47",
            "upload_time_iso_8601": "2024-08-20T21:21:47.291968Z",
            "url": "https://files.pythonhosted.org/packages/4a/f5/b61800192fba7278c731f7d71b404081ef7a294ce681a52560fbb183937a/linref-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb93b62d4a1ee5c066f3821b6e8db25a822391fab19c49bc3ac0b797cabcc887",
                "md5": "91b97405fb91a917498944eb603e71f6",
                "sha256": "e3486ab936701d69eea4b931c1ce9b81be4f6c1973d8436f925dbae57c53dfd0"
            },
            "downloads": -1,
            "filename": "linref-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "91b97405fb91a917498944eb603e71f6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 61886,
            "upload_time": "2024-08-20T21:21:48",
            "upload_time_iso_8601": "2024-08-20T21:21:48.866058Z",
            "url": "https://files.pythonhosted.org/packages/cb/93/b62d4a1ee5c066f3821b6e8db25a822391fab19c49bc3ac0b797cabcc887/linref-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-20 21:21:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tariqshihadah",
    "github_project": "linref",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "shapely",
            "specs": [
                [
                    ">=",
                    "1.7"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.1"
                ]
            ]
        },
        {
            "name": "geopandas",
            "specs": [
                [
                    ">=",
                    "0.10.2"
                ]
            ]
        },
        {
            "name": "rangel",
            "specs": [
                [
                    ">=",
                    "0.0.7"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.4.1"
                ]
            ]
        },
        {
            "name": "build",
            "specs": []
        },
        {
            "name": "twine",
            "specs": []
        },
        {
            "name": "ipython",
            "specs": []
        }
    ],
    "lcname": "linref"
}
        
Elapsed time: 0.29805s