Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
giocaizzi committed Dec 27, 2021
2 parents d64c8b4 + ce1d944 commit b8e1edf
Show file tree
Hide file tree
Showing 44 changed files with 1,948 additions and 290 deletions.
Binary file removed .coverage
Binary file not shown.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
![Licende](https://img.shields.io/github/license/giocaizzi/mplStrater)
![GitHub issues](https://img.shields.io/github/issues/giocaizzi/mplStrater)

This package provides the possibility to plot geologic stratigraphic columns with a structured labelling system on `matplotlib` figures.
This package provides the possibility to plot geologic stratigraphic columns with a structured symbology and labelling system on `matplotlib` figures.

Additionally, it allows to use georeferenced rasters as basemap.
The package allows to use georeferenced rasters as basemap.

![Image](data/temp.png)
![map](docsrc/source/images/map.png)

Additionally, the package has the capability to just plot the single stratigraphic columns.

![columns](docsrc/source/images/columns.jpeg)

## Documentation

The documentation can be found [here](https://giocaizzi.github.io/mplStrater/).
The documentation with examples can be found [here](https://giocaizzi.github.io/mplStrater/).

## Installation (from source)

Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 88cc700b66fb3e388fbaac37e2e1962d
config: 2c1a4c48475fb5aa32c0f82b961977b6
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added docs/_images/examples_data_10_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/examples_strata_8_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/examples_stratigraphic_map_12_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
210 changes: 193 additions & 17 deletions docs/_sources/examples/data.ipynb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,215 @@
"source": [
"# StrataFrame\n",
"\n",
"The `mpl.data.StrataFrame` is a `pandas.DataFrame` with additional features functional to plotting stratigraphic columns."
"The `mpl.data.StrataFrame` is a `pandas.DataFrame` with additional features functional to plotting stratigraphic columns.\n",
"\n",
"First, import all required packages and load the example dataset."
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 25,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"import pandas as pd\n",
"from mplStrater.data import StrataFrame"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>x</th>\n",
" <th>y</th>\n",
" <th>z</th>\n",
" <th>punto</th>\n",
" <th>campione</th>\n",
" <th>da</th>\n",
" <th>a</th>\n",
" <th>area</th>\n",
" <th>matrice</th>\n",
" <th>pericolosita</th>\n",
" <th>sostanza_pericolosità</th>\n",
" <th>smaltibilità_riutilizzo</th>\n",
" <th>amianto_qualitativa</th>\n",
" <th>amianto_quantitativa</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>204026.93</td>\n",
" <td>4973197.522</td>\n",
" <td>258.399</td>\n",
" <td>SI01</td>\n",
" <td>1</td>\n",
" <td>0.0</td>\n",
" <td>0.6</td>\n",
" <td>2A</td>\n",
" <td>Riporto conforme</td>\n",
" <td>_</td>\n",
" <td>NaN</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>-1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>204026.93</td>\n",
" <td>4973197.522</td>\n",
" <td>258.399</td>\n",
" <td>SI01</td>\n",
" <td>2</td>\n",
" <td>0.6</td>\n",
" <td>2.0</td>\n",
" <td>2A</td>\n",
" <td>Assenza campione</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>-1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>204026.93</td>\n",
" <td>4973197.522</td>\n",
" <td>258.399</td>\n",
" <td>SI01</td>\n",
" <td>2</td>\n",
" <td>2.0</td>\n",
" <td>3.5</td>\n",
" <td>2A</td>\n",
" <td>Rifiuto</td>\n",
" <td>Pericoloso</td>\n",
" <td>PIOMBO</td>\n",
" <td>IA</td>\n",
" <td>non rilevato</td>\n",
" <td>-1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>204026.93</td>\n",
" <td>4973197.522</td>\n",
" <td>258.399</td>\n",
" <td>SI01</td>\n",
" <td>3</td>\n",
" <td>3.5</td>\n",
" <td>5.2</td>\n",
" <td>2A</td>\n",
" <td>Assenza campione</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>_</td>\n",
" <td>-1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>204026.93</td>\n",
" <td>4973197.522</td>\n",
" <td>258.399</td>\n",
" <td>SI01</td>\n",
" <td>3</td>\n",
" <td>5.2</td>\n",
" <td>6.2</td>\n",
" <td>2A</td>\n",
" <td>Rifiuto</td>\n",
" <td>Pericoloso</td>\n",
" <td>PIOMBO</td>\n",
" <td>NP</td>\n",
" <td>non rilevato</td>\n",
" <td>-1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" x y z punto campione da a area \\\n",
"0 204026.93 4973197.522 258.399 SI01 1 0.0 0.6 2A \n",
"1 204026.93 4973197.522 258.399 SI01 2 0.6 2.0 2A \n",
"2 204026.93 4973197.522 258.399 SI01 2 2.0 3.5 2A \n",
"3 204026.93 4973197.522 258.399 SI01 3 3.5 5.2 2A \n",
"4 204026.93 4973197.522 258.399 SI01 3 5.2 6.2 2A \n",
"\n",
" matrice pericolosita sostanza_pericolosità \\\n",
"0 Riporto conforme _ NaN \n",
"1 Assenza campione _ _ \n",
"2 Rifiuto Pericoloso PIOMBO \n",
"3 Assenza campione _ _ \n",
"4 Rifiuto Pericoloso PIOMBO \n",
"\n",
" smaltibilità_riutilizzo amianto_qualitativa amianto_quantitativa \n",
"0 _ _ -1 \n",
"1 _ _ -1 \n",
"2 IA non rilevato -1 \n",
"3 _ _ -1 \n",
"4 NP non rilevato -1 "
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df=pd.read_csv(\"../../../data/example.csv\")\n",
"df.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Initiate class by proving a path to a csv file.The CSV file must be made of consecutive layers, without gaps\n",
"Pass to `mplStrater` a `pandas.DataFrame`.The dataframe must be made of consecutive layers **without gaps**. \n",
"\n",
"Specify the epsg code of the dataframe coordinate reference system (crs).\n",
"\n",
"In case you want to handle gaps, encode them with a code, such as `_` and specify the encoding in a legend."
"In case you need to handle gaps, encode them with a code, such as `_` and specify the encoding in a legend."
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 27,
"metadata": {},
"outputs": [],
"source": [
"sf=StrataFrame(\n",
" path_to_data=\"../../../data/example.csv\",\n",
" epsg=32633\n",
")"
"sf=StrataFrame(df=df,epsg=32633)"
]
},
{
Expand All @@ -50,7 +226,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 28,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -203,7 +379,7 @@
"4 NP non rilevato -1 "
]
},
"execution_count": 3,
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -221,7 +397,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 29,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -384,7 +560,7 @@
"4 [-1, -1, -1, -1, -1, -1] 8.0 POINT (204034.262 4973098.016) "
]
},
"execution_count": 4,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -397,12 +573,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The strataframe is a `geopandas.GeoDataFrame` and so inherits all methods, sumch as plotting."
"The strataframe is a `geopandas.GeoDataFrame` and so inherits all methods, such as plotting."
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand All @@ -411,7 +587,7 @@
"<AxesSubplot:>"
]
},
"execution_count": 5,
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
},
Expand Down
Loading

0 comments on commit b8e1edf

Please sign in to comment.