![]() |
JURASSIC
|
JURASSIC library definitions. More...
#include "jurassic.h"Go to the source code of this file.
Functions | |
| void | analyze_avk (ret_t *ret, ctl_t *ctl, atm_t *atm, int *iqa, int *ipa, gsl_matrix *avk) |
| void | analyze_avk_quantity (gsl_matrix *avk, int iq, int *ipa, size_t *n0, size_t *n1, double *cont, double *res) |
| size_t | atm2x (const ctl_t *ctl, const atm_t *atm, gsl_vector *x, int *iqa, int *ipa) |
| Convert atmospheric data to state vector elements. More... | |
| void | atm2x_help (const double value, const int value_iqa, const int value_ip, gsl_vector *x, int *iqa, int *ipa, size_t *n) |
| Append a single atmospheric value to the state vector. More... | |
| void | cart2geo (const double *x, double *z, double *lon, double *lat) |
| Converts Cartesian coordinates to geographic coordinates. More... | |
| void | climatology (const ctl_t *ctl, atm_t *atm) |
| Initializes atmospheric climatology profiles. More... | |
| double | cost_function (gsl_vector *dx, gsl_vector *dy, gsl_matrix *s_a_inv, gsl_vector *sig_eps_inv) |
| double | ctmco2 (const double nu, const double p, const double t, const double u) |
| Compute carbon dioxide continuum (optical depth). More... | |
| double | ctmh2o (const double nu, const double p, const double t, const double q, const double u) |
| Compute water vapor continuum (optical depth). More... | |
| double | ctmn2 (const double nu, const double p, const double t) |
| Compute N₂ collision-induced absorption coefficient. More... | |
| double | ctmo2 (const double nu, const double p, const double t) |
| Compute O₂ collision-induced absorption coefficient. More... | |
| void | copy_atm (const ctl_t *ctl, atm_t *atm_dest, const atm_t *atm_src, const int init) |
| Copy or initialize atmospheric profile data. More... | |
| void | copy_obs (const ctl_t *ctl, obs_t *obs_dest, const obs_t *obs_src, const int init) |
| Copy or initialize observation geometry and radiance data. More... | |
| int | find_emitter (const ctl_t *ctl, const char *emitter) |
| Find gas species index by name. More... | |
| void | formod (const ctl_t *ctl, const tbl_t *tbl, atm_t *atm, obs_t *obs) |
| Execute the selected forward model. More... | |
| void | formod_continua (const ctl_t *ctl, const los_t *los, const int ip, double *beta) |
| Compute total extinction including gaseous continua. More... | |
| void | formod_fov (const ctl_t *ctl, obs_t *obs) |
| Apply field-of-view (FOV) convolution to modeled radiances. More... | |
| void | formod_pencil (const ctl_t *ctl, const tbl_t *tbl, const atm_t *atm, obs_t *obs, const int ir) |
| Compute line-of-sight radiances using the pencil-beam forward model. More... | |
| void | formod_rfm (const ctl_t *ctl, const atm_t *atm, obs_t *obs) |
| Interface routine for the Reference Forward Model (RFM). More... | |
| void | formod_srcfunc (const ctl_t *ctl, const tbl_t *tbl, const double t, double *src) |
| Interpolate the source function (Planck radiance) at a given temperature. More... | |
| void | geo2cart (const double z, const double lon, const double lat, double *x) |
| Converts geographic coordinates (longitude, latitude, altitude) to Cartesian coordinates. More... | |
| void | hydrostatic (const ctl_t *ctl, atm_t *atm) |
| Adjust pressure profile using the hydrostatic equation. More... | |
| void | idx2name (const ctl_t *ctl, const int idx, char *quantity) |
| Convert a quantity index to a descriptive name string. More... | |
| void | init_srcfunc (const ctl_t *ctl, tbl_t *tbl) |
| Initialize the source-function (Planck radiance) lookup table. More... | |
| void | intpol_atm (const ctl_t *ctl, const atm_t *atm, const double z, double *p, double *t, double *q, double *k) |
| Interpolate atmospheric state variables at a given altitude. More... | |
| void | intpol_tbl_cga (const ctl_t *ctl, const tbl_t *tbl, const los_t *los, const int ip, double tau_path[ND][NG], double tau_seg[ND]) |
| Interpolate emissivities and transmittances using the Curtis–Godson approximation (CGA). More... | |
| void | intpol_tbl_ega (const ctl_t *ctl, const tbl_t *tbl, const los_t *los, const int ip, double tau_path[ND][NG], double tau_seg[ND]) |
| Interpolate emissivities and transmittances using the Emissivity Growth Approximation (EGA). More... | |
| double | intpol_tbl_eps (const tbl_t *tbl, const int ig, const int id, const int ip, const int it, const double u) |
| Interpolate emissivity from lookup tables as a function of column density. More... | |
| double | intpol_tbl_u (const tbl_t *tbl, const int ig, const int id, const int ip, const int it, const double eps) |
| Interpolate column density from lookup tables as a function of emissivity. More... | |
| void | jsec2time (const double jsec, int *year, int *mon, int *day, int *hour, int *min, int *sec, double *remain) |
| Converts Julian seconds to calendar date and time components. More... | |
| void | kernel (const ctl_t *ctl, const tbl_t *tbl, atm_t *atm, obs_t *obs, gsl_matrix *k) |
| Compute the Jacobian (kernel) matrix by finite differences. More... | |
| int | locate_irr (const double *xx, const int n, const double x) |
| Locate index for interpolation on an irregular grid. More... | |
| int | locate_reg (const double *xx, const int n, const double x) |
| Locate index for interpolation on a regular (uniform) grid. More... | |
| int | locate_tbl (const float *xx, const int n, const double x) |
| Locate index for interpolation within emissivity table grids. More... | |
| void | matrix_invert (gsl_matrix *a) |
| void | matrix_product (gsl_matrix *a, gsl_vector *b, int transpose, gsl_matrix *c) |
| size_t | obs2y (const ctl_t *ctl, const obs_t *obs, gsl_vector *y, int *ida, int *ira) |
| Convert observation radiances into a measurement vector. More... | |
| void | raytrace (const ctl_t *ctl, const atm_t *atm, obs_t *obs, los_t *los, const int ir) |
| Perform line-of-sight (LOS) ray tracing through the atmosphere. More... | |
| void | read_atm (const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm) |
| Read atmospheric profile data from an ASCII file. More... | |
| void | read_ctl (int argc, char *argv[], ctl_t *ctl) |
| Read model control parameters from command-line and configuration input. More... | |
| void | read_matrix (const char *dirname, const char *filename, gsl_matrix *matrix) |
| Read a numerical matrix from an ASCII file. More... | |
| void | read_obs (const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs) |
| Read observation geometry and radiance data from an ASCII file. More... | |
| double | read_obs_rfm (const char *basename, const double z, double *nu, double *f, int n) |
| Read and spectrally convolve an RFM output spectrum. More... | |
| void | read_ret (int argc, char *argv[], ctl_t *ctl, ret_t *ret) |
| void | read_rfm_spec (const char *filename, double *nu, double *rad, int *npts) |
| Read a Reference Forward Model (RFM) ASCII spectrum. More... | |
| void | read_shape (const char *filename, double *x, double *y, int *n) |
| Read a two-column shape function from an ASCII file. More... | |
| tbl_t * | read_tbl (const ctl_t *ctl) |
| Read gas emissivity look-up tables for all channels and emitters. More... | |
| double | scan_ctl (int argc, char *argv[], const char *varname, const int arridx, const char *defvalue, char *value) |
| Scan control file or command-line arguments for a configuration variable. More... | |
| double | sza (const double sec, const double lon, const double lat) |
| Compute the solar zenith angle for a given time and location. More... | |
| void | set_cov_apr (ret_t *ret, ctl_t *ctl, atm_t *atm, int *iqa, int *ipa, gsl_matrix *s_a) |
| void | set_cov_meas (ret_t *ret, ctl_t *ctl, obs_t *obs, gsl_vector *sig_noise, gsl_vector *sig_formod, gsl_vector *sig_eps_inv) |
| void | tangent_point (const los_t *los, double *tpz, double *tplon, double *tplat) |
| Determine the tangent point along a line of sight (LOS). More... | |
| void | time2jsec (const int year, const int mon, const int day, const int hour, const int min, const int sec, const double remain, double *jsec) |
| Converts time components to seconds since January 1, 2000, 12:00:00 UTC. More... | |
| void | timer (const char *name, const char *file, const char *func, int line, int mode) |
| void | write_atm (const char *dirname, const char *filename, const ctl_t *ctl, const atm_t *atm) |
| void | write_atm_rfm (const char *filename, const ctl_t *ctl, const atm_t *atm) |
| void | write_matrix (const char *dirname, const char *filename, const ctl_t *ctl, const gsl_matrix *matrix, const atm_t *atm, const obs_t *obs, const char *rowspace, const char *colspace, const char *sort) |
| void | write_obs (const char *dirname, const char *filename, const ctl_t *ctl, const obs_t *obs) |
| void | write_shape (const char *filename, const double *x, const double *y, const int n) |
| void | write_stddev (const char *quantity, ret_t *ret, ctl_t *ctl, atm_t *atm, gsl_matrix *s) |
| void | write_tbl (const ctl_t *ctl, const tbl_t *tbl) |
| void | x2atm (const ctl_t *ctl, const gsl_vector *x, atm_t *atm) |
| void | x2atm_help (double *value, const gsl_vector *x, size_t *n) |
| void | y2obs (const ctl_t *ctl, const gsl_vector *y, obs_t *obs) |
JURASSIC library definitions.
Definition in file jurassic.c.
Definition at line 29 of file jurassic.c.

| void analyze_avk_quantity | ( | gsl_matrix * | avk, |
| int | iq, | ||
| int * | ipa, | ||
| size_t * | n0, | ||
| size_t * | n1, | ||
| double * | cont, | ||
| double * | res | ||
| ) |
Definition at line 86 of file jurassic.c.
Convert atmospheric data to state vector elements.
Extracts selected quantities from an atmospheric profile (atm_t) according to retrieval settings in ctl_t, and appends them to the state vector x. For each included quantity, the function also stores its quantity index (iqa) and profile index (ipa).
The function respects retrieval altitude limits defined in ctl (e.g., retp_zmin/zmax, rett_zmin/zmax, etc.) and includes only variables flagged for retrieval (e.g., ret_clz, ret_sft, etc.).
| [in] | ctl | Control settings defining retrieval configuration and limits. |
| [in] | atm | Atmospheric profile data to extract from. |
| [out] | x | GSL vector to store state-vector elements. |
| [out] | iqa | Quantity index array corresponding to elements in x. |
| [out] | ipa | Profile index array corresponding to elements in x. |
Definition at line 110 of file jurassic.c.

| void atm2x_help | ( | const double | value, |
| const int | value_iqa, | ||
| const int | value_ip, | ||
| gsl_vector * | x, | ||
| int * | iqa, | ||
| int * | ipa, | ||
| size_t * | n | ||
| ) |
Append a single atmospheric value to the state vector.
Helper routine for atm2x(). Inserts one scalar value and its corresponding quantity and profile indices into the state vector and tracking arrays, then increments the element counter.
| [in] | value | Value to add to the state vector. |
| [in] | value_iqa | Quantity index (e.g., IDXP, IDXT, etc.). |
| [in] | value_ip | Profile index within the atmospheric profile. |
| [out] | x | GSL vector containing state-vector elements (may be NULL). |
| [out] | iqa | Quantity index array corresponding to x (may be NULL). |
| [out] | ipa | Profile index array corresponding to x (may be NULL). |
| [in,out] | n | Current number of elements in the state vector; incremented on return. |
Definition at line 164 of file jurassic.c.
| void cart2geo | ( | const double * | x, |
| double * | z, | ||
| double * | lon, | ||
| double * | lat | ||
| ) |
Converts Cartesian coordinates to geographic coordinates.
This function converts a point from Cartesian coordinates (x, y, z) to geographic coordinates (longitude, latitude, and altitude). It uses the spherical Earth approximation for the conversion.
| x | Pointer to an array containing the Cartesian coordinates (x, y, z) in kilometers. |
| z | Pointer to a double where the computed altitude (above the reference ellipsoid) will be stored, in kilometers. |
| lon | Pointer to a double where the computed longitude (in degrees) will be stored. |
| lat | Pointer to a double where the computed latitude (in degrees) will be stored. |
Definition at line 185 of file jurassic.c.
Initializes atmospheric climatology profiles.
This function populates the atmospheric state (atm) with standard climatological profiles of pressure, temperature, and trace gas concentrations (e.g., H2O, CH4, CO, O3, etc.) as a function of altitude. The profiles are based on reference climatological datasets and are used for atmospheric modeling and radiative transfer calculations.
| [in] | ctl | Control parameters structure. |
| [out] | atm | Atmospheric state structure to be populated with climatological data. |
Definition at line 200 of file jurassic.c.

