py_eddy_tracker.observations.network.NetworkObservations¶
-
class
py_eddy_tracker.observations.network.
NetworkObservations
(*args, **kwargs)[source]¶ Bases:
py_eddy_tracker.observations.groups.GroupEddiesObservations
Methods
add_fields
Add a new field.
add_rotation_type
align_on
Align the time indexes of two datasets.
append
Merge.
basic_formula_ellips_major_axis
Give major axis in km with a given latitude
bins_stat
- param str,array xname
variable to compute stats on
box_display
Return value evenly spaced with few numbers
build_var_list
circle_contour
Set contours as a circles from radius and center data.
Get close network from another atlas.
coherence
Check coherence between two datasets.
compare_units
concatenate
create dictionnary for each segments, gives the segments which interact with
contains
Return index of contour which contain (x,y)
copy
copy_data_to_zarr
Copy with buffer for zarr.
transform event where segment A split to B, then A merge into B
cost_function
Return the cost function between two obs.
cost_function_common_area
How does it work on x bound ?
create_variable
create_variable_zarr
display
Plot the speed and effective (dashed) contour of the eddies
Plot a timeline of a network.
Dissociate network with no known interaction (spliting/merging)
distance
Use haversine distance for distance matrix between every self and other eddies.
Add the merging and splitting events
mark events in plot
extract_with_area
Extract geographically with a bounding box.
Extract a subset of observations.
Extract within a time period
field_table
Produce description table of the fields available in this object
filled
- param matplotlib.axes.Axes ax
matplotlib axe used to draw
filled_by_interpolation
Filled selected values by interpolation
find all observations where obs i_observation could be in future or past.
find all relative segments within an event from an order.
first_obs
Get first obs of each trajectory.
function used after ‘insert_virtual’, to correct next_obs and previous obs.
fixed_ellipsoid_mask
format_label
from_netcdf
Build a NetworkObservations object with Group dataset and indexes
from_zarr
get_color
Return colors like a cyclic list
get_infos
find indices where observations is missing.
grid_box_stat
Get percentile of eddies in each bin
grid_count
Count the eddies in each bin (use all pixels in each contour)
grid_stat
Return the mean of the eddies’ variable in each bin
hist
Build histograms.
index
Return obs from self at the index.
insert_observations
Insert other obs in self at the index.
insert_virtual
insert virtual observation on segments where observations were not found
inside
True for each point inside the effective contour of an eddy
intern
interp_grid
Interpolate a grid on a center or contour with mean, min or max method
is_convex
Get flag of the eddy’s convexity
iter_on
Yield observation group for each bin.
keep_tracks_by_date
Find tracks which exist at date date and lasted at least nb_days after.
last_obs
Get Last obs of each trajectory.
load_file
Load the netcdf or the zarr file.
load_from_netcdf
Load data from netcdf.
load_from_zarr
Load data from zarr.
Select network on time duration
transform data y with method method for each track.
mask_from_polygons
Return mask for all observation in one of polygons list
mask_function
match
Return index and score computed on the effective contour.
merge
Merge two datasets.
merge_filters
Compute an intersection between all filters after to evaluate each of them
Return observation after a merging event.
needed_variable
netcdf_create_dimensions
Return slice for one network
new_like
Normalize all longitude
New numbering of network
New numbering of segment
obs_dimension
Raise a warning or error? if there are more than one network
parse_varname
This function will draw path of each trajectory
post_process_link
propagate
Filled virtual obs (C).
re_reference_index
Shift index with ref
Extract the segments at a certain order from one observation.
Extract the segments at a certain order from multiple observations.
Remove short segment which didn’t connect several segment
remove_fields
Copy with fields listed remove
reset
This function will scatter the path of each network, with the merging and splitting events
Must be call on only one network
Compute the relative order of each segment to the chosen segment
set_global_attr_netcdf
set_global_attr_zarr
shifted_ellipsoid_degrees_mask
solve_conflict
solve_first
solve_function
solve_simultaneous
Write something (TODO)
sort observations
Return observation before a splitting event.
time_sub_sample
Time sub sampling
to_netcdf
to_zarr
tracking
Track obs between self and other
write_file
Write a netcdf or zarr with eddy obs.
zarr_dimension
Attributes
COLORS
ELEMENTS
NB_COLORS
array_variables
dtype
Return dtype to build numpy array.
Return all the names of the variables.
global_attr
nb_days
Return period days cover by dataset
obs
Return observations.
observations
only_variables
period
Give the time coverage.
period_
raw_data
Return a unique segment id when multiple networks are considered
shape
sign_legend
sign_type
track_array_variables
track_extra_variables
tracks
-
NOGROUP
= 0¶
-
close_network
(other, nb_obs_min=10, **kwargs)[source]¶ Get close network from another atlas.
- Parameters
- Returns
return other atlas reduce to common track with self
Warning
It could be a costly operation for huge dataset
-
connexions
(multi_network=False)[source]¶ create dictionnary for each segments, gives the segments which interact with
-
correct_close_events
(nb_days_max=20)[source]¶ transform event where segment A split to B, then A merge into B
to
segment A split to B, then B merge to A
these events are filtered with nb_days_max, which the event have to take place in less than nb_days_max
- Parameters
nb_days_max (float) – maximum time to search for splitting-merging event
-
display_timeline
(ax, event=True, field=None, method=None, factor=1, colors_mode='roll', **kwargs)[source]¶ Plot a timeline of a network. Must be called on only one network.
- Parameters
ax (matplotlib.axes.Axes) – matplotlib axe used to draw
event (bool) – if True, draw the splitting and merging events
field (str,array) – yaxis values, if None, segments are used
method (str) – if None, mean values are used
factor (float) – to multiply field
colors_mode (str) – color of lines. “roll” means looping through colors, “y” means color adapt the y values (for matching color plots)
- Returns
plot mappable
-
property
elements
¶ Return all the names of the variables.
-
event_timeline
(ax, field=None, method=None, factor=1, colors_mode='roll')[source]¶ mark events in plot
-
extract_with_mask
(mask)[source]¶ Extract a subset of observations.
- Parameters
mask (array(bool)) – mask to select observations
- Returns
same object with selected observations
- Return type
self
-
extract_with_period
(period)[source]¶ Extract within a time period
-
find_link
(i_observations, forward=True, backward=False)[source]¶ find all observations where obs i_observation could be in future or past.
if forward=True, search all observation where water from obs “i_observation” could go
if backward=True, search all observation where water from obs i_observation could come from
-
find_segments_relative
(obs, stopped=None, order=1)[source]¶ find all relative segments within an event from an order.
- Parameters
- Returns
all segments relatives
- Return type
-
fix_next_previous_obs
()[source]¶ function used after ‘insert_virtual’, to correct next_obs and previous obs.
-
classmethod
from_split_network
(group_dataset, indexs, **kwargs)[source]¶ Build a NetworkObservations object with Group dataset and indexes
- Parameters
group_dataset (TrackEddiesObservations) – Group dataset
indexs – result from split_network
return NetworkObservations
-
get_missing_indices
(dt)[source]¶ find indices where observations is missing.
- As network have all untrack observation in tracknumber self.NOGROUP,
we don’t compute them
-
property
index_network
¶
-
map_network
(method, y, same=True, return_dict=False, **kw)[source]¶ transform data y with method method for each track.
- Parameters
- Returns
array or dict of result from method for each network
-
merging_event
(triplet=False, only_index=False)[source]¶ Return observation after a merging event.
If triplet=True return the eddy after a merging event, the eddy before the merging event, and the eddy stopped due to merging.
-
network_slice
(id_network)[source]¶ Return slice for one network
- Parameters
id_network (int) – id to identify network
-
normalize_longitude
()[source]¶ Normalize all longitude
Normalize longitude field and in the same range : - longitude_max - contour_lon_e (how to do if in raw) - contour_lon_s (how to do if in raw)
-
plot
(ax, ref=None, color_cycle=None, **kwargs)[source]¶ This function will draw path of each trajectory
- Parameters
ax (matplotlib.axes.Axes) – ax to draw
ref (float,int) – if defined, all coordinates will be wrapped with ref like west boundary
kwargs (dict) – keyword arguments for Axes.plot
- Returns
a list of matplotlib mappables
-
relative
(i_obs, order=2, direct=True, only_past=False, only_future=False)[source]¶ Extract the segments at a certain order from one observation.
- Parameters
- Returns
all segments relatives
- Return type
-
relatives
(obs, order=2, direct=True, only_past=False, only_future=False)[source]¶ Extract the segments at a certain order from multiple observations.
- Parameters
- Returns
all segments relatives
- Return type
-
remove_dead_end
(nobs=3, ndays=0, recursive=0, mask=None)[source]¶ Remove short segment which didn’t connect several segment
- Parameters
Warning
It will remove short segment which splits than merges with same segment
-
scatter
(ax, name='time', factor=1, ref=None, edgecolor_cycle=None, **kwargs)[source]¶ This function will scatter the path of each network, with the merging and splitting events
- Parameters
ax (matplotlib.axes.Axes) – matplotlib axe used to draw
name (str,array,None) – variable used to fill the contour, if None all elements have the same color
factor (float) – multiply value by
edgecolor_cycle (list) – list of colors
kwargs (dict) – look at
matplotlib.axes.Axes.scatter()
- Returns
a dict of scattered mappables
-
scatter_timeline
(ax, name, factor=1, event=True, yfield=None, yfactor=1, method=None, **kwargs)[source]¶ Must be call on only one network
-
segment_relative_order
(seg_origine)[source]¶ Compute the relative order of each segment to the chosen segment
-
property
segment_track_array
¶ Return a unique segment id when multiple networks are considered
-
sort
(order=('track', 'segment', 'time'))[source]¶ sort observations
- Parameters
order (tuple) – order or sorting. Passed to np.argsort