external_interface.h
Go to the documentation of this file.
1 //
2 // Created by Juan Carlos Antuña-Sánchez on 10/8/21.
3 //
4 #include <stdbool.h>
5 #include "mod_par_OS.inc"
6 #include "mod_par_DLS.inc"
7 #include "mod_par_inv.inc"
8 
9 #ifndef EXTERNAL_INTERFACE_H
10 #define EXTERNAL_INTERFACE_H
11 #define MAX(x,y) ((x>y)?x:y)
12 
13 #define _NLEVEL_GAS _KVERT_WD
14 
15 typedef struct radiative_transfer_args_ {
16  int IW;
17  int NG;
18  int NN;
19  int NF;
20  int iBRDF;
21  int iBPDF;
22  int iBRM_water;
23  float land_percent;
24  int NQDR;
25  int NT1[2];
26  float tetas;
27  int NBV;
28  float vis[2 * _NBVM];
29  float fiv[2 * _NBVM];
30  float WAVE;
31  int n_par_land;
33  float surf_land_par_vect[2 * _KBF];
35  float surf_water_par_vect[_KBF];
36  float EXT[_NMM + _NMG];
37  float SSA[_NMM + _NMG];
38  int NANG;
39  float ANGL[_KMpar];
40  float SD[_KSD][_KIDIM3];
41  float CEXT[_KSD];
42  float HOBS_km;
43  float HGR_km;
44  float HMAX_atm_km;
45  int NHVP_retr;
46  float HVP_retr_km[_KVERTM];
47  float H0[_KSD][_KVERTM];
48  float sigma_aerosol[_KSD];
49  int ifgas;
50  float gaspar;
52  float STEMP;
53  bool laerosol;
54  bool lsurface;
55  bool ATMOS_EMIS;
56  bool SOLAR_EMIS;
57  float PF11_I[_KSD][_KMpar];
58  float PF12_I[_KSD][_KMpar];
59  float PF22_I[_KSD][_KMpar];
60  float PF33_I[_KSD][_KMpar];
61  int NLV;
62  float HLV[_KNT];
64  bool gas_abs_line;
65  int N_level;
66  float Hight_level_km[MAX(_KVERTM, _KVERT_WD)];
67  int nh;
68  float h_km[_KVERT_WD];
69  int natm;
70  int naer;
71  int nmol;
72  int ngas;
73  float norm_DISCRVD[_NMM + _NMG];
74  bool ISGL;
75  bool IAER;
76  bool IVEC_CTL;
77  bool ISRF;
78  bool IDWN;
79  bool IFLX;
80  bool IGQ_F;
81  bool IGQ_D;
82  bool IGQ_BRM_FEXP;
83  bool IGQ_BRM_HSPH;
84  bool IP_VERBOSE;
85  bool IP_ADDITION;
86  bool ITRC;
87  bool ISCA;
88  bool IVEC_SET;
89  bool IWUT;
90  bool ILUT;
91  bool IATM;
92  bool ICRR;
93  bool boa_ref;
94  int AER_PRF;
95  int MOL_PRF;
96  int NA;
97  int NB[_KSD];
98  int NLYR[2];
99  float EPS;
101 
103  float thd[2*_NBVM];
104  float SLout[2*_NBVM];
105  float SQout[2*_NBVM];
106  float SUout[2*_NBVM];
107  float SLPout[2*_NBVM];
108  float salb_out;
109  float UFX[_KNT];
110  float DFX[_KNT];
112 
113 /*
114  * Actual function is implemented in fortran, which is why we have the full list of parameters here as well
115  */
116 extern void grasp_rt_sos_(int IW, int NG, int NN, int NF,
117  int iBRDF, int iBPDF, int iBRM_water, float land_percent,
118  int NQDR, int NT1[2], float tetas, int NBV, float vis[2*_NBVM], float fiv[2*_NBVM],
119  float WAVE,
120  int n_par_land, int n_par_land_i, float surf_land_par_vect[2*_KBF],
121  int n_par_water, float surf_water_par_vect[_KBF],
122  float EXT[_NMM+_NMG], float SSA[_NMM+_NMG],
123  int NANG, float ANGL[_KMpar],
124  float SD[_KSD][_KIDIM3], float CEXT[_KSD],
125  float HOBS_km, float HGR_km, float HMAX_atm_km,
126  int NHVP_retr, float HVP_retr_km[_KVERTM],
127  float H0[_KSD][_KVERTM], float sigma_aerosol[_KSD],
128  int ifgas, float gaspar,
129  float T_profile[_NLEVEL_GAS], float STEMP,
130  bool laerosol, bool lsurface,
131  bool ATMOS_EMIS, bool SOLAR_EMIS,
132  float PF11_I[_KSD][_KMpar], float PF12_I[_KSD][_KMpar],
133  float PF22_I[_KSD][_KMpar], float PF33_I[_KSD][_KMpar],
134  int NLV, float HLV[_KNT],
135  bool aerosol_analyt_prof, bool gas_abs_line,
136  int N_level,
137  float Hight_level_km[MAX(_KVERTM,_KVERT_WD)],
138  int nh,
139  float h_km[_KVERT_WD],
140  int natm, int naer, int nmol, int ngas,
141  float norm_DISCRVD[_NMM+_NMG],
142  bool ISGL, bool IAER, bool IVEC_CTL, bool ISRF, bool IDWN, bool IFLX,
143  bool IGQ_F, bool IGQ_D, bool IGQ_BRM_FEXP, bool IGQ_BRM_HSPH,
144  bool IP_VERBOSE, bool IP_ADDITION, bool ITRC, bool ISCA, bool IVEC_SET,
145  bool IWUT, bool ILUT, bool IATM, bool ICRR, bool boa_ref,
146  int AER_PRF, int MOL_PRF,
147  int NA, int NB[_KSD],
148  int NLYR[2], float EPS,
149  float thd[2*_NBVM],
150  float SLout[2*_NBVM], float SQout[2*_NBVM], float SUout[2*_NBVM], float SLPout[2*_NBVM],
151  float *salb_out,
152  float UFX[_KNT], float DFX[_KNT]);
153 
155 
156 #endif //EXTERNAL_INTERFACE_H
bool IP_VERBOSE
IP_VERBOSE - Related with output format.
Definition: external_interface.h:84
bool boa_ref
boa_ref - Selectes between different surface models
Definition: external_interface.h:93
float WAVE
WAVE - Wavelength in micrometers.
Definition: external_interface.h:30
int natm
natm - Number of total atmospheric components
Definition: external_interface.h:69
float land_percent
land_percent - Percent of surface corresponding to land model
Definition: external_interface.h:23
int ifgas
ifgas - Selects if gas absorption is incuded or not (old gas model)
Definition: external_interface.h:49
bool IFLX
IFLX - Marks is flux calculations is going to be done (not possible with the actual approach of the s...
Definition: external_interface.h:79
int NA
NA - RT kernels approach: number of aerosol modes.
Definition: external_interface.h:96
int n_par_land
n_par_land - total number of surface parameters (BRDF+BPDF) for land
Definition: external_interface.h:31
float CEXT[_KSD]
CEXT - RT kernels approach: extinction. Related to LUT generation.
Definition: external_interface.h:41
float thd[2 *_NBVM]
thd - Measurement azimuth angle (degrees)
Definition: external_interface.h:103
float HGR_km
HGR_km - Station altitude in km.
Definition: external_interface.h:43
bool IGQ_BRM_FEXP
IGQ_BRM_FEXP - Surface quadrature calculations for Fourier components.
Definition: external_interface.h:82
float SD[_KSD][_KIDIM3]
SD - RT kernels approach: Size distribution. Related to LUT generation.
Definition: external_interface.h:40
float EXT[_NMM+_NMG]
EXT - Extinction for each.
Definition: external_interface.h:36
int NLV
NLV - Number of levels.
Definition: external_interface.h:61
float gaspar
gaspar - Gas absorption value (old gas model)
Definition: external_interface.h:50
int ngas
ngas - Number of total gaseous components
Definition: external_interface.h:72
float DFX[_KNT]
DFX - Fluxes.
Definition: external_interface.h:110
float h_km[_KVERT_WD]
h_km - Height of layers in the aerosol profile
Definition: external_interface.h:68
float SQout[2 *_NBVM]
SQout - Calculated radiance in the selected viewing geometry.
Definition: external_interface.h:105
float SLPout[2 *_NBVM]
SLPout - Calculated radiance in the selected viewing geometry.
Definition: external_interface.h:107
bool IGQ_D
IGQ_D - Quadrature calculation for dericatives in inversion mode.
Definition: external_interface.h:81
bool IGQ_F
IGQ_F - Quadrature calculation in forward mode.
Definition: external_interface.h:80
bool ISGL
ISGL - To restrict the code to single scattering calculations.
Definition: external_interface.h:74
bool IATM
IATM - Choose between bihemispherical or directional hemispherical reflectance of atmosphere.
Definition: external_interface.h:91
int naer
naer - Number of total aerosol modes
Definition: external_interface.h:70
bool laerosol
laerosol - Selects if aerosol is present in the atmosphere
Definition: external_interface.h:53
float tetas
tetas - Solar Zenith Angle
Definition: external_interface.h:26
int AER_PRF
AER_PRF - Aerosol profile shape.
Definition: external_interface.h:94
float surf_land_par_vect[2 *_KBF]
surf_land_par_vect - Parameters describing land surface
Definition: external_interface.h:33
float UFX[_KNT]
UFX - Fluxes.
Definition: external_interface.h:109
int MOL_PRF
MOL_PRF - Molecular profile shape.
Definition: external_interface.h:95
bool ILUT
ILUT - Use LUTs already generated.
Definition: external_interface.h:90
int iBRDF
iBRDF - Establish if surface directional scattering is taken into account
Definition: external_interface.h:20
int N_level
N_level - Number of levels.
Definition: external_interface.h:65
bool IP_ADDITION
IP_ADDITION - Related with output additional information.
Definition: external_interface.h:85
bool IWUT
IWUT - Lut generation.
Definition: external_interface.h:89
struct radiative_transfer_result_ radiative_transfer_result
Definition: external_interface.h:15
integer, parameter natm
Definition: sub_gas_abs_kd.f90:18
float PF22_I[_KSD][_KMpar]
PF22_I - Aerosol phase matrix.
Definition: external_interface.h:59
float SLout[2 *_NBVM]
SLout - Calculated radiance in the selected viewing geometry.
Definition: external_interface.h:104
bool ICRR
ICRR - Atmospheric correction.
Definition: external_interface.h:92
void grasp_rt_sos(radiative_transfer_args *args, radiative_transfer_result *result)
Definition: external_interface.c:7
float SSA[_NMM+_NMG]
SSA - Single scattering albedo for each atmospheric component.
Definition: external_interface.h:37
float norm_DISCRVD[_NMM+_NMG]
norm_DISCRVD - Norm of atmospheric vertical profile
Definition: external_interface.h:73
int NG
NG - Number of gaussian quadrature points.
Definition: external_interface.h:17
#define MAX(x, y)
Definition: external_interface.h:11
float sigma_aerosol[_KSD]
sigma_aerosol - Parameters for aerosol vertical profile shape
Definition: external_interface.h:48
bool lsurface
lsurface - Selects if surface is present in the calculations
Definition: external_interface.h:54
int NT1[2]
NT1 - Number of layers.
Definition: external_interface.h:25
float T_profile[_NLEVEL_GAS]
T_profile - Temperature profile for each level Only necessary if emission is accounted.
Definition: external_interface.h:51
bool ITRC
ITRC - Marks if Phase matrix truncation is going to be done.
Definition: external_interface.h:86
int NBV
NBV - Number of observations.
Definition: external_interface.h:27
float STEMP
STEMP - Surface temperature. Only necesary if emission is accounted.
Definition: external_interface.h:52
float salb_out
salb_out - Surface albedo
Definition: external_interface.h:108
#define _NLEVEL_GAS
Definition: external_interface.h:13
int NQDR
NQDR - Number of angular quadrature points.
Definition: external_interface.h:24
bool aerosol_analyt_prof
aerosol_analyt_prof - Marks if the the exact aerosol profiles is known or an analytic shape is going ...
Definition: external_interface.h:63
bool IGQ_BRM_HSPH
IGQ_BRM_HSPH - High precision surface quadrature calculations.
Definition: external_interface.h:83
float H0[_KSD][_KVERTM]
H0 - Contains parameters of aerosol vertical distribution or distribution itself.
Definition: external_interface.h:47
int nh
nh - Number of layers in the aerosol profile
Definition: external_interface.h:67
bool ATMOS_EMIS
ATMOS_EMIS - To account for thermal emission.
Definition: external_interface.h:55
int NLYR[2]
NLYR - Number of layers.
Definition: external_interface.h:98
int NN
NN - Number of quadrature expansions.
Definition: external_interface.h:18
bool ISCA
ISCA - Output in scattering or meridian plane.
Definition: external_interface.h:87
float surf_water_par_vect[_KBF]
surf_water_par_vect - Parameters describing water surface
Definition: external_interface.h:35
int NANG
NANG - number of scattering angles of phase matrix NANG.
Definition: external_interface.h:38
float PF11_I[_KSD][_KMpar]
PF11_I - Aerosol phase matrix.
Definition: external_interface.h:57
int NHVP_retr
NHVP_retr - Number of altitudes for retrieved vertical profile.
Definition: external_interface.h:45
bool IDWN
IDWN - Marks if the calculations are upwards or downwards.
Definition: external_interface.h:78
int n_par_water
n_par_water - number of BRDF surface parameters for water
Definition: external_interface.h:34
bool IVEC_SET
IVEC_SET - Scalar or vector calculations.
Definition: external_interface.h:88
float fiv[2 *_NBVM]
fiv - Observation Azimuth angle (degrees)
Definition: external_interface.h:29
bool gas_abs_line
gas_abs_line - Marks if there is gas absorption included (new model)
Definition: external_interface.h:64
int n_par_land_i
n_par_land_i - number of BRDF surface parameters for land
Definition: external_interface.h:32
Definition: external_interface.h:102
float vis[2 *_NBVM]
vis - Observation Zenith angle (degrees)
Definition: external_interface.h:28
float EPS
EPS - Related with precision of some numerical expansions.
Definition: external_interface.h:99
float HMAX_atm_km
HMAX_atm_km - Atmosphere maximum altitude.
Definition: external_interface.h:44
float HLV[_KNT]
HLV - Height of levels.
Definition: external_interface.h:62
bool IAER
IAER - Selects if aerosol must be considered.
Definition: external_interface.h:75
int iBRM_water
iBRM_water - Type of water surface model
Definition: external_interface.h:22
float HOBS_km
HOBS_km - Height of observation in km.
Definition: external_interface.h:42
bool SOLAR_EMIS
SOLAR_EMIS - If emission is accounted it is used to account for solar contribution.
Definition: external_interface.h:56
float Hight_level_km[MAX(_KVERTM, _KVERT_WD)]
Hight_level_km - Aerosol profile height.
Definition: external_interface.h:66
void grasp_rt_sos_(int IW, int NG, int NN, int NF, int iBRDF, int iBPDF, int iBRM_water, float land_percent, int NQDR, int NT1[2], float tetas, int NBV, float vis[2 *_NBVM], float fiv[2 *_NBVM], float WAVE, int n_par_land, int n_par_land_i, float surf_land_par_vect[2 *_KBF], int n_par_water, float surf_water_par_vect[_KBF], float EXT[_NMM+_NMG], float SSA[_NMM+_NMG], int NANG, float ANGL[_KMpar], float SD[_KSD][_KIDIM3], float CEXT[_KSD], float HOBS_km, float HGR_km, float HMAX_atm_km, int NHVP_retr, float HVP_retr_km[_KVERTM], float H0[_KSD][_KVERTM], float sigma_aerosol[_KSD], int ifgas, float gaspar, float T_profile[_NLEVEL_GAS], float STEMP, bool laerosol, bool lsurface, bool ATMOS_EMIS, bool SOLAR_EMIS, float PF11_I[_KSD][_KMpar], float PF12_I[_KSD][_KMpar], float PF22_I[_KSD][_KMpar], float PF33_I[_KSD][_KMpar], int NLV, float HLV[_KNT], bool aerosol_analyt_prof, bool gas_abs_line, int N_level, float Hight_level_km[MAX(_KVERTM, _KVERT_WD)], int nh, float h_km[_KVERT_WD], int natm, int naer, int nmol, int ngas, float norm_DISCRVD[_NMM+_NMG], bool ISGL, bool IAER, bool IVEC_CTL, bool ISRF, bool IDWN, bool IFLX, bool IGQ_F, bool IGQ_D, bool IGQ_BRM_FEXP, bool IGQ_BRM_HSPH, bool IP_VERBOSE, bool IP_ADDITION, bool ITRC, bool ISCA, bool IVEC_SET, bool IWUT, bool ILUT, bool IATM, bool ICRR, bool boa_ref, int AER_PRF, int MOL_PRF, int NA, int NB[_KSD], int NLYR[2], float EPS, float thd[2 *_NBVM], float SLout[2 *_NBVM], float SQout[2 *_NBVM], float SUout[2 *_NBVM], float SLPout[2 *_NBVM], float *salb_out, float UFX[_KNT], float DFX[_KNT])
int nmol
nmol - Number of total molecular components
Definition: external_interface.h:71
float HVP_retr_km[_KVERTM]
HVP_retr_km - Altitudes for retrieved vertical profile.
Definition: external_interface.h:46
int NF
NF - Maximum number of Fourier terms.
Definition: external_interface.h:19
int IW
IW: Index of the position of the wavelength
Definition: external_interface.h:16
struct radiative_transfer_args_ radiative_transfer_args
bool IVEC_CTL
IVEC_CTL - To restrict the calculation to scalar equations.
Definition: external_interface.h:76
bool ISRF
ISRF - Selects if surface must be accounted.
Definition: external_interface.h:77
float SUout[2 *_NBVM]
SUout - Calculated radiance in the selected viewing geometry.
Definition: external_interface.h:106
int iBPDF
iBPDF - Establish if surface polarization is taken into
Definition: external_interface.h:21
float PF33_I[_KSD][_KMpar]
PF33_I - Aerosol phase matrix.
Definition: external_interface.h:60
float PF12_I[_KSD][_KMpar]
PF12_I - Aerosol phase matrix.
Definition: external_interface.h:58
int NB[_KSD]
NB - RT kernels appraoch: number of aerosol.
Definition: external_interface.h:97
float ANGL[_KMpar]
ANGL - Scattering angles in which is defined PF11_I.
Definition: external_interface.h:39