| double cost_function | ( | gsl_vector * | dx, |
| gsl_vector * | dy, | ||
| gsl_matrix * | s_a_inv, | ||
| gsl_vector * | sig_eps_inv | ||
| ) |
Definition at line 1138 of file jurassic.c.
| double ctmco2 | ( | const double | nu, |
| const double | p, | ||
| const double | t, | ||
| const double | u | ||
| ) |
Compute carbon dioxide continuum (optical depth).
Definition at line 1171 of file jurassic.c.
| double ctmh2o | ( | const double | nu, |
| const double | p, | ||
| const double | t, | ||
| const double | q, | ||
| const double | u | ||
| ) |
Compute water vapor continuum (optical depth).
Definition at line 2034 of file jurassic.c.
| double ctmn2 | ( | const double | nu, |
| const double | p, | ||
| const double | t | ||
| ) |
Compute N₂ collision-induced absorption coefficient.
Calculates the nitrogen (N₂) absorption coefficient due to collision-induced absorption (CIA) near the 4.3 µm CO₂ band using tabulated laboratory data for the absorption strength (B) and temperature exponent (β).
The function linearly interpolates B and β as a function of wavenumber, then applies a temperature- and pressure-dependent scaling relation to compute the absorption coefficient.
| [in] | nu | Wavenumber [cm⁻¹]. |
| [in] | p | Pressure [hPa]. |
| [in] | t | Temperature [K]. |
[Lafferty] et al., J. Quant. Spectrosc. Radiat. Transf., 68, 473–479 (2001)
Definition at line 3086 of file jurassic.c.

| double ctmo2 | ( | const double | nu, |
| const double | p, | ||
| const double | t | ||
| ) |
Compute O₂ collision-induced absorption coefficient.
Calculates the molecular oxygen (O₂) absorption coefficient due to collision-induced absorption (CIA) using tabulated laboratory data for the absorption strength (B) and temperature exponent (β).
The function linearly interpolates B and β as a function of wavenumber and applies a pressure- and temperature-dependent scaling relation to compute the absorption coefficient.
| [in] | nu | Wavenumber [cm⁻¹]. |
| [in] | p | Pressure [hPa]. |
| [in] | t | Temperature [K]. |
[Greenblatt] et al., J. Quant. Spectrosc. Radiat. Transf., 33, 127–140 (1985) [Smith] and Newnham, Appl. Opt., 39, 318–326 (2000)
Definition at line 3155 of file jurassic.c.

Copy or initialize atmospheric profile data.
Copies all fields from one atmospheric structure (atm_src) to another (atm_dest), including geolocation, thermodynamic, gas, extinction, cloud, and surface parameters. If init is nonzero, the destination fields are instead initialized to default values (zeros for most fields, unity for surface emissivity).
| [in] | ctl | Control structure defining array dimensions. |
| [out] | atm_dest | Destination atmospheric structure. |
| [in] | atm_src | Source atmospheric structure. |
| [in] | init | Initialization flag:
|
atm_src->np) determines the amount of data copied. The function performs shallow copies using memcpy for efficiency.Definition at line 3217 of file jurassic.c.
Copy or initialize observation geometry and radiance data.
Copies all observation fields from a source structure (obs_src) to a destination structure (obs_dest), including observer, view, and tangent point geometry, as well as radiance and transmittance data. If init is nonzero, radiance and transmittance values are reset to zero wherever finite values are found.
| [in] | ctl | Control structure defining the number of channels (ctl_t::nd) and other dimensions. |
| [out] | obs_dest | Destination observation structure. |
| [in] | obs_src | Source observation structure. |
| [in] | init | Initialization flag:
|
obs_src->nr) defines the copied data size. Shallow copies are performed via memcpy for efficiency.Definition at line 3267 of file jurassic.c.
| int find_emitter | ( | const ctl_t * | ctl, |
| const char * | emitter | ||
| ) |
Find gas species index by name.
Searches the list of emitter (gas) names defined in the control structure for a case-insensitive match to the given string. Returns the corresponding gas index if found, or -1 otherwise.
| [in] | ctl | Control structure containing the list of gas emitters. |
| [in] | emitter | Name of the gas species to search for (e.g. "H2O", "CO2"). |
strcasecmp().Definition at line 3305 of file jurassic.c.
Execute the selected forward model.
Computes synthetic radiances or brightness temperatures for the given atmospheric state and observation geometry using the selected forward-model method (CGA, EGA, or RFM). The function also applies hydrostatic adjustment, field-of-view convolution, and optional brightness-temperature conversion.
| [in] | ctl | Control structure defining model settings and options. |
| [in] | tbl | Emissivity and source-function lookup tables. |
| [in,out] | atm | Atmospheric profile; may be adjusted for hydrostatic balance. |
| [in,out] | obs | Observation geometry and radiance data; populated with model output. |
obs->rad elements marked as invalid (NaN) by applying an internal observation mask.Definition at line 3318 of file jurassic.c.

