|
6 | 6 | "longitude",
|
7 | 7 | "latitude",
|
8 | 8 | )
|
9 |
| -if False: |
10 | 9 |
|
11 |
| - h = RegularGridDataset(grid_name, lon_name, lat_name) |
| 10 | +h = RegularGridDataset(grid_name, lon_name, lat_name) |
12 | 11 |
|
13 |
| - fig = plt.figure(figsize=(14, 12)) |
14 |
| - ax = fig.add_axes([0.02, 0.51, 0.9, 0.45]) |
15 |
| - ax.set_title("ADT (m)") |
16 |
| - ax.set_ylim(-75, 75) |
17 |
| - ax.set_aspect("equal") |
18 |
| - m = h.display(ax, name="adt", vmin=-1, vmax=1) |
19 |
| - ax.grid(True) |
20 |
| - plt.colorbar(m, cax=fig.add_axes([0.94, 0.51, 0.01, 0.45])) |
21 |
| - h = RegularGridDataset(grid_name, lon_name, lat_name) |
22 |
| - h.bessel_high_filter("adt", 500, order=3) |
23 |
| - ax = fig.add_axes([0.02, 0.02, 0.9, 0.45]) |
24 |
| - ax.set_title("ADT Filtered (m)") |
25 |
| - ax.set_aspect("equal") |
26 |
| - ax.set_ylim(-75, 75) |
27 |
| - m = h.display(ax, name="adt", vmin=-0.1, vmax=0.1) |
28 |
| - ax.grid(True) |
29 |
| - plt.colorbar(m, cax=fig.add_axes([0.94, 0.02, 0.01, 0.45])) |
30 |
| - fig.savefig("png/filter.png") |
| 12 | +fig = plt.figure(figsize=(14, 12)) |
| 13 | +ax = fig.add_axes([0.02, 0.51, 0.9, 0.45]) |
| 14 | +ax.set_title("ADT (m)") |
| 15 | +ax.set_ylim(-75, 75) |
| 16 | +ax.set_aspect("equal") |
| 17 | +m = h.display(ax, name="adt", vmin=-1, vmax=1) |
| 18 | +ax.grid(True) |
| 19 | +plt.colorbar(m, cax=fig.add_axes([0.94, 0.51, 0.01, 0.45])) |
| 20 | +h = RegularGridDataset(grid_name, lon_name, lat_name) |
| 21 | +h.bessel_high_filter("adt", 500, order=3) |
| 22 | +ax = fig.add_axes([0.02, 0.02, 0.9, 0.45]) |
| 23 | +ax.set_title("ADT Filtered (m)") |
| 24 | +ax.set_aspect("equal") |
| 25 | +ax.set_ylim(-75, 75) |
| 26 | +m = h.display(ax, name="adt", vmin=-0.1, vmax=0.1) |
| 27 | +ax.grid(True) |
| 28 | +plt.colorbar(m, cax=fig.add_axes([0.94, 0.02, 0.01, 0.45])) |
| 29 | +fig.savefig("png/filter.png") |
31 | 30 |
|
32 |
| -if True: |
33 |
| - import logging |
34 | 31 |
|
35 |
| - logging.getLogger().setLevel("DEBUG") # Values: ERROR, WARNING, INFO, DEBUG |
36 |
| - from datetime import datetime |
| 32 | +import logging |
37 | 33 |
|
38 |
| - h = RegularGridDataset(grid_name, lon_name, lat_name) |
39 |
| - h.bessel_high_filter("adt", 500, order=3) |
40 |
| - # h.bessel_high_filter('adt', 300, order=1) |
41 |
| - date = datetime(2019, 2, 23) |
42 |
| - a, c = h.eddy_identification( |
43 |
| - "adt", |
44 |
| - "ugos", |
45 |
| - "vgos", # Variable to use for identification |
46 |
| - date, # Date of identification |
47 |
| - 0.002, # step between two isolines of detection (m) |
48 |
| - # 0.02, # step between two isolines of detection (m) |
49 |
| - pixel_limit=(5, 2000), # Min and max of pixel can be include in contour |
50 |
| - shape_error=55, # Error maximal of circle fitting over contour to be accepted |
51 |
| - ) |
52 |
| - fig = plt.figure(figsize=(15, 7)) |
53 |
| - ax = fig.add_axes([0.03, 0.03, 0.94, 0.94]) |
54 |
| - ax.set_title("Eddies detected -- Cyclonic(red) and Anticyclonic(blue)") |
55 |
| - ax.set_ylim(-75, 75) |
56 |
| - ax.set_xlim(0, 360) |
57 |
| - ax.set_aspect("equal") |
58 |
| - a.display(ax, color="b", linewidth=0.5) |
59 |
| - c.display(ax, color="r", linewidth=0.5) |
60 |
| - ax.grid() |
61 |
| - fig.savefig("png/eddies.png") |
| 34 | +logging.getLogger().setLevel("DEBUG") # Values: ERROR, WARNING, INFO, DEBUG |
| 35 | +from datetime import datetime |
| 36 | + |
| 37 | +h = RegularGridDataset(grid_name, lon_name, lat_name) |
| 38 | +h.bessel_high_filter("adt", 500, order=3) |
| 39 | +# h.bessel_high_filter('adt', 300, order=1) |
| 40 | +date = datetime(2019, 2, 23) |
| 41 | +a, c = h.eddy_identification( |
| 42 | + "adt", |
| 43 | + "ugos", |
| 44 | + "vgos", # Variable to use for identification |
| 45 | + date, # Date of identification |
| 46 | + 0.002, # step between two isolines of detection (m) |
| 47 | + # 0.02, # step between two isolines of detection (m) |
| 48 | + pixel_limit=(5, 2000), # Min and max of pixel can be include in contour |
| 49 | + shape_error=55, # Error maximal of circle fitting over contour to be accepted |
| 50 | +) |
| 51 | +fig = plt.figure(figsize=(15, 7)) |
| 52 | +ax = fig.add_axes([0.03, 0.03, 0.94, 0.94]) |
| 53 | +ax.set_title("Eddies detected -- Cyclonic(red) and Anticyclonic(blue)") |
| 54 | +ax.set_ylim(-75, 75) |
| 55 | +ax.set_xlim(0, 360) |
| 56 | +ax.set_aspect("equal") |
| 57 | +a.display(ax, color="b", linewidth=0.5) |
| 58 | +c.display(ax, color="r", linewidth=0.5) |
| 59 | +ax.grid() |
| 60 | +fig.savefig("png/eddies.png") |
0 commit comments