In [23]:
import iris
import glob
import os, sys
import matplotlib.pyplot as plt
import numpy
import iris.plot as iplt

cwd = os.getcwd()
repo_dir = '/'
for directory in cwd.split('/')[1:]:
    repo_dir = os.path.join(repo_dir, directory)
    if directory == 'ocean-analysis':
        break

modules_dir = os.path.join(repo_dir, 'modules')
sys.path.append(modules_dir)

import general_io as gio
import timeseries
import convenient_universal as uconv


/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
  return f(*args, **kwds)

In [3]:
sfdsi_files = glob.glob('/g/data/r87/dbi599/CMIP6/CMIP/MPI-M/MPI-ESM1-2-LR/piControl/r1i1p1f1/Omon/sfdsi/gn/v20190710/sfdsi_Omon_MPI-ESM1-2-LR_piControl_r1i1p1f1_gn_*.nc')
soga_files = glob.glob('/g/data/oi10/replicas/CMIP6/CMIP/MPI-M/MPI-ESM1-2-LR/piControl/r1i1p1f1/Omon/soga/gn/v20190710/soga_Omon_MPI-ESM1-2-LR_piControl_r1i1p1f1_gn_*.nc')
areacello_file = '/g/data/oi10/replicas/CMIP6/CMIP/MPI-M/MPI-ESM1-2-LR/piControl/r1i1p1f1/Ofx/areacello/gn/v20190710/areacello_Ofx_MPI-ESM1-2-LR_piControl_r1i1p1f1_gn.nc'

Sea ice basal salt flux


In [10]:
sfdsi_cube, history = gio.combine_files(sfdsi_files, 'downward_sea_ice_basal_salt_flux')


/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))
/g/data/r87/dbi599/miniconda3/envs/ocean/lib/python3.6/site-packages/iris/fileformats/cf.py:798: UserWarning: Missing CF-netCDF measure variable 'areacello', referenced by netCDF variable 'sfdsi'
  warnings.warn(message % (variable_name, nc_var_name))

In [11]:
sfdsi_cube


Out[11]:
Downward Sea Ice Basal Salt Flux (kg m-2 s-1) time cell index along second dimension cell index along first dimension
Shape 12000 220 256
Dimension coordinates
time x - -
cell index along second dimension - x -
cell index along first dimension - - x
Auxiliary coordinates
latitude - x x
longitude - x x
Attributes
Conventions CF-1.7 CMIP-6.2
activity_id CMIP
branch_method standard
branch_time_in_child 0.0
branch_time_in_parent 18262.0
cmor_version 3.5.0
comment This field is physical, and it arises since sea ice has a nonzero salt...
contact cmip6-mpi-esm@dkrz.de
data_specs_version 01.00.30
experiment pre-industrial control
experiment_id piControl
external_variables areacello
forcing_index 1
frequency mon
further_info_url https://furtherinfo.es-doc.org/CMIP6.MPI-M.MPI-ESM1-2-LR.piControl.non...
grid gn
grid_label gn
initialization_index 1
institution Max Planck Institute for Meteorology, Hamburg 20146, Germany
institution_id MPI-M
license CMIP6 model data produced by MPI-M is licensed under a Creative Commons...
mip_era CMIP6
nominal_resolution 250 km
original_name sfdsi
parent_activity_id CMIP
parent_experiment_id piControl-spinup
parent_mip_era CMIP6
parent_source_id MPI-ESM1-2-LR
parent_time_units days since 1850-1-1 00:00:00
parent_variant_label r1i1p1f1
physics_index 1
product model-output
project_id CMIP6
realization_index 1
realm ocean
references MPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System...
source MPI-ESM1.2-LR (2017):
aerosol none, prescribed MACv2-SP
atmos ECHAM6.3...
source_id MPI-ESM1-2-LR
source_type AOGCM
sub_experiment none
sub_experiment_id none
table_id Omon
table_info Creation Date:(09 May 2019) MD5:e6ef8ececc8f338646ebfb3aeed36bfc
title MPI-ESM1-2-LR output prepared for CMIP6
variable_id sfdsi
variant_label r1i1p1f1
Cell methods
mean where sea area
mean time

In [13]:
sfdsi_cube = timeseries.convert_to_annual(sfdsi_cube)

In [17]:
vmin = -1e-6
vmax = 1e-6
#iplt.pcolormesh(plot_cube, cmap='RdBu_r', vmin=vmin, vmax=vmax)
plt.pcolormesh(sfdsi_cube.data[0, ::], cmap='RdBu_r', vmin=vmin, vmax=vmax)
cb = plt.colorbar()
cb.set_label(str(sfdsi_cube.units))
plt.show()



In [21]:
# convert units from kg m-2 s-1 to kg

area_cube = iris.load_cube(areacello_file)
area_array = uconv.broadcast_array(area_cube.data, [1, area_cube.ndim], sfdsi_cube.shape)
units = str(sfdsi_cube.units)
sfdsi_cube.units = units.replace('m-2', '')
sfdsi_cube.data = sfdsi_cube.data * area_array

global_sum = numpy.ma.sum(sfdsi_cube.data, axis=(1,2))
sfdsi_cube = sfdsi_cube[:, 0, 0].copy()
sfdsi_cube.data = global_sum

sfdsi_cube = timeseries.flux_to_total(sfdsi_cube)

In [22]:
sfdsi_cube


Out[22]:
Downward Sea Ice Basal Salt Flux (kg) time
Shape 1000
Dimension coordinates
time x
Scalar coordinates
cell index along first dimension 0
cell index along second dimension 0
latitude 76.35550435427294 degrees, bound=(76.38205329957678, 76.48892526951997, 76.43582054872313, 76.33065612607244) degrees
longitude 312.7452884159426 degrees, bound=(313.5286598873243, 313.3146939662899, 312.8537518199624, 313.0816376665253) degrees
Attributes
Conventions CF-1.7 CMIP-6.2
activity_id CMIP
branch_method standard
branch_time_in_child 0.0
branch_time_in_parent 18262.0
cmor_version 3.5.0
comment This field is physical, and it arises since sea ice has a nonzero salt...
contact cmip6-mpi-esm@dkrz.de
data_specs_version 01.00.30
experiment pre-industrial control
experiment_id piControl
external_variables areacello
forcing_index 1
frequency mon
further_info_url https://furtherinfo.es-doc.org/CMIP6.MPI-M.MPI-ESM1-2-LR.piControl.non...
grid gn
grid_label gn
initialization_index 1
institution Max Planck Institute for Meteorology, Hamburg 20146, Germany
institution_id MPI-M
license CMIP6 model data produced by MPI-M is licensed under a Creative Commons...
mip_era CMIP6
nominal_resolution 250 km
original_name sfdsi
parent_activity_id CMIP
parent_experiment_id piControl-spinup
parent_mip_era CMIP6
parent_source_id MPI-ESM1-2-LR
parent_time_units days since 1850-1-1 00:00:00
parent_variant_label r1i1p1f1
physics_index 1
product model-output
project_id CMIP6
realization_index 1
realm ocean
references MPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System...
source MPI-ESM1.2-LR (2017):
aerosol none, prescribed MACv2-SP
atmos ECHAM6.3...
source_id MPI-ESM1-2-LR
source_type AOGCM
sub_experiment none
sub_experiment_id none
table_id Omon
table_info Creation Date:(09 May 2019) MD5:e6ef8ececc8f338646ebfb3aeed36bfc
title MPI-ESM1-2-LR output prepared for CMIP6
variable_id sfdsi
variant_label r1i1p1f1
Cell methods
mean where sea area
mean time
mean year

In [31]:
iplt.plot(sfdsi_cube)
plt.ylabel('kg')
plt.xlabel('year')
plt.show()



In [26]:
sfdsi_cumsum_data = numpy.cumsum(sfdsi_cube.data)
sfdsi_cumsum_anomaly = sfdsi_cumsum_data - sfdsi_cumsum_data[0]

In [30]:
plt.plot(sfdsi_cumsum_anomaly)
plt.ylabel('kg')
plt.xlabel('year')
plt.show()


Mass of salt in the ocean


In [42]:
soga_cube, history = gio.combine_files(soga_files, 'sea_water_salinity')
soga_cube = timeseries.convert_to_annual(soga_cube)

In [43]:
soga_cube


Out[43]:
Sea Water Salinity (0.001) time
Shape 1000
Dimension coordinates
time x
Attributes
Conventions CF-1.7 CMIP-6.2
activity_id CMIP
branch_method standard
branch_time_in_child 0.0
branch_time_in_parent 18262.0
cmor_version 3.5.0
comment Sea water salinity is the salt content of sea water, often on the Practical...
contact cmip6-mpi-esm@dkrz.de
data_specs_version 01.00.30
experiment pre-industrial control
experiment_id piControl
forcing_index 1
frequency mon
further_info_url https://furtherinfo.es-doc.org/CMIP6.MPI-M.MPI-ESM1-2-LR.piControl.non...
grid gn
grid_label gn
initialization_index 1
institution Max Planck Institute for Meteorology, Hamburg 20146, Germany
institution_id MPI-M
license CMIP6 model data produced by MPI-M is licensed under a Creative Commons...
mip_era CMIP6
nominal_resolution 250 km
original_name soga
parent_activity_id CMIP
parent_experiment_id piControl-spinup
parent_mip_era CMIP6
parent_source_id MPI-ESM1-2-LR
parent_time_units days since 1850-1-1 00:00:00
parent_variant_label r1i1p1f1
physics_index 1
product model-output
project_id CMIP6
realization_index 1
realm ocean
references MPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System...
source MPI-ESM1.2-LR (2017):
aerosol none, prescribed MACv2-SP
atmos ECHAM6.3...
source_id MPI-ESM1-2-LR
source_type AOGCM
sub_experiment none
sub_experiment_id none
table_id Omon
table_info Creation Date:(09 May 2019) MD5:e6ef8ececc8f338646ebfb3aeed36bfc
title MPI-ESM1-2-LR output prepared for CMIP6
variable_id soga
variant_label r1i1p1f1
Cell methods
mean where sea area
mean time
mean year

In [44]:
mass_of_ocean = 1.4e21 #kg
mass_of_salt = soga_cube.data * 1000 * mass_of_ocean

In [45]:
fig = plt.figure(figsize=[10, 6])
ax = fig.add_subplot(111)
plt.plot(mass_of_salt)
plt.ylabel('kg')
ax.ticklabel_format(useOffset=False)
ax.yaxis.major.formatter._useMathText = True



In [46]:
print(mass_of_salt.min())
print(mass_of_salt.max())


4.8662137e+25
4.866268e+25

In [47]:
mass_of_salt_anomaly = mass_of_salt - mass_of_salt[0]

In [48]:
fig = plt.figure(figsize=[10, 6])
ax = fig.add_subplot(111)
plt.plot(mass_of_salt_anomaly)
plt.ylabel('kg')
ax.ticklabel_format(useOffset=False)
ax.yaxis.major.formatter._useMathText = True


Comparison


In [54]:
time_axis = numpy.arange(0, len(mass_of_salt_anomaly)) 
mass_of_salt_trend = timeseries.linear_trend(mass_of_salt_anomaly, time_axis, None)
print(f"{mass_of_salt_trend} kg/yr")


-2.139503939875967e+17 kg/yr

In [55]:
sfdsi_trend = timeseries.linear_trend(sfdsi_cumsum_anomaly, time_axis, None)
print(f"{sfdsi_trend} kg/yr")


-1737988137098.3135 kg/yr

In [56]:
(sfdsi_trend / mass_of_salt_trend) * 100


Out[56]:
0.0008123322910071713

The cumulative sea ice basal salt flux explains 0.0008% of the drift in ocean salt content.


In [ ]: