Repository navigation
Spectral fields for atm/surf/subsurf - #1210
Merged
Merged
Conversation
Merged
riclarsson
added a commit
that referenced
this pull request
Nov 28, 2026
AI summary: # VDISORT subsurface emission, spectral scattering properties and spectral retrieval targets This PR builds on the spectral fields of #1210. It does five things: - Scattering species now take their frequency-dependent properties from a spectral field, in the atmosphere or the subsurface. - Those properties can be retrieved. - VDISORT gains a subsurface emission calculation, with internal reflection at the interface. - VDISORT builds its phase matrices from Legendre moments in closed form. - `SensorBuilder` placements can be rolled about their boresight. ## Breaking changes - `scat_species` is renamed `atm_scat_species`. The new `subsurf_scat_species` holds the scattering species of the subsurface. - Scattering species are evaluated at a point of their medium together with the spectral point at the same position. Every evaluation takes the spectral point after the point, for example `species.tro_spectral(point, spectral_point, f_grid, degree)`. - In the atmosphere these are `AtmPoint` and `AtmSpectralPoint`. - In the subsurface these are `SubsurfacePoint` and `SubsurfaceSpectralPoint`. - The new workspace variable `atm_spectral_field` (`AtmSpectralField`) is an input to every method that evaluates scattering species. `spectral_propmat_scat_spectral_agenda` now also takes `ray_point`. - `HenyeyGreensteinScatterer` holds the names of three spectral properties: extinction, single scattering albedo and asymmetry parameter. It reads all three from the spectral point. `ExtSSACallback` is removed. - User callbacks (`ScatteringGeneralSpectralTRO`) take `(point, spectral_point, f_grid, degree)`. - Habit and PSD species take the temperature and the scattering species properties of the point. - `measurement_sensorsAddSensorBuilder` takes lists of positions and bore lines of sight (`ArrayOfVector3`, `ArrayOfVector2`) and an optional `roll`, and adds one sensor for all placements. - VDISORT's phase matrices from Legendre moments are now those of the generalized-spherical-function expansion (see below). For polarized scattering this changes results at the level of the series truncation; F11 is unchanged. ## Spectral retrieval targets Atmosphere, surface and subsurface spectral targets are added: - New methods: `jac_targetsAdd{Atmosphere,Surface,Subsurface}Spectral`, `oemAdd...Spectral`, `*_spectral_fieldFromModelState` and `model_state_vecFrom*Spectral`. - `model_state_vecFromData` and `UpdateModelStates` include them. - The state is the property's data: one value for a constant, or all gridded values with frequency slowest. - Derivatives are computed by the radar methods (single scattering, onion peeling), Monte Carlo, and `spectral_radSurfaceDepolarization`. - `HenyeyGreensteinScatterer` gives analytic derivatives by its extinction, single scattering albedo and `g`. - Methods that never read a target give zero columns for it. ## VDISORT subsurface emission `spectral_radSubsurfaceVDisort` gives the radiance leaving the surface from emission and scattering below it. It is meant for `spectral_rad_surface_agenda`. How it works: - **The column** is solved upside down, so VDISORT's surface is the interface and reflects back into the subsurface with Fresnel at index 1/Re(n). - **The setup** is `subsurf_vdisort_settings_agenda`, built by `subsurf_vdisort_settings_agendaSetup`. Each step but the absorption can be left out: - absorption from the subsurface spectral properties "refractive index" and "loss tangent"; - volume scattering by `subsurf_scat_species`; - layer emission; - radiation from below the deepest level; - Fresnel reflection at the interface; - an isotropic sky. - **The interface** at the ray path point is a facet tilted by the surface elevation: - the radiance within at the refracted angle is transmitted with 1 − R for each polarization; - the sky from `spectral_rad_observer_agenda` is reflected about the facet, which gives the sun's glint. - **`spectral_radSurfaceDepolarization`** scales the outgoing Q and U by 1 − D, using the surface spectral property "depolarization factor". It computes the analytic derivative by D. ## VDISORT phase matrices in closed form `vdisort::legendre_fourier_optics` makes VDISORT's stream, beam and user-angle phase matrices from the Legendre moments of the six scattering-matrix elements. It now does this in closed form, as in Lin et al. (2022, Eqs. 56–67): - The moments give the expansion coefficients in generalized spherical functions exactly, with an L-node Gauss–Legendre rule. - The addition theorem then gives the Fourier modes. This replaces adaptive azimuthal integration of the truncated series of each element. That series is not regular at forward and backward scattering, and the integration failed to converge for directions next to backscattering. The closed form is about 50× faster: a subsurface surface call at 30 layers, 8 streams and 8 moments drops from 58 ms to 5.5 ms. ## `Legendre::wigner_d` There is now one Wigner d^l_mn recurrence, `Legendre::wigner_d`. It is used by VDISORT and by the T-matrix scattering matrix, replacing two private copies. The T-matrix d^n_0m table stays on `Legendre::schmidt`, which is faster for all orders at one angle. ## `SensorBuilder` roll Each placement can be rolled about its boresight. The roll turns the whole instrument: - the polarization responses turn from v towards h, as `Polarization.at` turns them; - the antenna pattern's offsets and a camera's pixel grid turn with them. A roll of 0 is bit-identical to before. ## Documentation - New page `user.scattering_species`. - Spectral-field sections on the atmosphere, surface and subsurface field pages. - "Retrieving spectral properties" in `user.oem`. - The VDISORT subsurface calculation and the closed-form phase matrices in `user.disort` and `dev.disort`. - The roll in `user.sensor_builder`. ## Testing All 327 ctest tests pass. New tests: - `tests/core/disort/vdisort-subsurface.py`: - Kirchhoff equilibrium with and without scattering; - absorption along the refracted ray; - each step left out; - the depolarization and its derivative; - tilted facets; - the sun's glint; - user angle equal to stream. - `tests/core/jac/spectral_targets.py`. - `tests/core/scat/callback_species.py`. - `tests/core/sensor/sensor_roll.py`: polarization sense, roll 0, and that a roll at nadir equals the relabelled azimuth for the gridded, rectangular and camera patterns. - V7 in `vdisort-arts-test`: the closed form against independent vector-geometry Fourier coefficients, to about 1e-14: - a Mie series and its first moments; - Rayleigh; - Henyey–Greenstein moments next to forward and backward scattering. - `test_legendre`: `wigner_d` against Wigner's explicit sum, the Legendre polynomials and the Schmidt functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.