Compute total extinction including gaseous continua.
Calculates the total extinction coefficient for a given line-of-sight point by summing spectrally dependent extinction and optional gaseous continuum contributions (CO₂, H₂O, N₂, O₂).
The function updates the extinction array beta for each spectral channel based on line-by-line extinction and enabled continua flags specified in ctl.
| [in] | ctl | Control structure defining model setup and continuum options. |
| [in] | los | Line-of-sight data containing pressure, temperature, gas concentrations, and extinction coefficients. |
| [in] | ip | Index of the line-of-sight point to process. |
| [out] | beta | Array of total extinction coefficients [km⁻¹] per channel. |
Definition at line 3368 of file jurassic.c.

Apply field-of-view (FOV) convolution to modeled radiances.
Convolves pencil-beam radiances and transmittances along each ray path with the instrument field-of-view weighting function defined in the control structure. This simulates finite FOV effects on measured radiances and transmittances.
| [in] | ctl | Control structure containing FOV parameters (offsets ctl_t::fov_dz and weights ctl_t::fov_w). |
| [in,out] | obs | Observation structure; input pencil-beam data are replaced with FOV-convolved radiances and transmittances. |
| ERRMSG | if insufficient data are available for convolution. |
Definition at line 3404 of file jurassic.c.

| void formod_pencil | ( | const ctl_t * | ctl, |
| const tbl_t * | tbl, | ||
| const atm_t * | atm, | ||
| obs_t * | obs, | ||
| const int | ir | ||
| ) |
Compute line-of-sight radiances using the pencil-beam forward model.
Simulates monochromatic radiances and transmittances along a single line of sight using a layer-by-layer pencil-beam approximation. The model includes gaseous absorption, continuum extinction, surface emission, reflection, and optional solar illumination.
| [in] | ctl | Control structure defining model configuration, gas setup, surface type, and spectral parameters. |
| [in] | tbl | Emissivity and source-function lookup tables. |
| [in] | atm | Atmospheric state containing pressure, temperature, and gas profiles. |
| [in,out] | obs | Observation data; updated with modeled radiances and transmittances for the specified ray path. |
| [in] | ir | Index of the current ray path in obs. |
Definition at line 3469 of file jurassic.c.

Interface routine for the Reference Forward Model (RFM).
Prepares input data, executes the RFM executable, and imports simulated radiances and transmittances into the observation structure. The routine converts the atmospheric and geometric configuration from internal JURASSIC data structures into RFM-compatible driver and atmosphere files, then reads the RFM output spectra.
| [in] | ctl | Control structure defining model configuration, RFM executable path, HITRAN database, and spectral setup. |
| [in] | atm | Atmospheric state structure containing pressure, temperature, and gas profiles. |
| [in,out] | obs | Observation geometry and radiance data to be populated with RFM-computed radiances and transmittances. |
atm. It automatically determines whether the geometry is limb, nadir, or observer-based.RAD, TRA, MIX, CTM) based on the control settings. Temporary files such as rfm.drv, rfm.atm, and rad_*.asc are created and removed automatically.| ERRMSG | on inconsistent geometry, failed I/O, or system call errors. |
[Dudhia], A., "The Reference Forward Model (RFM)", JQSRT 186, 243–253 (2017)
Definition at line 3604 of file jurassic.c.

Interpolate the source function (Planck radiance) at a given temperature.
Computes source function values by linearly interpolating between precomputed Planck radiances in the lookup table. The resulting radiance spectrum corresponds to the input temperature and is stored in src for all spectral channels.
| [in] | ctl | Control structure defining the number of spectral channels. |
| [in] | tbl | Emissivity and source-function lookup table containing Planck radiances (tbl_t::sr) and corresponding temperatures (tbl_t::st). |
| [in] | t | Temperature [K] for which the source function is evaluated. |
| [out] | src | Output array of interpolated source-function values [W·m⁻²·sr⁻¹·cm⁻¹] per spectral channel. |
Definition at line 3745 of file jurassic.c.

| void geo2cart | ( | const double | z, |
| const double | lon, | ||
| const double | lat, | ||
| double * | x | ||
| ) |
Converts geographic coordinates (longitude, latitude, altitude) to Cartesian coordinates.
This function converts geographic coordinates specified by longitude, latitude, and altitude into Cartesian coordinates. The Earth is approximated as a sphere with radius defined by the constant RE.
| z | The altitude above the Earth's surface in kilometers. |
| lon | The longitude in degrees. |
| lat | The latitude in degrees. |
| x | Pointer to an array of three doubles where the computed Cartesian coordinates (x, y, z) will be stored. |
The function computes the Cartesian coordinates using the given altitude, longitude, and latitude. It assumes the Earth is a perfect sphere and uses the following formulas:
RE is defined as the Earth's radius in kilometers. Definition at line 3762 of file jurassic.c.
Adjust pressure profile using the hydrostatic equation.
Recomputes the atmospheric pressure field to ensure hydrostatic equilibrium with respect to altitude and temperature. Starting from a reference altitude (ctl_t::hydz), the routine integrates the hydrostatic balance equation both upward and downward through the profile using small interpolation steps.
The air density is corrected for humidity using the mean molecular mass of dry air and water vapor.
| [in] | ctl | Control structure providing model constants and reference altitude (ctl_t::hydz) and H₂O index (ctl_t::ig_h2o). |
| [in,out] | atm | Atmospheric state; input temperatures, heights, and humidities are used to update pressure [hPa]. |
Definition at line 3782 of file jurassic.c.
| void idx2name | ( | const ctl_t * | ctl, |
| const int | idx, | ||
| char * | quantity | ||
| ) |
Convert a quantity index to a descriptive name string.
Translates a model quantity index (e.g., pressure, temperature, gas mixing ratio, extinction, or surface parameter) into a human-readable name. The function uses the index mapping defined in the control structure to assign appropriate labels.
| [in] | ctl | Control structure containing gas, window, cloud, and surface setup information. |
| [in] | idx | Quantity index (see IDXP, IDXT, IDXQ, IDXK, etc.). |
| [out] | quantity | Character buffer to receive the descriptive quantity name (e.g., "PRESSURE", "H2O", "CLOUD_HEIGHT", "SURFACE_EMISSIVITY_1000.0"). |
quantity using sprintf(). The caller must ensure sufficient buffer size (≥ LEN).Definition at line 3842 of file jurassic.c.
Initialize the source-function (Planck radiance) lookup table.
Computes channel-averaged Planck radiances for a range of temperatures and stores them in the source-function table. For each spectral channel, the Planck function is integrated over the instrument filter function defined in the corresponding filter file (*.filt).
| [in] | ctl | Control structure defining spectral channels and table base name. |
| [out] | tbl | Emissivity and source-function lookup table to populate. |
<tblbase>_<wavenumber>.filt.Definition at line 3881 of file jurassic.c.

