Skip to content

Commit 8183e84

Browse files
committed
Manage rotation type with global attr and not with a variable
1 parent dac75ea commit 8183e84

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
'pyyaml',
5252
'pyproj',
5353
'pint',
54+
'polygon3',
5455
'numba',
5556
],
5657
)

src/py_eddy_tracker/observations.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ def load_from_netcdf(cls, filename, raw_data=False):
274274
var_inv = VAR_DESCR_inv[variable]
275275
if var_inv == 'type_cyc':
276276
eddies.sign_type = h_nc.variables[variable][0]
277+
eddies.sign_type = getattr(h_nc, 'rotation_type', 0)
277278
if eddies.sign_type == 0:
278279
logging.debug('File come from another algorithm of identification')
279280
eddies.sign_type = -1
@@ -301,8 +302,7 @@ def from_netcdf(cls, handler):
301302
eddies.obs[VAR_DESCR_inv[variable]] = handler.variables[variable][:]
302303
return eddies
303304

304-
@staticmethod
305-
def propagate(previous_obs, current_obs, obs_to_extend, dead_track, nb_next, model):
305+
def propagate(self, previous_obs, current_obs, obs_to_extend, dead_track, nb_next, model):
306306
"""
307307
Filled virtual obs (C)
308308
Args:
@@ -321,6 +321,7 @@ def propagate(previous_obs, current_obs, obs_to_extend, dead_track, nb_next, mod
321321
track_extra_variables=model.track_extra_variables,
322322
track_array_variables=model.track_array_variables,
323323
array_variables=model.array_variables)
324+
next_obs.sign_type = self.sign_type
324325
nb_dead = len(previous_obs)
325326
nb_virtual_extend = nb_next - nb_dead
326327

@@ -349,9 +350,6 @@ def propagate(previous_obs, current_obs, obs_to_extend, dead_track, nb_next, mod
349350
return next_obs
350351

351352

352-
353-
354-
355353
@staticmethod
356354
def cost_function_common_area(xy_in, xy_out, distance, intern=False):
357355
""" How does it work on x bound ?
@@ -695,6 +693,7 @@ def set_global_attr_netcdf(self, h_nc):
695693
h_nc.comment = 'Surface product; mesoscale eddies'
696694
h_nc.framework_used = 'https://bitbucket.org/emason/py-eddy-tracker'
697695
h_nc.standard_name_vocabulary ='NetCDF Climate and Forecast (CF) Metadata Convention Standard Name Table'
696+
h_nc.rotation_type = self.sign_type
698697

699698
def display(self, ax, ref=None, **kwargs):
700699
if ref is None:

src/py_eddy_tracker/tracking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def recense_dead_id_to_extend(self):
263263
logging.debug('%d death of real obs in this step', nb_dead)
264264
if not self.virtual:
265265
return
266+
266267
# get id already dead from few time
267268
nb_virtual_extend = 0
268269
if self.virtual_obs is not None:
@@ -305,6 +306,7 @@ def load_state(self):
305306
# Load last virtual obs
306307
self.virtual_obs = VirtualEddiesObservations.from_netcdf(general_handler.groups['LastVirtualObs'])
307308
# Load and last previous virtual obs to be merge with current => will be previous2_obs
309+
# TODO : Need to rethink this line ??
308310
self.current_obs = self.current_obs.merge(
309311
VirtualEddiesObservations.from_netcdf(general_handler.groups['LastPreviousVirtualObs']))
310312
return first_dataset, flg_virtual

0 commit comments

Comments
 (0)