easyclimate.field.ocean.mixlayer¶
The calculation of ocean mixed layer variables.
Functions¶
|
Calculate the mixed layer depth. |
Calculate the weights of mixed layer depth. The weights required by the ocean model under non-uniform distribution grids in the depth direction. |
|
|
Calculate the tendency of the mixing layer temperature. |
|
Obtain data within the mixed layer. |
|
Obtain seawater temperature data within the mixing layer. |
|
Obtain averaged data within the mixed layer. |
|
Obtain averaged seawater temperature data within the mixing layer. |
|
Obtain the average horizontal advection within the mixed layer |
|
Obtain the average vertical advection within the mixed layer. |
|
Obtain ocean surface heat flux. |
Module Contents¶
- easyclimate.field.ocean.mixlayer.calc_mixed_layer_depth(seawater_temperature_data: xarray.DataArray, seawater_practical_salinity_data: xarray.DataArray, criterion: {'temperature', 'density', 'pdvar'} = 'pdvar', depth_dim: str = 'depth', lon_dim: str = 'lon', lat_dim: str = 'lat') xarray.DataArray¶
Calculate the mixed layer depth.
Parameters¶
- seawater_temperature_data:
xarray.DataArray(\(\mathrm{^\circ C}\)) Vertical seawater temperature data.
- seawater_practical_salinity_data:
xarray.DataArray(\(\mathrm{PSU}\)) Vertical seawater salinity data (practical salinity).
- criterion: {‘temperature’, ‘density’, ‘pdvar’}, default ‘pdvar’.
Mixed layer depth criteria
temperature : Computed based on constant temperature difference criterion, i.e., \(CT(0) - T[mld] = 0.5 \mathrm{^\circ C}\).
density : Computed based on the constant potential density difference criterion, i.e., \(pd[0] - pd[mld] = 0.125\) in sigma units.
pdvar : Computed based on variable potential density criterion \(pd[0] - pd[mld] = var(T[0], S[0])\), where var is a variable potential density difference which corresponds to constant temperature difference of \(0.5 \mathrm{^\circ C}\).
- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
Returns¶
The mixed layer depth (
xarray.DataArray).- seawater_temperature_data:
- easyclimate.field.ocean.mixlayer.calc_MLD_depth_weighted(seawater_temperature_data: xarray.DataArray | xarray.Dataset, mixed_layer_depth: xarray.DataArray, depth_dim: str = 'depth') xarray.DataArray | xarray.Dataset¶
Calculate the weights of mixed layer depth. The weights required by the ocean model under non-uniform distribution grids in the depth direction.
Parameters¶
- seawater_temperature_data:
xarray.DataArray(\(\mathrm{^\circ C}\)). Vertical seawater temperature data.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
Returns¶
The weights of the mixed layer depth (
xarray.DataArrayorxarray.Dataset).- seawater_temperature_data:
- easyclimate.field.ocean.mixlayer.calc_MLD_temper_tendency(seawater_temperature_anomaly_data: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_weight: xarray.DataArray, depth_dim='depth', time_dim='time') xarray.DataArray¶
Calculate the tendency of the mixing layer temperature.
Parameters¶
- seawater_temperature_anomaly_data:
xarray.DataArray(\(\mathrm{^\circ C}\)). The anomaly of the vertical seawater temperature data.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_weight:
xarray.DataArray. The weights of the mixed layer depth. The data is generated by the
easyclimate.field.ocean.mixlayer.calc_MLD_depth_weighted- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
- time_dim:
str, default: time. The time coordinate dimension name.
Returns¶
The weights of the mixed layer depth (
xarray.DataArray).- seawater_temperature_anomaly_data:
- easyclimate.field.ocean.mixlayer.get_data_within_MLD(data_input: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_dim: str = 'depth') xarray.DataArray¶
Obtain data within the mixed layer.
Caution
This function sets the data outside the mixing layer as missing values, i.e. np.nan, but it does not calculate the average value for the data inside the mixing layer.
Parameters¶
- data_input:
xarray.DataArray. The spatio-temporal data to be calculated.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
Returns¶
The data within the mixed layer (
xarray.DataArray).- data_input:
- easyclimate.field.ocean.mixlayer.get_temper_within_MLD(seawater_temperature_data: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_dim: str = 'depth') xarray.DataArray¶
Obtain seawater temperature data within the mixing layer.
Caution
This function sets the data outside the mixing layer as missing values, i.e. np.nan, but it does not calculate the average value for the data inside the mixing layer.
Parameters¶
- seawater_temperature_data:
xarray.DataArray(\(\mathrm{^\circ C}\)) Vertical seawater temperature data.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
Returns¶
The seawater temperature data within the mixed layer (
xarray.DataArray).- seawater_temperature_data:
- easyclimate.field.ocean.mixlayer.get_data_average_within_MLD(data_input: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_weight: xarray.DataArray, depth_dim: str = 'depth') xarray.DataArray¶
Obtain averaged data within the mixed layer.
Parameters¶
- data_input:
xarray.DataArray The spatio-temporal data to be calculated.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_weight:
xarray.DataArray. The weights of the mixed layer depth. The data is generated by the
easyclimate.field.ocean.mixlayer.calc_MLD_depth_weighted- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
Returns¶
The averaged data within the mixed layer (
xarray.DataArray).- data_input:
- easyclimate.field.ocean.mixlayer.get_temper_average_within_MLD(seawater_temperature_data: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_weight: xarray.DataArray, depth_dim: str = 'depth') xarray.DataArray¶
Obtain averaged seawater temperature data within the mixing layer.
Caution
This function sets the data outside the mixing layer as missing values, i.e. np.nan, but it does not calculate the average value for the data inside the mixing layer.
Parameters¶
- seawater_temperature_data:
xarray.DataArray(\(\mathrm{^\circ C}\)) Vertical seawater temperature data.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_weight:
xarray.DataArray. The weights of the mixed layer depth. The data is generated by the
easyclimate.field.ocean.mixlayer.calc_MLD_depth_weighted- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
Returns¶
The averaged seawater temperature data within the mixed layer (
xarray.DataArray).- seawater_temperature_data:
- easyclimate.field.ocean.mixlayer.calc_MLD_average_horizontal_advection(u_monthly_data: xarray.DataArray, v_monthly_data: xarray.DataArray, seawater_temperature_data: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_weight: xarray.DataArray, lon_dim: str = 'lon', lat_dim: str = 'lat', depth_dim: str = 'depth', min_dx: float = 1.0, min_dy: float = 1.0, edge_order: int = 2, R: float = 6371200.0) xarray.DataArray¶
Obtain the average horizontal advection within the mixed layer
Parameters¶
- u_monthly_data:
xarray.DataArray(\(\mathrm{m \cdot s^{-1}}\)). The monthly ocean current data.
- v_monthly_data:
xarray.DataArray(\(\mathrm{m \cdot s^{-1}}\)). The monthly meridional ocean current data.
- seawater_temperature_data:
xarray.DataArray(\(\mathrm{^\circ C}\)). Vertical seawater temperature data.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- depth_weight:
xarray.DataArray. The weights of the mixed layer depth. The data is generated by the
easyclimate.field.ocean.mixlayer.calc_MLD_depth_weighted- lon_dim:
str, default: lon. Longitude coordinate dimension name. By default extracting is applied over the lon dimension.
- lat_dim:
str, default: lat. Latitude coordinate dimension name. By default extracting is applied over the lat dimension.
- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
- min_dx:
float, default: 1.0. The minimum acceptable value of dx, below which parts will set nan to avoid large computational errors. The unit is m. You can set it to a negative value in order to remove this benefit.
- min_dy:
float, default: 1.0. The minimum acceptable value of dy, below which parts will set nan to avoid large computational errors. The unit is m. You can set it to a negative value in order to remove this benefit.
- edge_order: {1, 2}, optional
Gradient is calculated using N-th order accurate differences at the boundaries. Default: 1.
- R:
float, default: 6370000. Radius of the Earth.
Returns¶
The average horizontal advection within the mixed layer (\(\mathrm{^\circ C} \cdot \mathrm{month}^{-1}\),
xarray.DataArray).- u_monthly_data:
- easyclimate.field.ocean.mixlayer.calc_MLD_average_vertical_advection(w_monthly_data: xarray.DataArray, seawater_temperature_data: xarray.DataArray, mixed_layer_depth: xarray.DataArray, depth_weight: xarray.DataArray, depth_dim: str = 'depth') xarray.DataArray¶
Obtain the average vertical advection within the mixed layer.
Parameters¶
- w_monthly_data:
xarray.DataArray(\(\mathrm{m \cdot s^{-1}}\)). The monthly vertical ocean current data.
- seawater_temperature_data:
xarray.DataArray(\(\mathrm{^\circ C}\)). Vertical seawater temperature data.
- mixed_layer_depth:
xarray.DataArray<xarray.DataArray>`(:math:mathrm{m}`). The mixed layer depth.
- depth_weight:
xarray.DataArray. The weights of the mixed layer depth. The data is generated by the
easyclimate.field.ocean.mixlayer.calc_MLD_depth_weighted- depth_dim:
str, default: depth. depth like dimension over which to apply calculate. By default extracting is applied over the depth dimension.
Returns¶
The average vertical advection within the mixed layer (\(\mathrm{^\circ C} \cdot \mathrm{month}^{-1}\),
xarray.DataArray).- w_monthly_data:
- easyclimate.field.ocean.mixlayer.calc_ocean_surface_heat_flux(qnet_monthly_anomaly_data: xarray.DataArray, mixed_layer_depth: xarray.DataArray | float, rho_0: float = 1000, c_p: float = 4000) xarray.DataArray¶
Obtain ocean surface heat flux.
Parameters¶
- qnet_monthly_anomaly_data:
xarray.DataArray(\(\mathrm{W \cdot m^{-2}}\)). The monthly anomaly of the downward net heat flux at the ocean surface.
- mixed_layer_depth:
xarray.DataArray(\(\mathrm{m}\)). The mixed layer depth.
- rho_0:
float, default: 1000 (\(\mathrm{kg \cdot m^{-3}}\)). The density of water.
- c_p:
float, default: 4000 (\(\mathrm{J \cdot kg \cdot K^{-1}}\)). The specific heat of water.
Returns¶
The ocean surface heat flux (\(\mathrm{^\circ C} \cdot \mathrm{month}^{-1}\),
xarray.DataArray).Reference¶
Nnamchi, H., Li, J., Kucharski, F. et al. Thermodynamic controls of the Atlantic Niño. Nat Commun 6, 8895 (2015). https://doi.org/10.1038/ncomms9895
- qnet_monthly_anomaly_data: