API Reference
Two-stream shortwave radiative transfer model for sea ice containing oil droplets.
constants
Constants used in the program
cts_wavelength
irradiances
Classes to store the solution of the continuous wavelength two stream model. Spectral irradiances and the integrated irradiances noralised by the incident.
CtsWavelengthIrradiance
dataclass
One dimensional Arrays containing the upwelling and downwelling irradiances at each depth integrated over wavelength.
Irradiances are non-dimensional and need to be multiplied by the incident spectral radiation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
NDArray
|
vertical grid specified in dimensional units (m) |
required |
upwelling
|
NDArray
|
1D array of integrated upwelling irradiances |
required |
downwelling
|
NDArray
|
1D array of integrated downwelling irradiances |
required |
Source code in oilrad/cts_wavelength/irradiances.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
albedo
property
Calculate albedo
net_irradiance
property
Calculate net irradiance
transmittance
property
Calculate transmittance at the ice ocean interface or the bottom of the domain if the domain is entirely ice.
CtsWavelengthSpectralIrradiance
dataclass
Two dimensional arrays containing the upwelling and downwelling irradiances at each depth and wavelength.
Irradiances are non-dimensional and need to be multiplied by the incident spectral radiation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
NDArray
|
vertical grid specified in dimensional units (m) |
required |
wavelengths
|
NDArray
|
array of wavelengths in nm |
required |
upwelling
|
NDArray
|
2D array of upwelling irradiances |
required |
downwelling
|
NDArray
|
2D array of downwelling irradiances |
required |
Source code in oilrad/cts_wavelength/irradiances.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
albedo
property
Calculate spectral albedo
transmittance
property
Calculate spectral transmittance at the ice ocean interface or the bottom of the domain if the domain is entirely ice.
model
Solve the two-stream shortwave radiation model for a layer of ice with constant optical properties aside from absorption varying due to the oil mass ratio.
Arbitrary wavelength resolution
CtsWavelengthModel
dataclass
Class containing all the necessary parameters to solve the two-stream shortwave radiative transfer model in a domain with continuously varying liquid fraction and oil mass ratio.
If no array is provided for liquid fraction, it is assumed to be zero everywhere. This corresponds to a completely frozen domain.
Oil mass ratio is provided in ng oil / g ice and, along with the median droplet radius for the oil droplet distribution, is used to calculate the absorption coefficient by interpolating data for Romashkino oil from Redmond Roche et al. 2022.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
NDArray
|
vertical grid in meters |
required |
wavelengths
|
NDArray
|
array of wavelengths in nm |
required |
oil_mass_ratio
|
NDArray
|
array of oil mass ratio in ng oil / g ice on the vertical grid |
required |
ice_scattering_coefficient
|
float
|
scattering coefficient for ice in 1/m |
required |
median_droplet_radius_in_microns
|
float
|
median droplet radius in microns |
required |
absorption_enhancement_factor
|
float
|
enhancement factor for oil absorption appropriate for the two-stream model |
1
|
liquid_fraction
|
NDArray
|
liquid fraction array on the vertical grid |
None
|
fast_solve
|
Bool
|
if True, solve the model only for wavelengths below a wavelength cutoff, assume longer wavelengths are absorbed at the surface |
False
|
wavelength_cutoff
|
float
|
cutoff wavelength in nm |
None
|
Source code in oilrad/cts_wavelength/model.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
solve_at_given_wavelength(model, wavelength)
Use the scipy solve_bvp function to solve the two-stream model as a function of depth for a given wavelenght value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CtsWavelengthModel
|
model parameters |
required |
wavelength
|
float
|
wavelength in nm |
required |
Returns: tuple[NDArray, NDArray]: upwelling and downwelling irradiances as functions of depth Raises: RuntimeError: if the solver does not converge
Source code in oilrad/cts_wavelength/model.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
integrate
Spectrally integrate two-stream model solutions
integrate_over_SW(spectral_irradiance, spectrum=None)
Spectrally integrate the two-stream model solution
When integrating the continuous wavelength model need to supply an instance of the BlackBodySpectrum
Integration of the six band model uses the cloudy incident spectrum of Grenfell et al 2004.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spectral_irradiance
|
SpectralIrradiance | SixBandSpectralIrradiance
|
spectral two-stream model solution |
required |
spectrum
|
Optional[BlackBodySpectrum]
|
normalised incident shortwave spectrum (only needed when integrating SpectralIrradiance). Currently only the BlackBodySpectrum is implemented. |
None
|
Returns: Irradiance | SixBandIrradiance: spectrally integrated irradiances
Source code in oilrad/integrate.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
optics
Module to calculate the optical properties for ice containing oil droplets: - The spectral absorption coefficient which depends on oil mass concentration and droplet size - The wavelength-independent scattering coefficient which takes a constant value in the ice and is zero the liquid
Load data for imaginary refractive index against wavelength from doi:10.1029/2007JD009744. This is used to calculate the absorption coefficient of pure ice. To interpolate the data to other wavelengths should interpolate the log of the data linearly.
Oil absorption calculated following Redmond Roche et al 2022 using given data for mass absorption coefficient of oil in ice which is a function of wavelength and droplet radius
calculate_ice_absorption_coefficient(wavelength_in_nm)
calculate ice absorption coefficient from Warren 2008 data at given wavelengths inputted in nano meters from interpolated imaginary refractive index data
Source code in oilrad/optics.py
70 71 72 73 74 75 76 77 78 79 | |
calculate_ice_oil_absorption_coefficient(wavelengths_in_nm, oil_mass_ratio, droplet_radius_in_microns, absorption_enhancement_factor=1.0)
Calculate the absorption coefficient in 1/m of ice polluted with oil droplets following roche et al 2022. The oil droplets radii are distributed log-normally with geometric standard deviation e. We specify the median radius for the distribution.
mass ratio in units of ng oil / g ice
This is for Romashkino oil.
The enahncement factor is an ad hoc correction for the two stream model to try and better match the results of redmondroche2022 which used an 8-stream model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths_in_nm
|
NDArray
|
wavelengths in nm |
required |
oil_mass_ratio
|
float
|
mass ratio of oil in ice in ng/g |
required |
droplet_radius_in_microns
|
float
|
median droplet radius in microns |
required |
absorption_enhancement_factor
|
float
|
enhancement factor for absorption coefficient. Defaults to 1.0. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
NDArray |
absorption coefficient in 1/m |
Source code in oilrad/optics.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
calculate_scattering(liquid_fraction, ice_scattering_coefficient)
Calculate scattering coefficient in ice and return zero in liquid. (doesn't depend on wavelength)
Smoothly transitions from the ice_scattering_coefficient to zero in the liquid using a tanh function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
liquid_fraction
|
NDArray
|
liquid fraction as a function of depth |
required |
ice_scattering_coefficient
|
float
|
scattering coefficient of ice |
required |
Returns:
| Name | Type | Description |
|---|---|---|
NDArray |
scattering coefficient [1/m] as a function of depth |
Source code in oilrad/optics.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
six_band
irradiances
Classes to store spectral and integrated solution of the six band model. All irradiances are normalised by the incident.
SixBandIrradiance
dataclass
One dimensional Arrays containing the upwelling and downwelling irradiances at each depth integrated over the wavelength bands.
Irradiances are non-dimensional and need to be multiplied by the incident spectral radiation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
NDArray
|
vertical grid specified in dimensional units (m) |
required |
upwelling
|
NDArray
|
1D array of integrated upwelling irradiances |
required |
downwelling
|
NDArray
|
1D array of integrated downwelling irradiances |
required |
albedo
|
float
|
spectrally integrated albedo (including the snow layer and SSL) |
required |
Source code in oilrad/six_band/irradiances.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
transmittance
property
Calculate transmittance at the ice ocean interface or the bottom of the domain if the domain is entirely ice.
SixBandSpectralIrradiance
dataclass
Two dimensional arrays containing the upwelling and downwelling irradiances at each depth and in each wavelength band.
Irradiances are non-dimensional and need to be multiplied by the incident spectral radiation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
NDArray
|
vertical grid specified in dimensional units (m) |
required |
upwelling
|
NDArray
|
2D array of upwelling irradiances |
required |
downwelling
|
NDArray
|
2D array of downwelling irradiances |
required |
albedo
|
NDArray
|
1D array of spectral albedo (including snow and SSL) |
required |
Source code in oilrad/six_band/irradiances.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
PAR_transmittance
property
Calculate plane PAR transmittance as the ratio of the net irradiant power in the PAR range (400-700nm) to the incident irradiative power at the ice / snow surface.
plane_PAR
property
Calculate plane PAR normalised by the incident broadband shortwave irradiance.
To convert to micromol-photns m^-2 s^-1 we need to multiply by the incident shortwave irradiance in W m^-2.
To convert to the scalar value for an isotropic downwelling irradiance multiply by a factor of 2.
transmittance
property
Calculate spectral transmittance at the ice ocean interface or the bottom of the domain if the domain is entirely ice.
model
Shortwave radiative transfer model for a layer of sea ice with 6 spectral bands.
Optionally the ice may have a melt pond layer, a snow layer and a surface scattering layer (SSL).
SixBandModel
dataclass
Class containing all the necessary parameters to solve the two-stream shortwave radiative transfer model in a domain with continuously varying liquid fraction and oil mass ratio with optical properties averaged in the six spectral bands with wavelengths:
300-400nm 400-500nm 500-600nm 600-700nm 700-1200nm 1200-3000nm
Irradiances are scaled by the incident downwelling in each spectral band.
If no array is provided for liquid fraction, it is assumed to be zero everywhere. This corresponds to a completely frozen domain.
Oil mass ratio is provided in ng oil / g ice and, along with the median droplet radius for the oil droplet distribution, is used to calculate the absorption coefficient by interpolating data for Romashkino oil from Redmond Roche et al. 2022.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
NDArray
|
vertical grid in meters |
required |
oil_mass_ratio
|
NDArray
|
array of oil mass ratio in ng oil / g ice on the vertical grid |
required |
ice_scattering_coefficient
|
float
|
scattering coefficient for ice in 1/m |
required |
median_droplet_radius_in_microns
|
float
|
median droplet radius in microns |
required |
absorption_enhancement_factor
|
float
|
enhancement factor for oil absorption appropriate for the two-stream model |
required |
snow_depth
|
float
|
snow depth in meters |
required |
snow_spectral_albedos
|
NDArray
|
spectral albedos for the snow layer in each band |
required |
snow_extinction_coefficients
|
NDArray
|
spectral extinction coefficient for the snow layer in each band |
required |
SSL_depth
|
float
|
depth of the surface scattering layer in meters |
required |
SSL_spectral_albedos
|
NDArray
|
spectral albedos for the SSL in each band |
required |
SSL_extinction_coefficients
|
NDArray
|
spectral extinction coefficients for the SSL in each band |
required |
liquid_fraction
|
Optional[NDArray]
|
liquid fraction array on the vertical grid |
None
|
Source code in oilrad/six_band/model.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
solve_a_wavelength_band(model, wavelength_band_index)
Use the scipy solve_bvp function to solve the two-stream model as a function of depth for each wavelength band.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
SixBandModel
|
model parameters |
required |
wavelength_band_index
|
int
|
index of the wavelength band to solve |
required |
Returns: tuple[NDArray, NDArray]: upwelling and downwelling irradiances as functions of depth Raises: RuntimeError: if the solver does not converge
Source code in oilrad/six_band/model.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
top_surface
Calculate surface transmittance for six band model through a snow layer and SSL
solve
Provide a function to solve the two-stream model in the case of continuously varying optical properties which implements a faster solve approximation for long wavelengths if the fast_solve parameter of the model is set to True for the continuous wavelength case.
solve_two_stream_model(model)
Solve the two-stream model and return an object containing the solution at all specified wavelengths
Args (InfiniteLayerModel | SixBandModel): model: two-stream model parameters
Returns:
| Type | Description |
|---|---|
CtsWavelengthSpectralIrradiance | SixBandSpectralIrradiance
|
SpectralIrradiance | SixBandSpectralIrradiance: object containing the solution of the two-stream model at each wavelength |
Source code in oilrad/solve.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
spectra
Module to provide the spectrum of incident downwelling shortwave radiation at the top of the domain.
Currently only the black body spectrum is integrated which follows the solar spectrum at the top of the atmosphere, but is normalised to integrate to one in the shortwave range.
Data used to compute the Planck function is from: https://www.oceanopticsbook.info/view/light-and-radiometry/level-2/light-from-the-sun
BlackBodySpectrum
dataclass
Spectrum with blackbody shape that integrates to 1 between minimum and maximum wavelength specified in nm
Once initialised the spectrum can be called with an array of wavelengths in nm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_wavelength
|
float
|
minimum wavelength in nm |
required |
max_wavelength
|
float
|
maximum wavelength in nm |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if wavelength is not in the shortwave range |
Source code in oilrad/spectra.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |