|
15 | 15 | "cell_type": "markdown",
|
16 | 16 | "metadata": {},
|
17 | 17 | "source": [
|
18 |
| - "\nEddy detection\n==============\n\nScript will detect eddies on adt field, and compute u,v with method add_uv(which could use, only if equator is avoid)\n\nFigures will show different step to detect eddies.\n" |
| 18 | + "\n# Eddy detection : Med\n\nScript will detect eddies on adt field, and compute u,v with method add_uv(which could use, only if equator is avoid)\n\nFigures will show different step to detect eddies.\n" |
19 | 19 | ]
|
20 | 20 | },
|
21 | 21 | {
|
|
26 | 26 | },
|
27 | 27 | "outputs": [],
|
28 | 28 | "source": [
|
29 |
| - "from datetime import datetime\nfrom matplotlib import pyplot as plt\nfrom py_eddy_tracker.dataset.grid import RegularGridDataset\nfrom py_eddy_tracker import data" |
| 29 | + "from numpy import arange\nfrom datetime import datetime\nfrom matplotlib import pyplot as plt\nfrom py_eddy_tracker.dataset.grid import RegularGridDataset\nfrom py_eddy_tracker import data" |
30 | 30 | ]
|
31 | 31 | },
|
32 | 32 | {
|
|
37 | 37 | },
|
38 | 38 | "outputs": [],
|
39 | 39 | "source": [
|
40 |
| - "def start_axes(title):\n fig = plt.figure(figsize=(13, 5))\n ax = fig.add_axes([0.03, 0.03, 0.90, 0.94])\n ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)\n ax.set_aspect(\"equal\")\n ax.set_title(title)\n return ax\n\n\ndef update_axes(ax, mappable=None):\n ax.grid()\n if mappable:\n plt.colorbar(m, cax=ax.figure.add_axes([0.95, 0.05, 0.01, 0.9]))" |
| 40 | + "def start_axes(title):\n fig = plt.figure(figsize=(13, 5))\n ax = fig.add_axes([0.03, 0.03, 0.90, 0.94])\n ax.set_xlim(-6, 36.5), ax.set_ylim(30, 46)\n ax.set_aspect(\"equal\")\n ax.set_title(title)\n return ax\n\n\ndef update_axes(ax, mappable=None):\n ax.grid()\n if mappable:\n plt.colorbar(mappable, cax=ax.figure.add_axes([0.94, 0.05, 0.01, 0.9]))" |
41 | 41 | ]
|
42 | 42 | },
|
43 | 43 | {
|
|
62 | 62 | "cell_type": "markdown",
|
63 | 63 | "metadata": {},
|
64 | 64 | "source": [
|
65 |
| - "Get u/v\n-------\nU/V are deduced from ADT, this algortihm are not usable around equator (~+- 2\u00b0)\n\n" |
| 65 | + "## Get u/v\nU/V are deduced from ADT, this algortihm are not usable around equator (~+- 2\u00b0)\n\n" |
66 | 66 | ]
|
67 | 67 | },
|
68 | 68 | {
|
|
80 | 80 | "cell_type": "markdown",
|
81 | 81 | "metadata": {},
|
82 | 82 | "source": [
|
83 |
| - "Pre-processings\n---------------\nApply high filter to remove long scale to highlight mesoscale\n\n" |
| 83 | + "## Pre-processings\nApply high filter to remove long scale to highlight mesoscale\n\n" |
84 | 84 | ]
|
85 | 85 | },
|
86 | 86 | {
|
|
98 | 98 | "cell_type": "markdown",
|
99 | 99 | "metadata": {},
|
100 | 100 | "source": [
|
101 |
| - "Identification\n--------------\nrun identification with slice of 2 mm\n\n" |
| 101 | + "## Identification\nrun identification with slice of 2 mm\n\n" |
102 | 102 | ]
|
103 | 103 | },
|
104 | 104 | {
|
|
109 | 109 | },
|
110 | 110 | "outputs": [],
|
111 | 111 | "source": [
|
112 |
| - "date = datetime(2016, 5, 15)\na, c = g.eddy_identification(\"adt\", \"u\", \"v\", date, 0.002)" |
| 112 | + "date = datetime(2016, 5, 15)\na, c = g.eddy_identification(\"adt\", \"u\", \"v\", date, 0.002, shape_error=55)" |
113 | 113 | ]
|
114 | 114 | },
|
115 | 115 | {
|
|
152 | 152 | "cell_type": "markdown",
|
153 | 153 | "metadata": {},
|
154 | 154 | "source": [
|
155 |
| - "Contours reject from several origin (shape error to high, several extremum in contour, ...)\n\n" |
| 155 | + "## Post analyse\nContours reject from several origin (shape error to high, several extremum in contour, ...)\n\n" |
156 | 156 | ]
|
157 | 157 | },
|
158 | 158 | {
|
|
166 | 166 | "ax = start_axes(\"ADT contour reject\")\ng.contours.display(ax, only_unused=True)\nupdate_axes(ax)"
|
167 | 167 | ]
|
168 | 168 | },
|
| 169 | + { |
| 170 | + "cell_type": "markdown", |
| 171 | + "metadata": {}, |
| 172 | + "source": [ |
| 173 | + "Contours reject criterion\n\n0. - Accepted (green)\n1. - Reject for shape error (red)\n2. - Masked value in contour (blue)\n3. - Under or over pixel limit bound (black)\n4. - Amplitude criterion (yellow)\n\n" |
| 174 | + ] |
| 175 | + }, |
| 176 | + { |
| 177 | + "cell_type": "code", |
| 178 | + "execution_count": null, |
| 179 | + "metadata": { |
| 180 | + "collapsed": false |
| 181 | + }, |
| 182 | + "outputs": [], |
| 183 | + "source": [ |
| 184 | + "ax = start_axes(\"Contour reject criterion\")\ng.contours.display(ax, only_unused=True, lw=0.25, display_criterion=True)\nupdate_axes(ax)" |
| 185 | + ] |
| 186 | + }, |
| 187 | + { |
| 188 | + "cell_type": "markdown", |
| 189 | + "metadata": {}, |
| 190 | + "source": [ |
| 191 | + "Display shape error of each tested contour, the limit of shape error is set to 55 %\n\n" |
| 192 | + ] |
| 193 | + }, |
| 194 | + { |
| 195 | + "cell_type": "code", |
| 196 | + "execution_count": null, |
| 197 | + "metadata": { |
| 198 | + "collapsed": false |
| 199 | + }, |
| 200 | + "outputs": [], |
| 201 | + "source": [ |
| 202 | + "ax = start_axes(\"Contour shape error\")\nm = g.contours.display(\n ax, lw=0.5, field=\"shape_error\", bins=arange(20, 90.1, 5), cmap=\"seismic\"\n)\nupdate_axes(ax, m)" |
| 203 | + ] |
| 204 | + }, |
169 | 205 | {
|
170 | 206 | "cell_type": "markdown",
|
171 | 207 | "metadata": {},
|
|
188 | 224 | "cell_type": "markdown",
|
189 | 225 | "metadata": {},
|
190 | 226 | "source": [
|
191 |
| - "Output\n------\nDisplay detected eddies, dashed lines represent effective contour\nand solid lines represent contour of maximum of speed. See figure 1 of https://doi.org/10.1175/JTECH-D-14-00019.1\n\n" |
| 227 | + "## Output\nDisplay detected eddies, dashed lines represent effective contour\nand solid lines represent contour of maximum of speed. See figure 1 of https://doi.org/10.1175/JTECH-D-14-00019.1\n\n" |
192 | 228 | ]
|
193 | 229 | },
|
194 | 230 | {
|
|
219 | 255 | "source": [
|
220 | 256 | "ax = start_axes(\"Eddies speed radius (km)\")\na.scatter(ax, \"radius_s\", vmin=10, vmax=50, s=80, ref=-10, cmap=\"jet\", factor=0.001)\nm = c.scatter(ax, \"radius_s\", vmin=10, vmax=50, s=80, ref=-10, cmap=\"jet\", factor=0.001)\nupdate_axes(ax, m)"
|
221 | 257 | ]
|
| 258 | + }, |
| 259 | + { |
| 260 | + "cell_type": "markdown", |
| 261 | + "metadata": {}, |
| 262 | + "source": [ |
| 263 | + "Display speed radius of eddies detected\n\n" |
| 264 | + ] |
| 265 | + }, |
| 266 | + { |
| 267 | + "cell_type": "code", |
| 268 | + "execution_count": null, |
| 269 | + "metadata": { |
| 270 | + "collapsed": false |
| 271 | + }, |
| 272 | + "outputs": [], |
| 273 | + "source": [ |
| 274 | + "ax = start_axes(\"Eddies speed radius (km)\")\na.filled(\n ax, \"radius_e\", vmin=10, vmax=80, cmap=\"magma_r\", factor=0.001, lut=14, ref=-10\n)\nm = c.filled(\n ax, \"radius_e\", vmin=10, vmax=80, cmap=\"magma_r\", factor=0.001, lut=14, ref=-10\n)\nupdate_axes(ax, m)" |
| 275 | + ] |
222 | 276 | }
|
223 | 277 | ],
|
224 | 278 | "metadata": {
|
|
0 commit comments