{ "cells": [ { "cell_type": "markdown", "id": "c19cc072-62ff-4ced-93c6-eda6d16d8da7", "metadata": {}, "source": [ "# `pygieons` documentation\n", "\n", "## What is `pygieons`?\n", "\n", "The name (you would anyway ask 😉): ***Py***thon ***GI***S and ***E***arch ***O***bservation ***N***etwork***s***\n", "\n", "As described elsewhere, this website is largely generated automatically by using a Python tool called `pygieons`. This tool auto-generates content regarding the listed packages and adds them to the website either as tables or interactive Network visualizations. `pygieons` is currently focused on parsing information about Python GIS and Earth Observation libraries, but it is a rather generic tool, with modest modifications it would be possible to parse and visualize information from any collection of libraries available on PyPi.\n", "\n", "`pygieons` is largely based on [pandas](https://pandas.pydata.org/) which is used for data manipulation, while [pyvis](https://pyvis.readthedocs.io/) library is used to visualize the connections between libraries as an interactive network of links. In addition, under the hood libraries such as `requests`, `beautifulsoup4` and `pypistats` are used to extract relevant information about the listed libraries from the PyPi web pages. \n", "\n", "Below, we demonstrate some basic functionalities that can be used to auto-generate content using `pygieons`." ] }, { "cell_type": "markdown", "id": "0dc5335c-ab3b-49fc-a3a8-979d4b47ed77", "metadata": {}, "source": [ "## Basic usage\n", "\n", "### Initializing the tool\n", "\n", "To generate content with `pygieons`, you need to first initialize the tool with `Ecosystem()` object which accepts a parameter `plot_type` that can be used to define which category of libraries we want to plot, and parameter `log` which can be used to disable logging to the screen. Below is the slightly modified output from `help(Ecosystem)` command showing information about how the tool can be initialized: \n", "\n", "```raw\n", "class Ecosystem(builtins.object)\n", " | Ecosystem(plot_type='all', keep_all=False, log=True)\n", " | \n", " | Parameters\n", " | ==========\n", " | \n", " | plot_type : str\n", " | This can be used to specify if you want to plot all packages in same figure, or only vector or raster.\n", " | Possible values are: \"all\", \"vector\", \"raster\", \"generic\", \"vector+generic\", \"raster+generic\".\n", " | keep_all : bool\n", " | If True, also packages that are not available from PyPi or which are not maintained will be kept.\n", " | log: bool\n", " | If True, will print messages during process.\n", "```" ] }, { "cell_type": "markdown", "id": "9a45ec0b-2d9b-4203-b8a8-8ac5eebfe417", "metadata": {}, "source": [ "- Let's initialize the tool and configure it for plotting `raster` libraries." ] }, { "cell_type": "code", "execution_count": 5, "id": "5c7992e2-6ad0-457b-b32f-f8705c58d693", "metadata": {}, "outputs": [], "source": [ "from pygieons import Ecosystem\n", "\n", "# Initialize the tool \n", "e = Ecosystem(plot_type=\"raster\", log=True)" ] }, { "cell_type": "markdown", "id": "38563aa0-778a-4b7a-961b-861ccde61a45", "metadata": {}, "source": [ "### Generating tables\n", "\n", "To generate a table showing various information about the libraries, you can use method `prepare_table()`, which autogenerates the table contents based on the packages listed in [ecosystem_connections.py](https://github.com/pygieons/pygieons/blob/main/src/pygieons/ecosystem_connections.py) and [ecosystem_pkgs.py](https://github.com/pygieons/pygieons/blob/main/src/pygieons/ecosystem_pkgs.py) files. The tool will print out information about the progress if `log` was specified as `True`:" ] }, { "cell_type": "code", "execution_count": 7, "id": "c57eead6-bb34-43a7-971d-797766e726c7", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Find out the number of monthly downloads from PyPi for the libraries ..\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "9e3da1d542cf4506a34d569c0b8111f9", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/41 [00:00\n", "#T_bd972 th {\n", " font-size: 100%;\n", " text-align: center;\n", " background-color: #F0F3CF;\n", "}\n", "#T_bd972 caption {\n", " caption-side: top;\n", " font-size: 130%;\n", " font-weight: bold;\n", " text-align: left;\n", " height: 50px;\n", " color: black;\n", "}\n", "#T_bd972 td {\n", " font-size: 90%;\n", " text-align: center;\n", "}\n", "#T_bd972 .pd-t {\n", " visibility: hidden;\n", " position: absolute;\n", " z-index: 1;\n", " background-color: black;\n", " color: white;\n", " transform: translate(-20px, -20px);\n", "}\n", "#T_bd972 #T_bd972_row0_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row0_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row1_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row1_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row2_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row2_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row3_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row3_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row4_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row4_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row5_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row5_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row6_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row6_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row7_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row7_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972 #T_bd972_row8_col2:hover .pd-t {\n", " visibility: visible;\n", "}\n", "#T_bd972 #T_bd972_row8_col2 .pd-t::after {\n", " content: \"\";\n", "}\n", "#T_bd972_row0_col1, #T_bd972_row1_col1, #T_bd972_row2_col1, #T_bd972_row3_col1, #T_bd972_row4_col1, #T_bd972_row5_col1, #T_bd972_row6_col1, #T_bd972_row7_col1, #T_bd972_row8_col1 {\n", " text-align: center;\n", "}\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Analysis / modelling (count=9)
NameHomepageInfoLicensePyPi versionPyPi downloads (monthly)Conda-forge versionConda-forge downloadsConda-forge latest release
gstools🏠\"License\"\"PyPI2,063\"Conda\"Conda\"Conda
pykrige🏠\"License\"\"PyPI18,550\"Conda\"Conda\"Conda
pysheds🏠\"License\"\"PyPI921\"Conda\"Conda\"Conda
pyspatialml🏠NA\"PyPI95NANANA
rasterstats🏠\"License\"\"PyPI61,296\"Conda\"Conda\"Conda
richdem🏠\"License\"\"PyPI2,129\"Conda\"Conda\"Conda
scikit-learn🏠\"License\"\"PyPI33,204,319\"Conda\"Conda\"Conda
spyndex🏠\"License\"\"PyPI356\"Conda\"Conda\"Conda
xarray-spatial🏠\"License\"\"PyPI2,074\"Conda\"Conda\"Conda
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Core / data structures (count=8)
NameHomepageInfoLicensePyPi versionPyPi downloads (monthly)Conda-forge versionConda-forge downloadsConda-forge latest release
affine🏠\"License\"\"PyPI673,504\"Conda\"Conda\"Conda
iris🏠\"License\"\"PyPI951\"Conda\"Conda\"Conda
rasterio🏠\"License\"\"PyPI755,843\"Conda\"Conda\"Conda
rio-cogeo🏠\"License\"\"PyPI12,869\"Conda\"Conda\"Conda
rioxarray🏠\"License\"\"PyPI36,151\"Conda\"Conda\"Conda
sarpy🏠\"License\"\"PyPI943\"Conda\"Conda\"Conda
sarsen🏠\"License\"\"PyPI54\"Conda\"Conda\"Conda
xarray🏠\"License\"\"PyPI1,705,385\"Conda\"Conda\"Conda
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Data extraction / processing (count=21)
NameHomepageInfoLicensePyPi versionPyPi downloads (monthly)Conda-forge versionConda-forge downloadsConda-forge latest release
earthengine-api🏠\"License\"\"PyPI36,212\"Conda\"Conda\"Conda
easystac🏠\"License\"\"PyPI110\"Conda\"Conda\"Conda
eemont🏠\"License\"\"PyPI700\"Conda\"Conda\"Conda
lidar🏠\"License\"\"PyPI283\"Conda\"Conda\"Conda
odc-stac🏠\"License\"\"PyPI986\"Conda\"Conda\"Conda
planetary-computer🏠\"License\"\"PyPI2,795\"Conda\"Conda\"Conda
pymap3d🏠\"License\"\"PyPI41,451\"Conda\"Conda\"Conda
pyrosar🏠\"License\"\"PyPI491\"Conda\"Conda\"Conda
pystac🏠\"License\"\"PyPI32,119\"Conda\"Conda\"Conda
pystac-client🏠\"License\"\"PyPI9,842\"Conda\"Conda\"Conda
radiant-mlhub🏠\"License\"\"PyPI5,836\"Conda\"Conda\"Conda
rio-hist🏠NA\"PyPI364NANANA
rio-mucho🏠\"License\"\"PyPI8,847\"Conda\"Conda\"Conda
rio-tiler🏠\"License\"\"PyPI8,237\"Conda\"Conda\"Conda
salem🏠\"License\"\"PyPI5,834\"Conda\"Conda\"Conda
satpy🏠\"License\"\"PyPI3,498\"Conda\"Conda\"Conda
sentinelsat🏠\"License\"\"PyPI12,394\"Conda\"Conda\"Conda
stackstac🏠\"License\"\"PyPI1,235\"Conda\"Conda\"Conda
verde🏠\"License\"\"PyPI731\"Conda\"Conda\"Conda
xarray-sentinel🏠\"License\"\"PyPI79\"Conda\"Conda\"Conda
xyzservices🏠\"License\"\"PyPI165,745\"Conda\"Conda\"Conda
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Visualization (count=3)
NameHomepageInfoLicensePyPi versionPyPi downloads (monthly)Conda-forge versionConda-forge downloadsConda-forge latest release
contextily🏠\"License\"\"PyPI71,077\"Conda\"Conda\"Conda
rio-color🏠\"License\"\"PyPI8,170\"Conda\"Conda\"Conda
xarray_leaflet🏠\"License\"\"PyPI1,026\"Conda\"Conda\"Conda
\n" ], "text/plain": [ "" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tbl.show()" ] }, { "cell_type": "markdown", "id": "e23825d1-2b3e-4035-86db-def81e6e8b51", "metadata": {}, "source": [ "### Generating Network visualization\n", "\n", "To generate an interactive network visualization showing the connections between libraries, you can use method `prepare_net()`, which autogenerates the Network based on the packages listed in [ecosystem_connections.py](https://github.com/pygieons/pygieons/blob/main/src/pygieons/ecosystem_connections.py) file. The tool will print out information about the progress if `log` was specified as `True`:" ] }, { "cell_type": "code", "execution_count": 9, "id": "abda1f5b-4a23-457b-932f-5177f01fefcb", "metadata": {}, "outputs": [], "source": [ "# Generate the content\n", "net = e.prepare_net()" ] }, { "cell_type": "markdown", "id": "f106541d-f2f2-4c40-9402-8cc6941850cc", "metadata": {}, "source": [ "- You can visualize the network by calling `.show()` of the returned `Network` object" ] }, { "cell_type": "code", "execution_count": 10, "id": "81711740-0451-48a3-908e-7f57dd32041c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", "
\n", "

\n", "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
\n", "\n", "\n", "\n", "\n", "" ], "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "net.show()" ] }, { "cell_type": "markdown", "id": "637497b7-dbcd-4276-b56d-44d1929bad2f", "metadata": {}, "source": [ "- In addition, you can also save the Network visualization as a HTML file to your own computer by calling `.save()` method:" ] }, { "cell_type": "code", "execution_count": 11, "id": "2a69a311-78d8-48ea-9f18-1cf2893eb023", "metadata": {}, "outputs": [], "source": [ "net.save(\"test.html\")" ] } ], "metadata": { "execution": { "timeout": 360 }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }