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.0.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.0-py3-none-any.whl (61.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oilrad-2.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 c4c4d46747d14a5d2ac2eb85e56981022fb235a93721d3112f5be850a74c9c4b
MD5 edd71b2950e0e8b24b7e27cee10c96e1
BLAKE2b-256 5d1e623c2dd449bd3a582af9dab74201e7f35498d4cdd56c6660db9df8b28709

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oilrad-2.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7efc76eda58888479fcf53bae54fc56802b67199fc7769af3b20d945cbb0412a
MD5 1b0bd716026dac470342ad9ebbe52b17
BLAKE2b-256 c3c468c89bc16018b032c01dbe1e4608f614323609c413efcc105dbbed97218e

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