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