{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Exploring the plastic initialisation maps\n", "In this tutorial we will explore the initialisation maps offered in `plasticparcels`. Descriptions of these initialisation maps can be found [here](https://plastic.parcels-code.org/en/latest/initialisationmaps.html). For your particular model, you can generate these maps using the `create_release_maps.py` script found in `plasticparcels.scripts`. Here, we will download the file for the `NEMO0083` model. We will also make a dummy fieldset in order to show how to create particle sets from these initialisation maps." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Library imports\n", "from datetime import datetime, timedelta\n", "import xarray as xr\n", "import pandas as pd\n", "import numpy as np\n", "\n", "# Parcels and PlasticParcels imports\n", "import plasticparcels as pp\n", "from parcels import FieldSet\n", "\n", "# Plotting imports\n", "import matplotlib.pyplot as plt\n", "from matplotlib.colors import LogNorm\n", "import matplotlib.gridspec as gridspec\n", "import matplotlib.ticker as ticker\n", "import matplotlib\n", "import cartopy.crs as ccrs\n", "import cartopy.feature as cfeature\n", "import cmocean" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Load the model settings\n", "settings = {\"release_maps\": {\n", " \"coastal\": None,\n", " \"rivers\": None,\n", " \"fisheries\": None,\n", " \"global_concentrations\": None,},\n", " \"unbeaching\": {\n", " \"filename\": None,\n", " }\n", "}\n", "\n", "# Set some plastic settings, for use later in the tutorial\n", "settings['plastictype'] = {\n", " 'wind_coefficient' : 0.01, # Percentage of wind to apply to particles\n", " 'plastic_diameter' : 0.001, # Plastic particle diameter (m)\n", " 'plastic_density' : 1030., # Plastic particle density (kg/m^3)\n", "}" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Download the mask and release data\n", "settings = pp.utils.download_plasticparcels_dataset('NEMO0083', settings, 'input_data')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Create a dummy fieldset\n", "def generate_dummy_fieldset(xdim, ydim, zdim=1, tdim=1):\n", " lon = np.linspace(0., 10., xdim, dtype=np.float32)\n", " lat = np.linspace(0., 10., ydim, dtype=np.float32)\n", " depth = np.zeros(zdim, dtype=np.float32)\n", " time = np.zeros(tdim, dtype=np.float64)\n", " if zdim == 1 and tdim == 1:\n", " U, V = np.meshgrid(lon, lat)\n", " dimensions = {'lat': lat, 'lon': lon}\n", " else:\n", " U = np.ones((tdim, zdim, ydim, xdim))\n", " V = np.ones((tdim, zdim, ydim, xdim))\n", " dimensions = {'lat': lat, 'lon': lon, 'depth': depth, 'time': time}\n", " data = {'U': np.array(U, dtype=np.float32), 'V': np.array(V, dtype=np.float32)}\n", "\n", " fieldset = FieldSet.from_data(data, dimensions)\n", " return fieldset\n", "\n", "fieldset = generate_dummy_fieldset(10,10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Explore the `coastal` initialisation map\n", "The `coastal` initialisation map provides locations of plastic pollution generated from mismanaged plastic waste near coastal populations. We will start by loading in the data using `pandas`." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "coastal_ds = pd.read_csv(settings['release_maps']['coastal'])" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Unnamed: 0 | \n", "Continent | \n", "Region | \n", "Subregion | \n", "Country | \n", "Longitude | \n", "Latitude | \n", "Area[km2] | \n", "PopulationDensity | \n", "Economic status | \n", "Mismanaged plastic waste [kg/person/day] | \n", "MPW_Cell | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "Asia | \n", "Asia | \n", "Western Asia | \n", "Yemen | \n", "53.583333 | \n", "12.239176 | \n", "8.201038 | \n", "17.718029 | \n", "LMI | \n", "0.076627 | \n", "11.134375 | \n", "
| 1 | \n", "1 | \n", "Asia | \n", "Asia | \n", "Western Asia | \n", "Yemen | \n", "53.666667 | \n", "12.239176 | \n", "8.201038 | \n", "17.718029 | \n", "LMI | \n", "0.076627 | \n", "11.134375 | \n", "
| 2 | \n", "2 | \n", "Asia | \n", "Asia | \n", "Western Asia | \n", "Yemen | \n", "53.750000 | \n", "12.239176 | \n", "8.201038 | \n", "17.718029 | \n", "LMI | \n", "0.076627 | \n", "11.134375 | \n", "
| 3 | \n", "3 | \n", "Asia | \n", "Asia | \n", "Western Asia | \n", "Yemen | \n", "53.833333 | \n", "12.239176 | \n", "8.201038 | \n", "17.718029 | \n", "LMI | \n", "0.076627 | \n", "11.134375 | \n", "
| 4 | \n", "4 | \n", "Asia | \n", "Asia | \n", "Western Asia | \n", "Yemen | \n", "43.416667 | \n", "12.320603 | \n", "8.195966 | \n", "11.842899 | \n", "LMI | \n", "0.076627 | \n", "7.437719 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 87854 | \n", "87854 | \n", "North America | \n", "Americas | \n", "Caribbean | \n", "Sint Maarten | \n", "-62.833333 | \n", "17.869711 | \n", "7.778406 | \n", "421.876770 | \n", "HIC | \n", "0.005100 | \n", "16.735158 | \n", "
| 87855 | \n", "87855 | \n", "North America | \n", "Americas | \n", "Caribbean | \n", "Sint Maarten | \n", "-62.666667 | \n", "17.869711 | \n", "7.778406 | \n", "0.000000 | \n", "HIC | \n", "0.005100 | \n", "0.000000 | \n", "
| 87856 | \n", "87856 | \n", "North America | \n", "Americas | \n", "Caribbean | \n", "Sint Maarten | \n", "-62.833333 | \n", "17.949007 | \n", "7.771451 | \n", "421.876770 | \n", "HIC | \n", "0.005100 | \n", "16.720194 | \n", "
| 87857 | \n", "87857 | \n", "North America | \n", "Americas | \n", "Caribbean | \n", "Sint Maarten | \n", "-62.666667 | \n", "17.949007 | \n", "7.771451 | \n", "0.000000 | \n", "HIC | \n", "0.005100 | \n", "0.000000 | \n", "
| 87858 | \n", "87858 | \n", "North America | \n", "Americas | \n", "Caribbean | \n", "Sint Maarten | \n", "-62.750000 | \n", "18.028266 | \n", "7.764472 | \n", "0.000000 | \n", "HIC | \n", "0.005100 | \n", "0.000000 | \n", "
87859 rows × 12 columns
\n", "| \n", " | Unnamed: 0 | \n", "Continent | \n", "Region | \n", "Subregion | \n", "Country | \n", "Longitude | \n", "Latitude | \n", "Emissions | \n", "
|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "Oceania | \n", "Oceania | \n", "Australia and New Zealand | \n", "New Zealand | \n", "168.833333 | \n", "-46.569603 | \n", "0.164904 | \n", "
| 1 | \n", "1 | \n", "Oceania | \n", "Oceania | \n", "Australia and New Zealand | \n", "New Zealand | \n", "168.333333 | \n", "-46.454902 | \n", "0.124932 | \n", "
| 2 | \n", "2 | \n", "Oceania | \n", "Oceania | \n", "Australia and New Zealand | \n", "New Zealand | \n", "168.333333 | \n", "-46.454902 | \n", "1.213370 | \n", "
| 3 | \n", "3 | \n", "Oceania | \n", "Oceania | \n", "Australia and New Zealand | \n", "New Zealand | \n", "168.000000 | \n", "-46.339961 | \n", "0.121138 | \n", "
| 4 | \n", "4 | \n", "Oceania | \n", "Oceania | \n", "Australia and New Zealand | \n", "New Zealand | \n", "169.833333 | \n", "-46.397461 | \n", "0.197533 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 31814 | \n", "31814 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "158.768783 | \n", "52.970829 | \n", "3.937440 | \n", "
| 31815 | \n", "31815 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "158.598172 | \n", "52.908962 | \n", "3.821710 | \n", "
| 31816 | \n", "31816 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "158.768783 | \n", "52.970829 | \n", "9.836130 | \n", "
| 31817 | \n", "31817 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "158.598172 | \n", "52.908962 | \n", "1.693040 | \n", "
| 31818 | \n", "31818 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "143.016093 | \n", "53.637712 | \n", "1.886280 | \n", "
31819 rows × 8 columns
\n", "| \n", " | Unnamed: 0 | \n", "Longitude | \n", "Latitude | \n", "Flag | \n", "Geartype | \n", "Month | \n", "Continent | \n", "Region | \n", "Subregion | \n", "Country | \n", "fishing_hours | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "-179.998299 | \n", "53.902935 | \n", "USA | \n", "pots_and_traps | \n", "2020-09-01 | \n", "North America | \n", "Americas | \n", "Northern America | \n", "United States | \n", "0.1477 | \n", "
| 1 | \n", "1 | \n", "-179.998244 | \n", "64.513663 | \n", "CYP | \n", "trawlers | \n", "2020-08-01 | \n", "Asia | \n", "Asia | \n", "Western Asia | \n", "Cyprus | \n", "0.5673 | \n", "
| 2 | \n", "2 | \n", "-179.998244 | \n", "64.513663 | \n", "KOR | \n", "trawlers | \n", "2020-10-01 | \n", "Asia | \n", "Asia | \n", "Eastern Asia | \n", "Republic of Korea | \n", "0.9904 | \n", "
| 3 | \n", "3 | \n", "-179.998244 | \n", "64.513663 | \n", "RUS | \n", "fishing | \n", "2020-09-01 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "4.9353 | \n", "
| 4 | \n", "4 | \n", "-179.998244 | \n", "64.513663 | \n", "RUS | \n", "purse_seines | \n", "2020-09-01 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "2.6808 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 5975965 | \n", "5975965 | \n", "180.000000 | \n", "18.818880 | \n", "TWN | \n", "drifting_longlines | \n", "2020-12-01 | \n", "Asia | \n", "Asia | \n", "Eastern Asia | \n", "Taiwan | \n", "4.8436 | \n", "
| 5975966 | \n", "5975966 | \n", "180.000000 | \n", "19.370117 | \n", "TWN | \n", "drifting_longlines | \n", "2020-12-01 | \n", "Asia | \n", "Asia | \n", "Eastern Asia | \n", "Taiwan | \n", "1.2607 | \n", "
| 5975967 | \n", "5975967 | \n", "180.000000 | \n", "19.684276 | \n", "CHN | \n", "squid_jigger | \n", "2020-06-01 | \n", "Asia | \n", "Asia | \n", "Eastern Asia | \n", "China | \n", "1.7861 | \n", "
| 5975968 | \n", "5975968 | \n", "180.000000 | \n", "22.329116 | \n", "TWN | \n", "drifting_longlines | \n", "2020-02-01 | \n", "Asia | \n", "Asia | \n", "Eastern Asia | \n", "Taiwan | \n", "0.4816 | \n", "
| 5975969 | \n", "5975969 | \n", "180.000000 | \n", "22.483228 | \n", "TWN | \n", "drifting_longlines | \n", "2020-02-01 | \n", "Asia | \n", "Asia | \n", "Eastern Asia | \n", "Taiwan | \n", "0.3310 | \n", "
5975970 rows × 11 columns
\n", "| \n", " | Unnamed: 0 | \n", "Continent | \n", "Region | \n", "Subregion | \n", "Country | \n", "Longitude | \n", "Latitude | \n", "Concentration | \n", "ConcentrationType | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "163.166667 | \n", "-76.991731 | \n", "0.000001 | \n", "Ocean | \n", "
| 1 | \n", "1 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "163.250000 | \n", "-76.991731 | \n", "0.000001 | \n", "Ocean | \n", "
| 2 | \n", "2 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "163.333333 | \n", "-76.991731 | \n", "0.000001 | \n", "Ocean | \n", "
| 3 | \n", "3 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "163.416667 | \n", "-76.991731 | \n", "0.000001 | \n", "Ocean | \n", "
| 4 | \n", "4 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "163.500000 | \n", "-76.991731 | \n", "0.000001 | \n", "Ocean | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 7670607 | \n", "51864 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "73.155517 | \n", "67.431626 | \n", "0.056413 | \n", "Beach | \n", "
| 7670608 | \n", "51865 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "73.155159 | \n", "67.394924 | \n", "0.056413 | \n", "Beach | \n", "
| 7670609 | \n", "51866 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "73.154806 | \n", "67.358225 | \n", "0.056413 | \n", "Beach | \n", "
| 7670610 | \n", "51867 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "73.154457 | \n", "67.321532 | \n", "0.056413 | \n", "Beach | \n", "
| 7670611 | \n", "51868 | \n", "Europe | \n", "Europe | \n", "Eastern Europe | \n", "Russian Federation | \n", "73.154110 | \n", "67.284847 | \n", "0.056413 | \n", "Beach | \n", "
7670612 rows × 9 columns
\n", "