Skip to content

Commit 6f095ba

Browse files
author
adelepoulle
committed
merge
2 parents a2af2e7 + 3161c05 commit 6f095ba

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/py_eddy_tracker/property_functions.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@ def _fit_circle_path(self):
347347
c_x, c_y = proj(self.lon, self.lat)
348348
try:
349349
centlon_e, centlat_e, eddy_radius_e, aerr = fit_circle_c(c_x, c_y)
350+
centlon_e, centlat_e = proj(centlon_e, centlat_e, inverse=True)
351+
centlon_e = (centlon_e - lon_mean + 180) % 360 + lon_mean - 180
352+
self._circle_params = centlon_e, centlat_e, eddy_radius_e, aerr
350353
except ZeroDivisionError:
351354
# Some time, edge is only a dot of few coordinates
352355
if len(unique(self.lon)) == 1 and len(unique(self.lat)) == 1:
@@ -355,10 +358,6 @@ def _fit_circle_path(self):
355358
self.lat)
356359
self._circle_params = 0, -90, nan, nan
357360

358-
centlon_e, centlat_e = proj(centlon_e, centlat_e, inverse=True)
359-
centlon_e = (centlon_e - lon_mean + 180) % 360 + lon_mean - 180
360-
self._circle_params = centlon_e, centlat_e, eddy_radius_e, aerr
361-
362361
BasePath.fit_circle = fit_circle_path
363362
BasePath._fit_circle_path = _fit_circle_path
364363

@@ -371,8 +370,6 @@ def collection_loop(contours, grd, rtime, eddy,
371370
if eddy.diagnostic_type not in ['Q', 'SLA']:
372371
raise Exception('Unknown Diagnostic : %s' % eddy.diagnostic_type)
373372

374-
has_ts = False
375-
376373
sign_type = eddy.sign_type
377374
anticyclonic_search = 'Anticyclonic' in sign_type
378375
iterator = 1 if anticyclonic_search else -1
@@ -551,8 +548,8 @@ def collection_loop(contours, grd, rtime, eddy,
551548
contlon_s, contlat_s,
552549
fixed_size=eddy.track_array_variables_sampling)
553550

554-
if not has_ts: # for AVISO
555-
eddy.update_eddy_properties(properties)
551+
# for AVISO
552+
eddy.update_eddy_properties(properties)
556553

557554
# Mask out already found eddies
558555
eddy.sla[eddy.slice_j, eddy.slice_i][

src/scripts/EddyIdentification

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ from py_eddy_tracker.grid.aviso import AvisoGrid
4343
from py_eddy_tracker.tracking_objects import IdentificationList
4444

4545

46-
def circle_process(paths):
47-
nb_proc = 4
48-
def fit_circle_path(item):
49-
item._fit_circle_path()
50-
threads = Pool(nb_proc)
51-
threads.map(fit_circle_path, paths)
52-
5346
if __name__ == '__main__':
5447
# Run using:
5548
PARSER = EddyParser("Tool to detect eddies. "
@@ -67,9 +60,9 @@ if __name__ == '__main__':
6760

6861
# Setup configuration
6962
SAVE_DIR = CONFIG['PATHS']['SAVE_DIR']
63+
logging.info('Outputs saved to %(SAVE_DIR)s', CONFIG['PATHS'])
7064
if not exists(SAVE_DIR):
7165
mkdir(SAVE_DIR)
72-
logging.info('Outputs saved to %(SAVE_DIR)s', CONFIG['PATHS'])
7366

7467
DIAGNOSTIC_TYPE = CONFIG['DIAGNOSTIC_TYPE']
7568
if DIAGNOSTIC_TYPE not in ['SLA']:
@@ -126,7 +119,8 @@ if __name__ == '__main__':
126119
GRID_NAME = CONFIG['DATASET']['VAR_NAME']
127120
LAT_NAME = CONFIG['DATASET']['LAT_NAME']
128121
LON_NAME = CONFIG['DATASET']['LON_NAME']
129-
122+
123+
logging.info('Search files : %s', DATA_DIR + FILES_MODEL)
130124
DATASET_FILES = glob(DATA_DIR + FILES_MODEL)
131125

132126
DATASET_LIST = array(DATASET_FILES,
@@ -142,6 +136,7 @@ if __name__ == '__main__':
142136
item['date'] = datetime.strptime(str_date, PATTERN_DATE).date()
143137

144138
DATASET_LIST.sort(order=['date', 'filename'])
139+
logging.info('Filtering grid by time %s, %s', START_DATE, END_DATE)
145140
MASK_DATE = (DATASET_LIST['date'] >= START_DATE) * (
146141
DATASET_LIST['date'] <= END_DATE)
147142

0 commit comments

Comments
 (0)