xwmb.budget module#
- class xwmb.budget.WaterMassBudget(grid, xbudget_dict, region=None, teos10=True, cp=3992.0, rho_ref=1035.0, method='default', rebin=False, decompose=[], assert_zero_transport=False)#
Bases:
WaterMassTransformationsAn extension of the WaterMass class that includes methods for WaterMass transformation analysis.
- add_bins_gridcoords(lambda_name, bin_edges)#
- add_default_gridcoords(lambda_name)#
- convergent_transport(lambda_name, greater_than=False, integrate=True, along_section=False)#
Lazily evaluates the convergent transport (diascalar overturning) term in the water mass budget
- Parameters:
lambda_name (str) – Specifies lambda (e.g., ‘heat’, ‘salt’, ‘sigma0’, etc.). Use lambdas() for a list of available lambdas.
greater_than (bool (default: False)) – Whether the budget should be for a water mass with tracer values “greater than” the threshold, or not (“less than” the threshold).
integrate (bool (default: True)) – Whether to integrate the in the (“X”, “Y”) dimensions
along_section (bool (default: False)) – Whether to include information about the along-section structure of convergent transports (with sectionate)
- Returns:
The convergent transport (diascalar overturning) term in the full water mass transformation budget
- Return type:
xr.DataArray
- mass_bounds(lambda_name, greater_than=False, integrate=True)#
Lazily evaluates snapshots (time “bounds”) of the water mass’ mass
- Parameters:
lambda_name (str) – Specifies lambda (e.g., ‘heat’, ‘salt’, ‘sigma0’, etc.). Use lambdas() for a list of available lambdas.
greater_than (bool (default: False)) – Whether the budget should be for a water mass with tracer values “greater than” the threshold, or not (“less than” the threshold).
integrate (bool (default: True)) – Whether to integrate the in the (“X”, “Y”) dimensions
- Return type:
None, but adds “mass_bounds” to the xr.Dataset self.wmt
- mass_budget(lambda_name, greater_than=False, integrate=True, along_section=False, bins=None, default_bins=None)#
Lazily evaluates the mass budget
- Parameters:
lambda_name (str) – Specifies lambda (e.g., ‘heat’, ‘salt’, ‘sigma0’, etc.). Use lambdas() for a list of available lambdas.
greater_than (bool (default: False)) – Whether the budget should be for a water mass with tracer values “greater than” the threshold, or not (“less than” the threshold).
integrate (bool (default: True)) – Whether to integrate the in the (“X”, “Y”) dimensions
along_section (bool (default: False)) – Whether to include information about the along-section structure of convergent transports (with sectionate)
bins (None or array (default: None)) – If None: assume lambda bins are already included in the dataset If array: must be a 1D np.ndarray of bin edges
default_bins (deprecated) – Deprecated parameter. Use bins instead. If True: call add_default_gridcoords to generate bins If False: corresponds to bins=None If list: corresponds to
bins=np.arange(*default_bins)
- Returns:
Contains all terms in the full water mass transformation budget
- Return type:
xr.Dataset
- transformations(lambda_name, greater_than=False, integrate=True)#
Lazily evaluates the water mass transformation terms in the budget
- Parameters:
lambda_name (str) – Specifies lambda (e.g., ‘heat’, ‘salt’, ‘sigma0’, etc.). Use lambdas() for a list of available lambdas.
greater_than (bool (default: False)) – Whether the budget should be for a water mass with tracer values “greater than” the threshold, or not (“less than” the threshold).
integrate (bool (default: True)) – Whether to integrate transformation rates in the (“X”, “Y”) dimensions
- Returns:
Contains the transformation terms in the full water mass transformation budget
- Return type:
xr.Dataset
- xwmb.budget.close_budget(ds)#
Close the full water mass transformation budget by identifying the residual as spurious numerical mixing.
- xwmb.budget.mass_tendency(ds)#
Computes the time-mean mass tendency by finite-differencing water mass snapshots