|
| 1 | +from matplotlib import pyplot as plt |
| 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' |
| 4 | +if False: |
| 5 | + |
| 6 | + h = RegularGridDataset(grid_name, lon_name, lat_name) |
| 7 | + |
| 8 | + fig = plt.figure(figsize=(14, 12)) |
| 9 | + ax = fig.add_axes([.02, .51, .9, .45]) |
| 10 | + ax.set_title('ADT (m)') |
| 11 | + ax.set_ylim(-75, 75) |
| 12 | + ax.set_aspect('equal') |
| 13 | + m = h.display(ax, name='adt', vmin=-1, vmax=1) |
| 14 | + ax.grid(True) |
| 15 | + plt.colorbar(m, cax=fig.add_axes([.94, .51, .01, .45])) |
| 16 | + 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') |
| 21 | + ax.set_ylim(-75, 75) |
| 22 | + m = h.display(ax, name='adt', vmin=-.1, vmax=.1) |
| 23 | + ax.grid(True) |
| 24 | + plt.colorbar(m, cax=fig.add_axes([.94, .02, .01, .45])) |
| 25 | + fig.savefig('png/filter.png') |
| 26 | + |
| 27 | +if True: |
| 28 | + import logging |
| 29 | + logging.getLogger().setLevel('DEBUG') # Values: ERROR, WARNING, INFO, DEBUG |
| 30 | + from datetime import datetime |
| 31 | + h = RegularGridDataset(grid_name, lon_name, lat_name) |
| 32 | + h.bessel_high_filter('adt', 500, order=3) |
| 33 | + # h.bessel_high_filter('adt', 300, order=1) |
| 34 | + date = datetime(2019, 2, 23) |
| 35 | + 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) |
| 39 | + # 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) |
| 52 | + ax.grid() |
| 53 | + fig.savefig('png/eddies.png') |
0 commit comments