Skip to content

Commit dd0d526

Browse files
2 parents f4bad8f + 9bfc26d commit dd0d526

3 files changed

Lines changed: 121 additions & 2 deletions

File tree

src/DRAKKAR workshop code/PlasticParcels_DRAKKAR_tutorial.ipynb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@
156156
},
157157
"source": [
158158
"# PlasticParcels Tutorial\n",
159-
"In this tutorial we will introduce you to some of the basic Parcels functions, as well as utilise the PlasticParcels tool for simulating microplastic pollution. In order to limit the depands on data transfer and storage/memory, this tutorial only works in the Mediterranean sea. But note that in general, the [PlasticParcels package](https://github.com/OceanParcels/PlasticParcels) works globally.\n",
159+
"\n",
160+
"![PlasticParcels](https://github.com/OceanParcels/PlasticParcels/blob/main/logo.png)\n",
161+
"\n",
162+
"In this tutorial we will introduce you to some of the basic Parcels functions, as well as utilise the PlasticParcels tool for simulating microplastic pollution in the Mediterranean sea.\n",
160163
"\n",
161164
"By the end of this tutorial, you should be able to create a fieldset that contains NEMO hydrodynamic (and other) fields, create a particleset that represent marine microplastic pollution release locations, and apply physics parameterisations to simulate the dispersal of microplastics in the ocean.\n",
162165
"\n",
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 4,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import numpy as np\n",
10+
"import xarray as xr\n",
11+
"import pandas as pd\n"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": 5,
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"## Create a subset of the fisheries data for the tutorial\n",
21+
"file = '../../data/release/generated_files/agg_data_fisheries_info.csv'\n",
22+
"df = pd.read_csv(file)"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": 6,
28+
"metadata": {},
29+
"outputs": [],
30+
"source": [
31+
"left_lim, right_lim = [-10, 42]\n",
32+
"bottom_lim, top_lim = [30, 48]"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": 12,
38+
"metadata": {},
39+
"outputs": [],
40+
"source": [
41+
"inside_longitudes = np.logical_and((df['Longitude']>= left_lim), (df['Longitude'] <= right_lim))"
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": 13,
47+
"metadata": {},
48+
"outputs": [],
49+
"source": [
50+
"inside_latitudes = np.logical_and((df['Latitude']>= bottom_lim), (df['Latitude'] <= top_lim))"
51+
]
52+
},
53+
{
54+
"cell_type": "code",
55+
"execution_count": 14,
56+
"metadata": {},
57+
"outputs": [],
58+
"source": [
59+
"id_to_keep = np.logical_and(inside_longitudes, inside_latitudes)"
60+
]
61+
},
62+
{
63+
"cell_type": "code",
64+
"execution_count": 16,
65+
"metadata": {},
66+
"outputs": [],
67+
"source": [
68+
"subset = df[id_to_keep]"
69+
]
70+
},
71+
{
72+
"cell_type": "code",
73+
"execution_count": 17,
74+
"metadata": {},
75+
"outputs": [],
76+
"source": [
77+
"# Store datafile\n",
78+
"output_data = '../../data/release/generated_files/'\n",
79+
"subset.to_csv(output_data+'agg_data_fisheries_info_subset.csv')"
80+
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": null,
85+
"metadata": {},
86+
"outputs": [],
87+
"source": []
88+
}
89+
],
90+
"metadata": {
91+
"kernelspec": {
92+
"display_name": "py3_parcels",
93+
"language": "python",
94+
"name": "python3"
95+
},
96+
"language_info": {
97+
"codemirror_mode": {
98+
"name": "ipython",
99+
"version": 3
100+
},
101+
"file_extension": ".py",
102+
"mimetype": "text/x-python",
103+
"name": "python",
104+
"nbconvert_exporter": "python",
105+
"pygments_lexer": "ipython3",
106+
"version": "3.11.4"
107+
}
108+
},
109+
"nbformat": 4,
110+
"nbformat_minor": 2
111+
}

src/release/create_fisheries_release.ipynb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"outputs": [],
8888
"source": [
8989
"# Store datafile\n",
90-
"#agg_data_fisheries.to_csv(output_data+'fleet_monthly_aggregated.csv')\n",
90+
"agg_data_fisheries.to_csv(output_data+'fleet_monthly_aggregated.csv')\n",
9191
"## This chops it down from 70gb for one year to 2gb!"
9292
]
9393
},
@@ -320,6 +320,11 @@
320320
"## This chops it down from 70gb for one year to 2gb!"
321321
]
322322
},
323+
{
324+
"cell_type": "markdown",
325+
"metadata": {},
326+
"source": []
327+
},
323328
{
324329
"cell_type": "code",
325330
"execution_count": 12,

0 commit comments

Comments
 (0)