Skip to main content

Two-stream shortwave radiative transfer model for sea ice containing oil droplets.

Project description

oilrad

Oilrad is a python package for solving a two-stream shortwave radiation transfer model in a vertical domain containing sea ice and ocean water. It solves the spectral two-stream equations for ice and seawater polluted with a mass concentration of oil droplets, where oil absorption is calculated from [1]. Below is an example of spectral albedo computed for a range of oil mass ratios in a layer of sea ice.

Sea ice spectral albedo for ice containing droplets of Romashkino oil

Installation

Oilrad is available on PyPI and can be installed with pip via

pip install oilrad

Usage

The following python code illustrates how to set up and solve a simulation.

import numpy as np
import oilrad as oi

# set up model parameters
ICE_DEPTH = 0.8
depth = np.linspace(-1.5, 0, 1000)
model = oi.CtsWavelengthModel(
    z=depth,
    wavelengths=np.geomspace(350, 3000, 100),
    oil_mass_ratio=np.full_like(depth, 1000),
    ice_scattering_coefficient=1.5,
    median_droplet_radius_in_microns=0.5,
    liquid_fraction=np.where(depth > -ICE_DEPTH, 0, 1),
)

# solve the model
spectral_solution = oi.solve_two_stream_model(model)

# plot the spectral albedo
import matplotlib.pyplot as plt

plt.figure()
plt.plot(spectral_solution.wavelengths, spectral_solution.albedo)
plt.xlabel("wavelength (nm)")
plt.ylabel("albedo")
plt.show()

# integrate the solution over the black body spectrum to find total albedo
integrated_solution = oi.integrate_over_SW(
    spectral_solution, oi.BlackBodySpectrum(350, 3000)
)
print(f"total albedo={integrated_solution.albedo}")

Tests

The tests directory contains tests of simulations for a variety of input parameters. Run the tests using pytest from the root directory of the repository.

Docs

API reference documentation built using mkdocs gh-deploy is available at documentation.

License

MIT

References

[1] B. H. Redmond Roche and M. D. King, ‘Quantifying the effects of background concentrations of crude oil pollution on sea ice albedo’, The Cryosphere, vol. 16, no. 10, pp. 3949–3970, Oct. 2022, doi: 10.5194/tc-16-3949-2022.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oilrad-2.0.1.tar.gz (55.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oilrad-2.0.1-py3-none-any.whl (61.2 kB view details)

Uploaded Python 3

File details

Details for the file oilrad-2.0.1.tar.gz.

File metadata

  • Download URL: oilrad-2.0.1.tar.gz
  • Upload date:
  • Size: 55.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.13 Darwin/24.2.0

File hashes

Hashes for oilrad-2.0.1.tar.gz
Algorithm Hash digest
SHA256 d51a1f7bd1209fde6f1201598a43ab2fdb4b9143e2669a0f09940e5349147765
MD5 882b41fca9dc3ac54b02d25c177bbc59
BLAKE2b-256 d6e26330933c3abfb3034eef60b04dc1f62257db3b32d2262c99c99e5f9466ca

See more details on using hashes here.

File details

Details for the file oilrad-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: oilrad-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 61.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.9.13 Darwin/24.2.0

File hashes

Hashes for oilrad-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3d8c4bdc71535251a9590177bac2de2c4c7e893568e592b35a16d2cf3e531569
MD5 6038a88c4b897107f68d152b77ef8448
BLAKE2b-256 916a110344c9ef1de40afa99dfec3673792d5c4d6fe22fe6c7468b3f4aea67d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page