Reflective surface testing

This notebook tests the backend setup for a diffuse surface without an atmosphere.

import numpy as np

import eradiate
import matplotlib.pyplot as plt
from eradiate.experiments import AtmosphereExperiment
from eradiate.units import unit_registry as ureg

import eradiate_disort as ed
from eradiate_disort.testing import TestMode
from eradiate_disort.util import disort_reshape_pplane

eradiate.set_mode("ckd")

SPP = 1_000
# Experiment parameters
SZA = 30.0
zeniths = np.arange(-75.0, 76.0, 1.0)
srf = {"type": "delta", "wavelengths": [550.0]}
geometry = {
    "type": "plane_parallel",
    "zgrid": ([0.0, 1.0] * ureg.km).to("m"),
    "toa_altitude": 1.0 * ureg.km,
}
surface = {"type": "lambertian", "reflectance": 0.5}
illumination = {"type": "directional", "zenith": SZA, "azimuth": 0.0}
result = {}

exp = AtmosphereExperiment(
    geometry=geometry,
    surface=surface,
    atmosphere=None,
    illumination=illumination,
    measures={
        "type": "mdistant",
        "id": "toa_mitsuba",
        "construct": "hplane",
        "azimuth": 0.0,
        "zeniths": zeniths,
        "srf": srf,
    },
)
result["mitsuba"] = eradiate.run(exp, spp=SPP)["radiance"].squeeze()

exp = AtmosphereExperiment(
    geometry=geometry,
    surface=surface,
    atmosphere=None,
    illumination=illumination,
    measures={
        "type": "disort",
        "id": "toa_disort",
        "construct": "hplane",
        "azimuth": 0.0,
        "zeniths": zeniths,
        "srf": srf,
    },
)
backend = ed.DisortBackend()
result["disort"] = disort_reshape_pplane(backend.run(exp).sel(z=1.0))
fig, ax = plt.subplots(1, 1, figsize=(4, 3), layout="constrained")

ax.plot(result["mitsuba"]["vza"], result["mitsuba"], label="Mitsuba")
ax.plot(result["disort"]["vza"], result["disort"], label="CDISORT", ls="--")
ax.set_xlabel("θ [°]")
ax.set_ylabel("Radiance [W/m²/sr]")
ax.set_ylim([-0.05, 0.65])
ax.legend()

plt.show()
../_images/35cddf9be70ef901887921f39769733b97bd769116ade8e5297774ee869c0b52.svg