| void intpol_atm | ( | const ctl_t * | ctl, |
| const atm_t * | atm, | ||
| const double | z, | ||
| double * | p, | ||
| double * | t, | ||
| double * | q, | ||
| double * | k | ||
| ) |
Interpolate atmospheric state variables at a given altitude.
Computes pressure, temperature, volume mixing ratios, and extinction coefficients at the specified altitude by interpolating between adjacent model levels in the atmospheric profile.
| [in] | ctl | Control structure defining the number of gases (ctl_t::ng) and spectral windows (ctl_t::nw). |
| [in] | atm | Atmospheric profile providing altitude, pressure, temperature, gas mixing ratios, and extinction data. |
| [in] | z | Target altitude [km]. |
| [out] | p | Interpolated pressure [hPa]. |
| [out] | t | Interpolated temperature [K]. |
| [out] | q | Interpolated gas volume mixing ratios [ppv], length ctl_t::ng. |
| [out] | k | Interpolated extinction coefficients [km⁻¹], length ctl_t::nw. |
Definition at line 3935 of file jurassic.c.

| void intpol_tbl_cga | ( | const ctl_t * | ctl, |
| const tbl_t * | tbl, | ||
| const los_t * | los, | ||
| const int | ip, | ||
| double | tau_path[ND][NG], | ||
| double | tau_seg[ND] | ||
| ) |
Interpolate emissivities and transmittances using the Curtis–Godson approximation (CGA).
Computes gas transmittance along a line-of-sight segment by interpolating precomputed emissivity values from lookup tables. The interpolation is performed in pressure, temperature, and column density space using bilinear (in p, T) and logarithmic (in p) interpolation.
| [in] | ctl | Control structure defining number of gases (ctl_t::ng) and channels (ctl_t::nd). |
| [in] | tbl | Emissivity lookup tables (tbl_t) containing tabulated pressure, temperature, and column density grids. |
| [in] | los | Line-of-sight structure providing Curtis–Godson mean parameters and column densities. |
| [in] | ip | Index of the current LOS point. |
| [in,out] | tau_path | Path transmittance array [nd][ng]; updated cumulatively for each gas. |
| [out] | tau_seg | Total segment transmittance per channel [nd]. |
tbl->eps) for each gas and channel.Definition at line 3960 of file jurassic.c.

| void intpol_tbl_ega | ( | const ctl_t * | ctl, |
| const tbl_t * | tbl, | ||
| const los_t * | los, | ||
| const int | ip, | ||
| double | tau_path[ND][NG], | ||
| double | tau_seg[ND] | ||
| ) |
Interpolate emissivities and transmittances using the Emissivity Growth Approximation (EGA).
Computes gas transmittance along a line-of-sight segment by interpolating emissivity values from lookup tables based on the Emissivity Growth Approximation (EGA). The interpolation is performed in pressure, temperature, and effective column density space derived from the local LOS properties.
| [in] | ctl | Control structure defining number of gases (ctl_t::ng) and channels (ctl_t::nd). |
| [in] | tbl | Emissivity lookup tables (tbl_t) containing tabulated pressure, temperature, and column density grids. |
| [in] | los | Line-of-sight structure providing local pressure, temperature, and column density data. |
| [in] | ip | Index of the current LOS point. |
| [in,out] | tau_path | Path transmittance array [nd][ng]; updated cumulatively for each gas. |
| [out] | tau_seg | Total segment transmittance per channel [nd]. |
tbl->eps) and performs bilinear interpolation in pressure and temperature.Definition at line 4049 of file jurassic.c.

|
inline |
Interpolate emissivity from lookup tables as a function of column density.
Retrieves the emissivity corresponding to a given column density u for a specific gas, channel, pressure level, and temperature index from the precomputed emissivity tables.
| [in] | tbl | Emissivity lookup tables (tbl_t). |
| [in] | ig | Gas index. |
| [in] | id | Channel index. |
| [in] | ip | Pressure level index. |
| [in] | it | Temperature level index. |
| [in] | u | Column density [molecules/cm²]. |
u for u < u_min.eps → 1 as u → ∞).tbl->u and tbl->eps.Definition at line 4145 of file jurassic.c.

|
inline |
Interpolate column density from lookup tables as a function of emissivity.
Returns the column density corresponding to a given emissivity eps for a specific gas, channel, pressure level, and temperature index from the precomputed emissivity tables.
| [in] | tbl | Emissivity lookup tables (tbl_t). |
| [in] | ig | Gas index. |
| [in] | id | Channel index. |
| [in] | ip | Pressure level index. |
| [in] | it | Temperature level index. |
| [in] | eps | Emissivity value (0–1). |
eps < eps_min, applies linear extrapolation proportional to emissivity.eps > eps_max, applies exponential extrapolation following the emissivity growth law.tbl->eps and tbl->u.Definition at line 4177 of file jurassic.c.

