@@ -61,6 +61,11 @@ Filtering
6161h.bessel_high_filter(' adt' , 500 , order = 3 )
6262```
6363
64+ Save grid
65+ ``` python
66+ h.write(' /tmp/grid.nc' )
67+ ```
68+
6469Add second plot
6570``` python
6671ax = fig.add_axes([.03 , .02 , .9 , .45 ])
@@ -103,8 +108,8 @@ for name_area, area in areas.items():
103108 ax.loglog(* lon_spec, label = ' lon %s raw' % name_area, color = mappable.get_color(), linestyle = ' --' )
104109
105110 lon_spec, lat_spec = filtered.spectrum_lonlat(' adt' , area = area)
106- mappable = plt .loglog(* lat_spec, label = ' lat %s high' % name_area)[0 ]
107- plt .loglog(* lon_spec, label = ' lon %s high' % name_area, color = mappable.get_color(), linestyle = ' --' )
111+ mappable = ax .loglog(* lat_spec, label = ' lat %s high' % name_area)[0 ]
112+ ax .loglog(* lon_spec, label = ' lon %s high' % name_area, color = mappable.get_color(), linestyle = ' --' )
108113
109114ax.set_xscale(' log' )
110115ax.legend()
@@ -130,4 +135,51 @@ ax.legend()
130135ax.grid()
131136fig.savefig(' share/png/spectrum_ratio.png' )
132137```
133- ![ spectrum] ( share/png/spectrum_ratio.png )
138+ ![ spectrum ratio] ( share/png/spectrum_ratio.png )
139+
140+ #### Run an identification on a grid ####
141+
142+ Activate verbose
143+ ``` python
144+ import logging
145+ logging.getLogger().setLevel(' DEBUG' ) # Values: ERROR, WARNING, INFO, DEBUG
146+ ```
147+
148+ Run identification
149+ ``` python
150+ from datetime import datetime
151+ h = RegularGridDataset(grid_name, lon_name, lat_name)
152+ h.bessel_high_filter(' adt' , 500 , order = 3 )
153+ date = datetime(2019 , 2 , 23 )
154+ a, c = h.eddy_identification(
155+ ' adt' , ' ugosa' , ' vgosa' , # Variable to use for identification
156+ date, # Date of identification
157+ 0.002 , # step between two isolines of detection (m)
158+ pixel_limit = (5 , 2000 ), # Min and max of pixel can be include in contour
159+ shape_error = 55 , # Error maximal of circle fitting over contour to be accepted
160+ bbox_surface_min_degree = .125 ** 2 , # degrees surface minimal to take in account contour
161+ )
162+ ```
163+
164+ Plot identification
165+ ``` python
166+ fig = plt.figure(figsize = (14 ,8 ))
167+ ax = fig.add_axes([.03 ,.03 ,.94 ,.94 ])
168+ ax.set_title(' Eddies detected -- Cyclonic(red) and Anticyclonic(blue)' )
169+ ax.set_ylim(- 75 ,75 )
170+ ax.plot(a.obs[' contour_lon_s' ].T, a.obs[' contour_lat_s' ].T, ' b' , linewidth = .5 )
171+ ax.plot(c.obs[' contour_lon_s' ].T, c.obs[' contour_lat_s' ].T, ' r' , linewidth = .5 )
172+ ax.legend()
173+ ax.grid()
174+ fig.savefig(' share/png/eddies.png' )
175+ ```
176+
177+ ![ eddies detected] ( share/png/eddies.png )
178+
179+ Save identification datas
180+ ``` python
181+ with Dataset(date.strftime(' Anticyclonic_%Y%m%d .nc' ), ' w' ) as h:
182+ a.to_netcdf(h)
183+ with Dataset(date.strftime(' Cyclonic_%Y%m%d .nc' ), ' w' ) as h:
184+ c.to_netcdf(h)
185+ ```
0 commit comments