from py_eddy_tracker import start_logger start_logger().setLevel('DEBUG') # Available options: ERROR, WARNING, INFO, DEBUG grid_name, lon_name, lat_name = ( "X:\MasterStudent_HY\Some data\Simulated SWOT data\SWOT_L2_LR_SSH_Expert_266_008_20150101T003140_20150101T012245_DG10_01.nc", "longitude", "latitude", ) from datetime import datetime from py_eddy_tracker.dataset.grid import UnRegularGridDataset h = UnRegularGridDataset(grid_name, lon_name, lat_name) date = datetime(2015, 1, 1) a, c = h.eddy_identification( 'ssha_karin', # Variables used for identification date, # Date of identification 0.002, # step between two isolines of detection (m) pixel_limit=(8, 1000), # Min and max pixel count for valid contour shape_error=55, # Error max (%) between ratio of circle fit and contour ) from matplotlib import pyplot as plt import cartopy.crs as ccrs fig = plt.figure(figsize=(15,7)) ax = fig.add_axes([.03,.03,.94,.94]) ax = fig.add_subplot(1, 1, 1,projection=ccrs.PlateCarree()) ax.coastlines() ax.set_title('Eddies detected -- Cyclonic(red) and Anticyclonic(blue)') ax.set_ylim(-5,35) ax.set_xlim(105,135) ax.set_aspect('equal') a.display(ax, label="Anticyclonic ({nb_obs} eddies)",color='b', linewidth=1) c.display(ax, label="cyclonic ({nb_obs} eddies)",color='r', linewidth=1) ax.legend(loc="upper left") ax.grid() ax.gridlines(draw_labels=True, xlocs=[105,110,115,120,125,130,135]) plt.show() print(a) print(c) import netCDF4 as nc with nc.Dataset(date.strftime('X:/MasterStudent_HY/Some data/Simulated SWOT data/Anticyclonic_%Y%m%d.nc'), 'w') as h: a.to_netcdf(h) with nc.Dataset(date.strftime('X:/MasterStudent_HY/Some data/Simulated SWOT data/Cyclonic_%Y%m%d.nc'), 'w') as h: c.to_netcdf(h)