| void jsec2time | ( | const double | jsec, |
| int * | year, | ||
| int * | mon, | ||
| int * | day, | ||
| int * | hour, | ||
| int * | min, | ||
| int * | sec, | ||
| double * | remain | ||
| ) |
Converts Julian seconds to calendar date and time components.
This function converts Julian seconds to calendar date and time components, including year, month, day, hour, minute, and second. It also calculates the fractional part of the seconds.
| jsec | Julian seconds to convert. |
| year | Pointer to store the year. |
| mon | Pointer to store the month. |
| day | Pointer to store the day. |
| hour | Pointer to store the hour. |
| min | Pointer to store the minute. |
| sec | Pointer to store the second. |
| remain | Pointer to store the fractional part of seconds. |
The function initializes a time structure t0 with a fixed starting date and time. It then converts the Julian seconds to a time_t type by adding the seconds to the epoch time. Next, it converts the time_t value to a UTC time structure t1. Finally, it extracts the year, month, day, hour, minute, and second components from t1 and calculates the fractional part of seconds, which is stored in remain.
Definition at line 4209 of file jurassic.c.
Compute the Jacobian (kernel) matrix by finite differences.
Evaluates the sensitivity of the simulated radiances to each element of the atmospheric state vector by perturbing one parameter at a time and re-running the forward model. The result is the Jacobian matrix \( K = \partial y / \partial x \), where y is the measurement vector and x is the state vector.
| [in] | ctl | Control structure defining retrieval configuration and model setup. |
| [in] | tbl | Emissivity lookup tables used by the forward model. |
| [in] | atm | Atmospheric state vector and profile data. |
| [in] | obs | Observation geometry and radiance data. |
| [out] | k | Jacobian matrix [m×n], where m is the number of measurements and n the number of state variables. |
h depending on its physical type (pressure, temperature, VMR, etc.).Definition at line 4242 of file jurassic.c.

| int locate_irr | ( | const double * | xx, |
| const int | n, | ||
| const double | x | ||
| ) |
Locate index for interpolation on an irregular grid.
Finds the lower index ilo such that \( xx[ilo] \le x < xx[ilo+1] \) for monotonically increasing or decreasing grids.
Used in interpolation routines for altitude, pressure, temperature, or wavenumber profiles that are not evenly spaced.
| [in] | xx | Array of monotonic grid values (increasing or decreasing). |
| [in] | n | Number of grid points. |
| [in] | x | Target value to locate within the grid range. |
ilo of the lower grid point surrounding x.x lies within the range of xx; no bounds checking beyond the first and last grid points is performed.Definition at line 4337 of file jurassic.c.
| int locate_reg | ( | const double * | xx, |
| const int | n, | ||
| const double | x | ||
| ) |
Locate index for interpolation on a regular (uniform) grid.
Computes the lower index i such that \( xx[i] \le x < xx[i+1] \) for evenly spaced grid points. Used for quick index lookup when the grid spacing is constant.
| [in] | xx | Array of regularly spaced grid values. |
| [in] | n | Number of grid points. |
| [in] | x | Target value to locate within the grid range. |
i of the lower grid point surrounding x.[0, n - 2] to avoid out-of-bounds indices.Definition at line 4367 of file jurassic.c.
|
inline |
Locate index for interpolation within emissivity table grids.
Finds the lower index ilo such that \( xx[ilo] \le x < xx[ilo+1] \) in a monotonically increasing single-precision grid.
Used for emissivity and column density interpolation in table-based routines such as intpol_tbl_eps and intpol_tbl_u.
| [in] | xx | Monotonic (increasing) single-precision grid array. |
| [in] | n | Number of grid points. |
| [in] | x | Target value to locate within the grid range. |
ilo of the lower grid point surrounding x.float to minimize memory use.x lies within the table range.Definition at line 4386 of file jurassic.c.
| void matrix_invert | ( | gsl_matrix * | a | ) |
Definition at line 4408 of file jurassic.c.
| void matrix_product | ( | gsl_matrix * | a, |
| gsl_vector * | b, | ||
| int | transpose, | ||
| gsl_matrix * | c | ||
| ) |
Definition at line 4438 of file jurassic.c.
Convert observation radiances into a measurement vector.
Extracts all finite radiance values from the observation structure and stores them sequentially in a GSL vector.
Optionally records detector (id) and ray path (ir) indices for each measurement element.
| [in] | ctl | Control structure containing observation setup (e.g. number of detectors). |
| [in] | obs | Observation data structure containing radiances. |
| [out] | y | Measurement vector to store radiances (may be NULL). |
| [out] | ida | Optional array to store detector indices (may be NULL). |
| [out] | ira | Optional array to store ray path indices (may be NULL). |
nd) and ray paths (nr).NaN or Inf) radiance values.ida and ira must be preallocated with sufficient size to hold all finite radiances if provided.Definition at line 4483 of file jurassic.c.
Perform line-of-sight (LOS) ray tracing through the atmosphere.
Computes the geometric path of a viewing ray from the observer to the atmosphere (and possibly the surface), accounting for spherical geometry, optional refraction, and cloud or surface interactions.
Fills the LOS structure with pressure, temperature, gas concentrations, extinction, and path length at each step.
| [in] | ctl | Control structure containing model and numerical settings. |
| [in] | atm | Atmospheric state structure (profiles of p, T, q, k, etc.). |
| [in,out] | obs | Observation geometry and radiance data; updated tangent point. |
| [out] | los | Line-of-sight structure to be populated with sampled quantities. |
| [in] | ir | Index of the current ray path in the observation set. |
ds determined by altitude and user-specified controls (rayds, raydz).n(p, T).NLOS.Definition at line 4510 of file jurassic.c.

Read atmospheric profile data from an ASCII file.
Loads an atmospheric state profile into the atm_t structure from a text file containing altitude-dependent quantities such as pressure, temperature, volume mixing ratios, and extinction coefficients.
Optionally reads cloud and surface parameters for the first level.
| [in] | dirname | Directory containing the input file (may be NULL). |
| [in] | filename | Atmospheric profile filename. |
| [in] | ctl | Control structure defining number of gases, windows, etc. |
| [out] | atm | Atmospheric data structure to be filled with profile data. |
ng emitters,nw windows. clz, cldz, clk) and surface (sft, sfeps) parameters if enabled in ctl.NP.Definition at line 4746 of file jurassic.c.
| void read_ctl | ( | int | argc, |
| char * | argv[], | ||
| ctl_t * | ctl | ||
| ) |
Read model control parameters from command-line and configuration input.
Parses all numerical and string parameters required to initialize a JURASSIC simulation, including atmospheric composition, radiative channels, cloud and surface options, continua, ray-tracing setup, retrieval parameters, and output settings.
Populates the ctl_t structure with all configuration values.
| [in] | argc | Argument count from the command line. |
| [in] | argv | Argument vector containing user-specified options. |
| [out] | ctl | Control structure to be filled with parsed settings. |
NG, EMITTER),ND, NU, WINDOW),NCL, CLNU),NSF, SFNU, SFTYPE, SFSZA),HYDZ),CTM_CO2, CTM_H2O, CTM_N2, CTM_O2),REFRAC, RAYDS, RAYDZ),FOV),RETP_ZMIN, RETQ_ZMAX, etc.),WRITE_BBT, WRITE_MATRIX),RFMBIN, RFMHIT, RFMXSC).NG > NG_MAX).NCL > 1, NSF > 1).ERRMSG() aborts.Definition at line 4848 of file jurassic.c.

| void read_matrix | ( | const char * | dirname, |
| const char * | filename, | ||
| gsl_matrix * | matrix | ||
| ) |
Read a numerical matrix from an ASCII file.
Loads values into a GSL matrix from a text file containing sparse or indexed entries in tabular format.
Each valid line is parsed for row and column indices and the corresponding value.
| [in] | dirname | Directory path containing the matrix file (may be NULL). |
| [in] | filename | Name of the matrix file to read. |
| [out] | matrix | Pointer to the GSL matrix to be filled with values. |
gsl_matrix_set().Definition at line 4962 of file jurassic.c.
Read observation geometry and radiance data from an ASCII file.
Loads line-of-sight (LOS) and radiance information into the obs_t structure from a text file. Each record represents one observation ray with associated geometry (observer, view point, tangent point) and optionally measured radiances and transmittances for multiple spectral channels.
| [in] | dirname | Directory containing the input file (may be NULL). |
| [in] | filename | Observation data filename. |
| [in] | ctl | Control structure defining number of radiance channels. |
| [out] | obs | Observation data structure to be populated. |
nd channels,WRITE_BBT flag.NR or no data are read.Definition at line 5002 of file jurassic.c.
| double read_obs_rfm | ( | const char * | basename, |
| const double | z, | ||
| double * | nu, | ||
| double * | f, | ||
| int | n | ||
| ) |
Read and spectrally convolve an RFM output spectrum.
Opens the appropriate RFM ASCII spectrum file for a given tangent or observation altitude and convolves the high-resolution spectrum with a provided instrument filter function.
Returns the integrated (filtered) radiance value.
| [in] | basename | Base filename of the RFM output (e.g. "rad" or "tra"). |
| [in] | z | Altitude [km] used to select the corresponding RFM file. |
| [in] | nu | Wavenumber grid [cm⁻¹] of the filter function. |
| [in] | f | Filter transmission values corresponding to nu. |
| [in] | n | Number of points in nu and f arrays. |
basename_<altitude_in_meters>.asc (e.g. rad_04500.asc).nurfm) and radiances (rad).\[ R = \frac{\int f(\nu) \, I(\nu) \, d\nu}{\int f(\nu) \, d\nu} \]
nu and f arrays are monotonic and have at least two points.Definition at line 5103 of file jurassic.c.

Definition at line 5161 of file jurassic.c.

| void read_rfm_spec | ( | const char * | filename, |
| double * | nu, | ||
| double * | rad, | ||
| int * | npts | ||
| ) |
Read a Reference Forward Model (RFM) ASCII spectrum.
Parses an RFM output file containing high-resolution spectral radiances and fills the provided arrays with wavenumber and radiance values.
| [in] | filename | Name of the RFM ASCII spectrum file (e.g. "rad_04500.asc"). |
| [out] | nu | Array to receive the spectral wavenumber grid [cm⁻¹]. |
| [out] | rad | Array to receive the corresponding radiances. |
| [out] | npts | Pointer to integer receiving the number of spectral points. |
npts),nu0 [cm⁻¹],dnu [cm⁻¹],nu1 [cm⁻¹].nu0 and nu1: \[ \nu_i = \nu_0 + i \, \frac{\nu_1 - \nu_0}{N - 1}, \quad i = 0,\dots,N-1 \]
RFMNPTS..asc output.Definition at line 5214 of file jurassic.c.
| void read_shape | ( | const char * | filename, |
| double * | x, | ||
| double * | y, | ||
| int * | n | ||
| ) |
Read a two-column shape function from an ASCII file.
Loads tabulated x–y data pairs (e.g., filter transmission or field-of-view weighting function) into the provided arrays.
| [in] | filename | Name of the ASCII file containing the shape function. |
| [out] | x | Array to receive the abscissa values. |
| [out] | y | Array to receive the ordinate values. |
| [out] | n | Pointer to integer receiving the number of data points read. |
x), typically wavenumber [cm⁻¹] or angular offset [deg].y), typically transmission or weighting value.NSHAPE.x values.Definition at line 5275 of file jurassic.c.
Read gas emissivity look-up tables for all channels and emitters.
Loads precomputed emissivity tables from disk into a newly allocated tbl_t structure. Each table contains gas emissivity data as a function of pressure, temperature, and column density, required for radiative transfer using the CGA (Curtis–Godson Approximation) or EGA (Emissivity Growth Approximation).
| [in] | ctl | Pointer to the control structure containing configuration and table file parameters. |
id) and each trace gas (ig), the routine attempts to open a table file named: <TBLBASE> is ctl->tblbase<NU> is the channel wavenumber [cm⁻¹]<EMITTER> is the gas name (e.g. "CO2", "H2O").tab for ASCII or .bin for binary format.ctl->tblfmt:p = pressure [hPa], T = temperature [K], u = column density [molec/cm²].[UMIN,UMAX] or [EPSMIN,EPSMAX]) are skipped with a warning.TBLNP, TBLNT, and TBLNU.TBLNP, TBLNT, TBLNU).FREAD macros to ensure platform-independent precision and array sizes.Definition at line 5317 of file jurassic.c.

