Skip to content

Commit

Permalink
Tutorial 02: Notes reading usage of own tabular data, dowload issue o…
Browse files Browse the repository at this point in the history
…f river data (#35)
  • Loading branch information
yvonnefroehlich authored Dec 9, 2024
1 parent be100a9 commit 9abe29e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions book/tut02_spe_pd_gpd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"outputs": [],
"source": [
"import geopandas as gpd\n",
"import pandas as pd\n",
"import pygmt\n",
"\n",
"# Use a resolution of only 150 dpi for the images within the Jupyter notebook, to keep the file small\n",
Expand All @@ -81,7 +82,8 @@
"source": [
"### 1.1 Tabular data - `pandas.DataFrame`\n",
"\n",
"Use an example dataset with tabular data provided by `PyGMT` and load it into a `pandas.DataFrame`. This dataset contains earthquakes in the area of Japan."
"Use an example dataset with tabular data provided by `PyGMT` and load it into a `pandas.DataFrame`. This dataset contains earthquakes in the area of Japan.\n",
"You can read your own dataset into a `pandas.Dataframe` using [`pandas.read_csv`](https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html) and use it in the same way to make the following plots; of course you have to adjust the column names accordantly."
]
},
{
Expand All @@ -92,7 +94,9 @@
"outputs": [],
"source": [
"df_jp_eqs = pygmt.datasets.load_sample_data(name=\"japan_quakes\")\n",
"df_jp_eqs.head()"
"df_jp_eqs.head()\n",
"\n",
"# df_your_dataset = pd.read_csv(\"your_dataset.csv\")"
]
},
{
Expand Down Expand Up @@ -239,7 +243,12 @@
"source": [
"#### 2.1.1 Spatial Data - `geopandas.GeoDataFrame` with line geometry\n",
"\n",
"First we download some data into in a [`geopandas.GeoDataFrame`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html). This dataset contains European rivers with their lengths and names."
"First we download some data into in a [`geopandas.GeoDataFrame`](https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.html). This dataset contains European rivers with their lengths and names.\n",
"\n",
"In case you face issues with downloading these data:\n",
"1. Copy the URL \"https://www.eea.europa.eu/data-and-maps/data/wise-large-rivers-and-large-lakes/zipped-shapefile-with-wise-large-rivers-vector-line/zipped-shapefile-with-wise-large-rivers-vector-line/at_download/file/wise_large_rivers.zip\" into your browser.\n",
"2. Download the zip file and place it into `~/agu24workshop/book`. Do not unpack the ZIP file.\n",
"3. Replace the URL with the filename of the ZIP file \"wise_large_rivers.zip\" in [`geopandas.read_file`](https://geopandas.org/en/stable/docs/reference/api/geopandas.read_file.html)."
]
},
{
Expand All @@ -254,6 +263,7 @@
" + \"zipped-shapefile-with-wise-large-rivers-vector-line/zipped-shapefile-with-wise-large-rivers-vector-line/\"\n",
" + \"at_download/file/wise_large_rivers.zip\"\n",
")\n",
"# gpd_rivers_org = pd.read_file(\"wise_large_rivers.zip\")\n",
"gpd_rivers_org.head()"
]
},
Expand Down Expand Up @@ -542,7 +552,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.12.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 9abe29e

Please sign in to comment.