Observations

py-eddy-tracker is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

py-eddy-tracker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.

Copyright (c) 2014-2017 by Evan Mason and Antoine Delepoulle Email: emason@imedea.uib-csic.es ===========================================================================

observation.py

Version 3.0.0


class py_eddy_tracker.observations.observation.EddiesObservations(size=0, track_extra_variables=None, track_array_variables=0, array_variables=None, only_variables=None, raw_data=False)[source]

Bases: object

Class to hold eddy properties amplitude and counts of local maxima/minima within a closed region of a sea level anomaly field.

ELEMENTS = ['lon', 'lat', 'radius_s', 'radius_e', 'amplitude', 'speed_average', 'time', 'shape_error_e', 'shape_error_s', 'nb_contour_selected', 'num_point_e', 'num_point_s', 'height_max_speed_contour', 'height_external_contour', 'height_inner_contour']
add_fields(fields)[source]

Add a new field

add_rotation_type()[source]
append(other)[source]

Merge

array_variables
static basic_formula_ellips_major_axis(lats, cmin=1.5, cmax=10.0, c0=1.5, lat1=13.5, lat2=5.0, degrees=False)[source]

Give major axis in km with a given latitude

circle_contour()[source]
coherence(other)[source]

Check coherence between two dataset

classmethod concatenate(observations)[source]
static cost_function(records_in, records_out, distance)[source]
classmethod cost_function_common_area(xy_in, xy_out, distance, intern=False)[source]

How does it work on x bound ?

Parameters:
  • xy_in
  • xy_out
  • distance
  • intern (bool) –
create_variable(handler_nc, kwargs_variable, attr_variable, data, scale_factor=None, add_offset=None, **kwargs)[source]
create_variable_zarr(handler_zarr, kwargs_variable, attr_variable, data, scale_factor=None, add_offset=None, filters=None, compressor=None)[source]
display(ax, ref=None, extern_only=False, intern_only=False, nobs=True, **kwargs)[source]
distance(other)[source]

Use haversine distance for distance matrix between every self and other eddies

dtype

Return dtype to build numpy array

elements

Return all variable name

fixed_ellipsoid_mask(other, minor=50, major=100, only_east=False, shifted_ellips=False)[source]
classmethod from_netcdf(handler)[source]
classmethod from_zarr(handler)[source]
global_attr
grid_count(bins, intern=False, center=False)[source]
grid_stat(bins, varname)[source]
index(index, reverse=False)[source]

Return obs from self at the index

insert_observations(other, index)[source]

Insert other obs in self at the index

static intern(flag, public_label=False)[source]
latitude
classmethod load_file(filename, **kwargs)[source]
classmethod load_from_netcdf(filename, raw_data=False, remove_vars=None, include_vars=None)[source]
classmethod load_from_zarr(filename, raw_data=False, remove_vars=None, include_vars=None)[source]
longitude
mask_function(other, distance)[source]
match(other, intern=False, cmin=0)[source]

return index and score compute with area

merge(other)[source]

Merge two dataset

static netcdf_create_dimensions(handler, dim, nb)[source]
static new_like(eddies, new_size)[source]
obs

return an array observations

classmethod obs_dimension(handler)[source]
observation_number
observations
only_variables
propagate(previous_obs, current_obs, obs_to_extend, dead_track, nb_next, model)[source]

Filled virtual obs (C)

Parameters:
  • previous_obs – previous obs from current (A)
  • current_obs – previous obs from virtual (B)
  • obs_to_extend
  • dead_track
  • nb_next
  • model
Returns:

New position C = B + AB

raw_data
reset()[source]
scatter(ax, name, ref=None, factor=1, **kwargs)[source]
set_global_attr_netcdf(h_nc)[source]
set_global_attr_zarr(h_zarr)[source]
shape
shifted_ellipsoid_degrees_mask(other, minor=1.5, major=1.5)[source]
sign_legend
sign_type
static solve_conflict(cost)[source]
static solve_first(cost, multiple_link=False)[source]
solve_function(cost_matrix)[source]
static solve_simultaneous(cost)[source]
time
to_netcdf(handler, **kwargs)[source]
to_zarr(handler, **kwargs)[source]
track_array_variables
track_extra_variables
tracking(other)[source]

Track obs between self and other

tracks
write_file(path='./', filename='%(path)s/%(sign_type)s.nc', zarr_flag=False)[source]

Write a netcdf with eddy obs

static zarr_dimension(filename)[source]
class py_eddy_tracker.observations.observation.VirtualEddiesObservations(size=0, track_extra_variables=None, track_array_variables=0, array_variables=None, only_variables=None, raw_data=False)[source]

Bases: py_eddy_tracker.observations.observation.EddiesObservations

Class to work with virtual obs

elements

Return all variable name

py_eddy_tracker.observations.observation.grid_count_[source]
py_eddy_tracker.observations.observation.shifted_ellipsoid_degrees_mask2[source]

work only if major is an array but faster * 6

py-eddy-tracker is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

py-eddy-tracker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.

Copyright (c) 2014-2017 by Evan Mason and Antoine Delepoulle Email: emason@imedea.uib-csic.es ===========================================================================

tracking.py

Version 3.0.0


class py_eddy_tracker.observations.tracking.TrackEddiesObservations(*args, **kwargs)[source]

Bases: py_eddy_tracker.observations.observation.EddiesObservations

Class to practice Tracking on observations

ELEMENTS = ['lon', 'lat', 'radius_s', 'radius_e', 'amplitude', 'speed_average', 'time', 'shape_error_e', 'shape_error_s', 'nb_contour_selected', 'num_point_e', 'num_point_s', 'height_max_speed_contour', 'height_external_contour', 'height_inner_contour', 'cost_association']
NOGROUP = 0
compute_index()[source]
elements

Return all variable name

extract_first_obs_in_box(res)[source]
extract_ids(tracks)[source]
extract_in_direction(direction, value=0)[source]
extract_longer_eddies(nb_min, nb_obs, compress_id=True)[source]

Select eddies which are longer than nb_min

extract_with_area(area, **kwargs)[source]

Extract with a bounding box

Parameters:area (dict) – 4 coordinates in a dictionary to specify bounding box (lower left corner and upper right corner)
extract_with_length(bounds)[source]
extract_with_period(period, **kwargs)[source]

Extract with a period

Parameters:period ((datetime.datetime,datetime.datetime)) – two date to define period, must be specify from 1/1/1950
Returns:same object with selected data
filled_by_interpolation(mask)[source]

Filled selected values by interpolation

classmethod follow_obs(i_next, track_id, used, ids, *args)[source]
get_mask_from_id(tracks)[source]
index_from_track
loess_filter(half_window, xfield, yfield, inplace=True)[source]
median_filter(half_window, xfield, yfield, inplace=True)[source]
nb_obs_by_track
static next_obs(i_current, ids, polygons, time_s, time_e, time_ref, window)[source]
period

Give time coverage Returns: 2 date

plot(ax, ref=None, **kwargs)[source]
position_filter(median_half_window, loess_half_window)[source]
set_global_attr_netcdf(h_nc)[source]

Set global attr

set_tracks(x, y, ids, window)[source]
split_network(intern=True, **kwargs)[source]

Divide each group in track

py_eddy_tracker.observations.tracking.compute_index[source]
py_eddy_tracker.observations.tracking.compute_mask_from_id[source]
py_eddy_tracker.observations.tracking.track_loess_filter[source]

Apply a loess filter on y field

Parameters:
  • window (int,float) – parameter of smoother
  • x (array_like) – must be growing for each track but could be irregular
  • y (array_like) – field to smooth
  • track (array_like) – field which allow to separate path
Returns:

Array smoothed

Return type:

array_like

py_eddy_tracker.observations.tracking.track_median_filter[source]

Apply a loess filter on y field

Parameters:
  • half_window (int,float) – parameter of smoother
  • x (array_like) – must be growing for each track but could be irregular
  • y (array_like) – field to smooth
  • track (array_like) – field which allow to separate path
Returns:

Array smoothed

Return type:

array_like