| double scan_ctl | ( | int | argc, |
| char * | argv[], | ||
| const char * | varname, | ||
| const int | arridx, | ||
| const char * | defvalue, | ||
| char * | value | ||
| ) |
Scan control file or command-line arguments for a configuration variable.
Searches for a named variable in the JURASSIC control file or command-line arguments, returning its value as a double. Optionally stores the value as a string and supports array-style parameters (e.g., EMITTER[0], NU[5]).
| [in] | argc | Number of command-line arguments. |
| [in] | argv | Command-line argument vector. |
| [in] | varname | Name of the control variable to read. |
| [in] | arridx | Array index (use -1 for scalar variables). |
| [in] | defvalue | Default value if variable is not found (can be empty). |
| [out] | value | Optional pointer to a string buffer receiving the value (may be NULL if only numeric output is required). |
double.argv[1]), unless it starts with ‘’-'`.VAR (scalar)VAR[index] (explicit array index)VAR[*] (wildcard entry applying to all indices)Definition at line 5491 of file jurassic.c.
| double sza | ( | double | sec, |
| double | lon, | ||
| double | lat | ||
| ) |
Compute the solar zenith angle for a given time and location.
Calculates the apparent solar zenith angle (SZA) [deg] based on the observer’s longitude, latitude, and time since 2000-01-01 T00:00 Z.
| [in] | sec | Seconds since 2000-01-01 T00:00 Z. |
| [in] | lon | Observer longitude [deg]. |
| [in] | lat | Observer latitude [deg]. |
\[ \cos(\theta) = \sin(\varphi)\sin(\delta) + \cos(\varphi)\cos(\delta)\cos(h) \]
where \(\varphi\) = latitude, \(\delta\) = declination, \(h\) = hour angle.Definition at line 5560 of file jurassic.c.
Definition at line 5600 of file jurassic.c.

| void set_cov_meas | ( | ret_t * | ret, |
| ctl_t * | ctl, | ||
| obs_t * | obs, | ||
| gsl_vector * | sig_noise, | ||
| gsl_vector * | sig_formod, | ||
| gsl_vector * | sig_eps_inv | ||
| ) |
Definition at line 5711 of file jurassic.c.

| void tangent_point | ( | const los_t * | los, |
| double * | tpz, | ||
| double * | tplon, | ||
| double * | tplat | ||
| ) |
Determine the tangent point along a line of sight (LOS).
Computes the location of the tangent point — the point of minimum altitude — along the current line of sight, based on the LOS geometry stored in los_t.
| [in] | los | Pointer to the line-of-sight (LOS) structure containing altitude, longitude, latitude, and segment length data. |
| [out] | tpz | Pointer to variable receiving tangent point altitude [km]. |
| [out] | tplon | Pointer to variable receiving tangent point longitude [deg]. |
| [out] | tplat | Pointer to variable receiving tangent point latitude [deg]. |
ds) must be consistent with the geometric spacing between altitude points for the interpolation to be accurate.Definition at line 5755 of file jurassic.c.

| void time2jsec | ( | const int | year, |
| const int | mon, | ||
| const int | day, | ||
| const int | hour, | ||
| const int | min, | ||
| const int | sec, | ||
| const double | remain, | ||
| double * | jsec | ||
| ) |
Converts time components to seconds since January 1, 2000, 12:00:00 UTC.
This function calculates the number of seconds elapsed since January 1, 2000, 12:00:00 UTC, based on the provided year, month, day, hour, minute, and second. It also includes a fractional part to represent the remaining seconds.
| year | The year. |
| mon | The month (1-12). |
| day | The day of the month (1-31). |
| hour | The hour of the day (0-23). |
| min | The minute (0-59). |
| sec | The second (0-59). |
| remain | The fractional part of seconds. |
| jsec | Pointer to store the calculated number of seconds since January 1, 2000, 12:00:00 UTC. |
The function calculates the time elapsed since January 1, 2000, 12:00:00 UTC, up to the specified time and includes any fractional seconds indicated by the "remain" parameter.
Definition at line 5799 of file jurassic.c.
| void timer | ( | const char * | name, |
| const char * | file, | ||
| const char * | func, | ||
| int | line, | ||
| int | mode | ||
| ) |
Definition at line 5830 of file jurassic.c.
| void write_atm | ( | const char * | dirname, |
| const char * | filename, | ||
| const ctl_t * | ctl, | ||
| const atm_t * | atm | ||
| ) |
Definition at line 5868 of file jurassic.c.
Definition at line 5985 of file jurassic.c.
| void write_matrix | ( | const char * | dirname, |
| const char * | filename, | ||
| const ctl_t * | ctl, | ||
| const gsl_matrix * | matrix, | ||
| const atm_t * | atm, | ||
| const obs_t * | obs, | ||
| const char * | rowspace, | ||
| const char * | colspace, | ||
| const char * | sort | ||
| ) |
Definition at line 6023 of file jurassic.c.

| void write_obs | ( | const char * | dirname, |
| const char * | filename, | ||
| const ctl_t * | ctl, | ||
| const obs_t * | obs | ||
| ) |
Definition at line 6201 of file jurassic.c.
| void write_shape | ( | const char * | filename, |
| const double * | x, | ||
| const double * | y, | ||
| const int | n | ||
| ) |
Definition at line 6311 of file jurassic.c.
Definition at line 6341 of file jurassic.c.

Definition at line 6374 of file jurassic.c.
Definition at line 6460 of file jurassic.c.

| void x2atm_help | ( | double * | value, |
| const gsl_vector * | x, | ||
| size_t * | n | ||
| ) |
Definition at line 6510 of file jurassic.c.
Definition at line 6522 of file jurassic.c.