seaduck.lagrangian_budget#
- seaduck.lagrangian_budget.calculate_budget(particle_array, data_slice, rhs_list, prefetch_vector_kwarg={}, lhs_name='lhs', dir_of_time=-1)#
Calculate Lagrangian budget.
- Parameters:
particle_array (xr.Dataset) β A dataset generated by seaduck that contains the location and velocity info.
data_slice (xr.Dataset) β The ocean model (including budget terms) at a time step.
rhs_list (list) β List of strings for the variable names on the RHS
prefetch_vector_kwarg (dict) β Keyword arguments for reading wall concentration
lhs_name (String) β The name of variable that stands for eulerian tendency
dir_of_time (number) β -1 for backward, and 1 for forward.
- Returns:
contr_dic (dict of np.ndarray) β The contribution of each RHS term, has same length as number of entries.
trc_conc (np.ndarray) β Tracer concentration at each point.
first, last (np.ndarray) β Which indices mark the start and end of the time step for each particle.
- seaduck.lagrangian_budget.check_particle_data_compat(xrpt, xrslc, tp, use_tracer_name=None, wall_names=('sx', 'sy', 'sz'), conv_name='divus', debug=False, allclose_kwarg={})#
Check if you could use Lagrangian budget functionality.
- Parameters:
xrpt (xr.Dataset) β A dataset generated by seaduck that contains the location and velocity info.
xrslc (xr.Dataset) β The ocean model (including budget terms) at a time step.
tp (sd.Topology) β The topology object for the model
use_tracer_name (string) β if specified, use cx,cy,cz as wall name
wall_names (tuple of string) β Name of variables if use_tracer_name is not defined.
conv_name (string) β The variable from xrslc to be compared against.
debug (bool) β Whether to return additional debug information.
allclose_kwarg β Keyword arguments for np.allclose.
- Returns:
OK_or_not (bool) β Is it OK to preceed?
extra (None or tuple) β Extra information to help with debugging.
- seaduck.lagrangian_budget.contr_p_relaxed(deltas, tres, step_dic, termlist, p=1, error_prefix='')#
- seaduck.lagrangian_budget.crude_convergence(u_list)#
- seaduck.lagrangian_budget.deepcopy_inds(temp)#
- seaduck.lagrangian_budget.dump_to_zarr(neo, oce, filename, region_names=False, region_polys=None, preserve_checks=False)#
- seaduck.lagrangian_budget.fast_cumsum(shapes)#
- seaduck.lagrangian_budget.find_ind_frac_tres(neo, oce, region_names=False, region_polys=None, by_type=True)#
- seaduck.lagrangian_budget.first_last_neither(shapes, return_neither=True)#
- seaduck.lagrangian_budget.flatten(lstoflst, shapes=None)#
- seaduck.lagrangian_budget.ind_tend_uv(ind, tp)#
Return the index of the velocity node.
The node is not of the same index as the center point. iw determines where to return iw
- seaduck.lagrangian_budget.lhs_contribution(t, scalar_dic, last, lhs_name='lhs')#
- seaduck.lagrangian_budget.particle2xarray(p)#
- seaduck.lagrangian_budget.prefetch_scalar(ds_slc, scalar_names)#
- seaduck.lagrangian_budget.prefetch_vector(ds_slc, xname='sxprime', yname='syprime', zname='szprime', same_size=True)#
- seaduck.lagrangian_budget.pseudo_motion(pt)#
- seaduck.lagrangian_budget.pt_ulist(pt)#
- seaduck.lagrangian_budget.read_from_ds(particle_ds, oce)#
- seaduck.lagrangian_budget.read_prefetched_scalar(ind, scalar_names, prefetch)#
- seaduck.lagrangian_budget.read_wall_list(neo, tp, prefetch=None, scalar=True)#
- seaduck.lagrangian_budget.redo_index(pt)#
- seaduck.lagrangian_budget.residence_time(pt)#
- seaduck.lagrangian_budget.store_lists(pt, name, region_names=False, region_polys=None, **kwarg)#
- seaduck.lagrangian_budget.tres_fraction(temp, first, last, fraction_first, fraction_last)#
- seaduck.lagrangian_budget.tres_update(tres0, temp, first, last, fraction_first, fraction_last)#
- seaduck.lagrangian_budget.wall_index(inds, iwall, tp)#
- seaduck.lagrangian_budget.which_wall(pt)#