ocssw
V2022
|
get_atrem_corl1v3.c
Go to the documentation of this file.
144 #define MINDEGCHANGE 55 // Minimum change (degrees squared) in sum of zenith and azimuth angle squared
147 int get_atrem_cor(l1str *l1rec, int32_t ip, float *rhot, float *tg_tot, float *tg_sol, float *tg_sen) {
204 limitang = get_current_angle_limit(l1rec->senz[ip], l1rec->solz[ip], &se_ang, &so_ang, angle_limit, ang_senz, ang_solz, n_senz, n_solz);
205 //printf("RJH: prev_max_senz=%f prev_min_senz=%f limitang[%d]=%f prev_ddeg=%f senz=%f solz=%f \n",prev_max_senz,prev_min_senz,ip,limitang,prev_ddeg,l1rec->senz[ip],l1rec->solz[ip]);
268 // printf("PARAM:startndx: %d %d %d %d\n",P.start_ndx[0],P.start_ndx[1],P.start_ndx[2],P.start_ndx[3]);
327 // Don't need to call init_speccal since other trace gas transmittances don't depend on water vapor
329 // recalculate transmittances based on separate solar/sensor paths using the tran_table indices from the first call
548 //printf("RJH: Atrem: %d %f YY=%f %f %f\n",i,tg_tot[i],rhot[i],rhot[i]/specav,rhot[i]-rhot[i]/specav);
678 printf("-E- %sline %d: Invalid ATM Model number\n Value must be between 1 and 7\n: get_atrem_cor3\n",
809 printf("-E- %sline %d: Invalid ATM Model number\n Value must be between 1 and 7\n: get_atrem_cor3\n",
845 int16 mon = (int) day / 31 + 1; // month of year (no need for perfection..at least according to the sea surface salinity reference algorithm)
879 int32_t nb, atrem_opt = input->atrem_opt, atrem_full = input->atrem_full, atrem_geom = input->atrem_geom;
880 int32_t atrem_splitpaths = input->atrem_splitpaths, atrem_model = input->atrem_model, gas_opt = input->gas_opt;
980 printf("-E- %s line %d : Elevation=%f must be less than the maximum elevation in the atmospheric model.\n",
988 printf("-E- %s line %d : Sensor altitude=%f must be greater than the bottom surface elevation.\n",
1051 "in the .94-um region:%f\nValid range is: %f < value < %f \n", getinput6_.wp94c, getinput6_.wndow1, getinput6_.wndow2);
1072 "in the .94-um region:%f\nValid range is: %f < value < %f \n", getinput6_.w1p14c, getinput6_.wndow3, getinput6_.wndow4);
1094 init_speccal1_.tran_hi_others = (float*) allocateMemory(NP_HI * sizeof (float), "tran_hi_others");
1098 init_speccal13_.wavln_med_index = (float*) allocateMemory(NP_MED * sizeof (float), "wavln_med_index");
1103 init_speccal13_.tran_med_index[i] = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index");
1110 init_speccal17_.tran_no2_std = (float*) allocateMemory(NO3PT * sizeof (float), "tran_no2_std");
1139 tran_tables_.tran_hi_sap1[0] = (float*) allocateMemory(NP_HI * sizeof (float), "tran_hi_sap1");
1140 tran_tables_.tran_hi_sap1[1] = (float*) allocateMemory(NP_HI * sizeof (float), "tran_hi_sap1");
1143 tran_tables_.tran_hi_sbp1[0] = (float*) allocateMemory(NP_HI * sizeof (float), "tran_hi_sbp1");
1144 tran_tables_.tran_hi_sbp1[1] = (float*) allocateMemory(NP_HI * sizeof (float), "tran_hi_sbp1");
1146 tran_tables1_.tran_med_index_sa_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sa_sol");
1147 tran_tables1_.tran_med_index_sa_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sa_sen");
1148 tran_tables1_.tran_med_index_sap1_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sap1_sol");
1149 tran_tables1_.tran_med_index_sap1_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sap1_sen");
1150 tran_tables1_.tran_med_index_sb_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sb_sol");
1151 tran_tables1_.tran_med_index_sb_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sb_sen");
1152 tran_tables1_.tran_med_index_sbp1_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sbp1_sol");
1153 tran_tables1_.tran_med_index_sbp1_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_index_sbp1_sen");
1155 tran_tables1_.tran_med_sa_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sa_sol");
1156 tran_tables1_.tran_med_sa_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sa_sen");
1157 tran_tables1_.tran_med_sap1_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sap1_sol");
1158 tran_tables1_.tran_med_sap1_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sap1_sen");
1159 tran_tables1_.tran_med_sb_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sb_sol");
1160 tran_tables1_.tran_med_sb_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sb_sen");
1161 tran_tables1_.tran_med_sbp1_sol = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sbp1_sol");
1162 tran_tables1_.tran_med_sbp1_sen = (float*) allocateMemory(NP_MED * sizeof (float), "tran_med_sbp1_sen");
1164 tran_tables1_.tran_std_sa_sol = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sa_sol");
1165 tran_tables1_.tran_std_sa_sen = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sa_sen");
1166 tran_tables1_.tran_std_sap1_sol = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sap1_sol");
1167 tran_tables1_.tran_std_sap1_sen = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sap1_sen");
1168 tran_tables1_.tran_std_sb_sol = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sb_sol");
1169 tran_tables1_.tran_std_sb_sen = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sb_sen");
1170 tran_tables1_.tran_std_sbp1_sol = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sbp1_sol");
1171 tran_tables1_.tran_std_sbp1_sen = (float*) allocateMemory(NP_STD * sizeof (float), "tran_std_sbp1_sen");
1179 printf("ATREM: Warning : full_calc !=0. Atrem will calculate transmittance table for every pixel\n");
1326 getinput1_.co2, getinput1_.o3, getinput1_.n2o, getinput1_.co, getinput1_.ch4, getinput1_.o2, getinput1_.no2);
1351 "\nPlease resolve. Refer to command line options for atrem_opt and gas_opt.\n", atrem_opt, gas_opt);
1384 int get_angle_limits(float **anglelimit, float **insenz, float **insolz, int *n_senz, int *n_solz) {
1553 float get_current_angle_limit(float insenz, float insolz, int *ii, int *jj, float **anglelimit, float *senz, float *solz, int n_senz, int n_solz) {
1652 float const1[NH2OMAX], const2[NH2OMAX], const3[NH2OMAX], const4[NH2OMAX], const5[NH2OMAX], const6[NH2OMAX];
1658 ied4 = init_speccal7_.ied4, ist1p14 = init_speccal7_.ist1p14, ied1p14 = init_speccal7_.ied1p14;
1659 float wt1 = init_speccal8_.wt1, wt2 = init_speccal8_.wt2, wt3 = init_speccal8_.wt3, wt4 = init_speccal8_.wt4;
1706 void kdistgasabs(float *kcdf, float *abscf, float*waveno, float *wavobs, int32_t nphi, int32_t n_layers, int32_t nbands) {
1708 // R. Healy 3/2016 - converted from fortran kdist_gas_obs in atrem code which is based on Amir Ibrahim's
1710 // Construct k coefficients from gas transmission coefficients (from Amir Ibrahim's Matlab Code)
1727 float Q = {2.15199993E+25}; // Q=# of molecules above the surface at one atmosphere (molecules/cm**2)
1957 fprintf(stderr, "***WARNING: Surface elevation smaller then lowest boundary of the model atmosphere.\n");
1998 printf("ATREM: Model_adjust: Column vapor amount in model atmosphere from ground to space = %f cm\n", model_adj1_.clmvap);
2062 //printf("ATREM: MODEL_ADJUST - be sure to change next line to model_adj3_.k_plane = kk;model_adj4_.k_surf = k_surf once final conversion to C is complete\n ");
2066 model_adj3_.dvap_plane = q * (pp[kk] - pp[kk + 1]) * (vmrp[kk] + vmrp[kk + 1]) / 2.0 / 3.34e22;
2164 float obszni = geometry_l2gen_.senzn_l2, obsphi = geometry_l2gen_.senaz_l2, solzni = geometry_l2gen_.solzn_l2;
2167 float dvap_plane = model_adj3_.dvap_plane, dp_plane = model_adj3_.dp_plane, dvap_layer = model_adj3_.dvap_layer, dp_layer = model_adj3_.dp_layer;
2200 if (want_verbose || firstCall) printf("ATREM: GGEOM =%f OBSZNI = %f OBSPHI = %f solzni=%f degrees :: MU0=%f, MU = %f\n",
2214 if (want_verbose || firstCall) printf("ATREM: TOTLO3 = %f %f\n", geometry2_.totlo3, getinput3_.vrto3);
2223 //printf("ATREM: GEOMETRY - be sure to change line to k_plane NOT k_plane-1 once final conversion to C is complete\n ");
2231 //printf("ATREM: GEOMETRY - be sure to change line to k_plane+1 NOT k_plane once final conversion to C is complete\n ");
2241 //printf("ATREM: GEOMETRY - be sure to change line to k_plane NOT k_plane-1 once final conversion to C is complete\n ");
2260 if (want_verbose || firstCall) printf("ATREM: VAP_SLANT_MDL = %f cm\n", geometry4_.vap_slant_mdl);
2270 printf("ATREM: G_VAP_EQUIV = %f clmvap=%f VAP_SOL=%f,VAP_SEN=%f \n", geometry3_.g_vap_equiv, clmvap,
2279 // printf("SSH2O_S(1): %d %g %g | %g | %g \n",i,geometry5_.ssh2o_s[0][i],vapvrt[i],vap_sol,solzni*RAD_DEG);
2280 // printf("SSH2O_S(2): %d %g %g | %g | %g \n",i,geometry5_.ssh2o_s[1][i],vapvrt[i],vap_sen,obszni*RAD_DEG);
2296 void get_abscf_data(int levels, int bands, int sds_id, char filename[FILENAME_MAX], float* abscf, char *varname) {
2325 void apply_gas_trans(int32_t k_surf, int levels, int bands, float* abscf, float* dp, float* vmrm, float *tran_hi) {
2335 //printf("ATREM: INIT_SPECCAL - be sure to change below line to i=k_surf and i - k_surf (NOT i - k_surf + 1) once final conversion to C is complete\n ");
2437 int32_t co2 = getinput1_.co2, o2 = getinput1_.o2, n2o = getinput1_.n2o, co = getinput1_.co, ch4 = getinput1_.ch4, no2 = getinput1_.no2, o3 = getinput1_.o3;
2438 float *fwhm = getinput4_.fwhm, *wavobs = getinput4_.wavobs, *dp = init_speccal5_.dp, *tm = init_speccal5_.tm, *pm = init_speccal5_.pm, *vmrm = init_speccal5_.vmrm;
2446 static float *abscf_co2, *abscf_o2, *abscf_n2o, *abscf_ch4, *abscf_co, const1, *o3cf, *rno2cf; //=o3cf_init1_.o3cf;
2449 int32_t iwndw1, iwndw2, iwndw4, iwndw5, iwp94c, iw1p14c, nchnla, nchnlb, nchnlc, nchnld, nb1haf, nb2haf, nb3haf, nb4haf;
2476 init_speccal13_.index_med[i] = ((float) 10000. / init_speccal12_.wavln_med[i] - (float) 3000.) / (float) DWAVNO + 1;
2483 init_speccal13_.wavln_med_index[i] = (float) 10000. / ((init_speccal13_.index_med[i] - (float) 1.)*(float) DWAVNO + (float) 3000.);
2586 init_speccal8_.wt1 = (getinput6_.wndow2 - getinput6_.wp94c) / (getinput6_.wndow2 - getinput6_.wndow1);
2587 init_speccal8_.wt2 = (getinput6_.wp94c - getinput6_.wndow1) / (getinput6_.wndow2 - getinput6_.wndow1);
2615 init_speccal8_.wt3 = (getinput6_.wndow4 - getinput6_.w1p14c) / (getinput6_.wndow4 - getinput6_.wndow3);
2616 init_speccal8_.wt4 = (getinput6_.w1p14c - getinput6_.wndow3) / (getinput6_.wndow4 - getinput6_.wndow3);
2848 // if (init_speccal1_.tran_hi_others[i]<1.0) printf("CO2: %d tran_hi_others=%f\n",i, init_speccal1_.tran_hi_others[i]);
2864 // if (init_speccal1_.tran_hi_others[i]<1.0)printf("N2O: %d tran_hi_others=%f\n",i, init_speccal1_.tran_hi_others[i]);
2877 // if (init_speccal1_.tran_hi_others[i]<1.0)printf("CO: %d tran_hi_others=%f\n",i, init_speccal1_.tran_hi_others[i]);
2899 vmrm[i] = sclgas * (float) 1.6 * (float) 1.0e-6 * geometry3_.g_other[i]; //I don't know why sclgas=1 and then it's multiplied by 1.6 - rjh
2903 // if (init_speccal1_.tran_hi_others[i]<1.0)printf("CH4: %d tran_hi_others=%f\n",i, init_speccal1_.tran_hi_others[i]);
2934 //printf("ATREM: INIT_SPECCAL - be sure to change below line to i=k_surf and i - k_surf (NOT i - k_surf + 1) once final conversion to C is complete\n ");
2941 init_speccal1_.tran_hi_others[i] *= exp(sumcf[i] * Q * (float) 28.966 / (float) 6.0225E+23 / (float) 1.0E-06);
2943 init_speccal1_.tran_hi_others[i] *= exp(sumcf[i] * Q * sclgas * (float) 28.966 / (float) 6.0225E+23 / (float) 1.0E-06);
2945 init_speccal1_.tran_hi_others[i] *= exp(sumcf[i] * Q * (float) 28.966 / (float) 6.0225E+23 / (float) 1.0E-06);
2949 // printf("OX: %d %f %f\n",i,exp(sumcf[i]*Q*sclgas* (float)28.966 / (float)6.0225E+23 /(float) 1.0E-06),sumcf[i]);
2951 // printf("OX: ABSCF: %d %f %f %f\n",k,abscf_o2[bands * k + i],dp[k-k_surf+1],vmrm[k-k_surf+1]); }
2959 * Note this is the merger of two subroutines (TRANCAL with TRAN_TABLE) in the original Atrem Fortran code.
3021 int32_t co2 = getinput1_.co2, o2 = getinput1_.o2, n2o = getinput1_.n2o, co = getinput1_.co, ch4 = getinput1_.ch4, no2 = getinput1_.no2, o3 = getinput1_.o3;
3024 int32_t nbands = getinput5_.nbands, nh2o = init_speccal3_.nh2o, fullcalc = getinput5_.full_calc;
3025 int32_t nl = getinput3_.nl, splitpaths = geometry_l2gen_.splitpaths, ja = geometry_l2gen_.ja, jb = geometry_l2gen_.jb;
3027 float mu = geometry5_.mu, mu0 = geometry5_.mu0, *ssh2o = geometry2_.ssh2o, *g_vap = geometry3_.g_vap;
3156 //if (firstCall) printf("ATREM: TRAN_CAL - be sure to remove below 2 lines (k_surf--;k_plane--) once final conversion to C is complete\n ");
3157 k_plane--; // RJH - this is a relic of the fortran code - may want change this throughout the code later
3211 // printf("sumcf[%d]=%g abscf_h2o[%d][%d]=%g %f %f \n ",i,sumcf[i],j,i,abscf_h2o[bands*j+i],dp[j-k_surf],vmrm[j-k_surf]);
3226 tran_hi[i * NP_HI + j] = exp(sumcf[j] * ssh2o[i] * Q * (float) 28.966 / (float) 6.0225e+23 / (float) 1.0e-6);
3241 tran_tables_.tran_hi_sa [j][i] = exp(sumcf_s[j][i] * geometry5_.ssh2o_s[j][ja - 1] * Q * (float) 28.966 / (float) 6.0225e+23 / (float) 1.0e-6);
3242 tran_tables_.tran_hi_sap1[j][i] = exp(sumcf_s[j][i] * geometry5_.ssh2o_s[j][ja ] * Q * (float) 28.966 / (float) 6.0225e+23 / (float) 1.0e-6);
3243 tran_tables_.tran_hi_sb [j][i] = exp(sumcf_s[j][i] * geometry5_.ssh2o_s[j][jb - 1] * Q * (float) 28.966 / (float) 6.0225e+23 / (float) 1.0e-6);
3244 tran_tables_.tran_hi_sbp1[j][i] = exp(sumcf_s[j][i] * geometry5_.ssh2o_s[j][jb ] * Q * (float) 28.966 / (float) 6.0225e+23 / (float) 1.0e-6);
3258 // Perform the k-distribution calculation Trapezoidal integral for transmittance over the NBANDS bands
3268 f1 = exp(-tkcdf[0 * nbands * levels + levels * n + j] * dp[j - k_surf] * vmrm[j - k_surf] * ssh2o[i]);
3271 f2 = exp(-tkcdf[(k + 1) * nbands * levels + levels * n + j] * dp[j - k_surf] * vmrm[j - k_surf] * ssh2o[i]);
3309 printf("%d ATREM: FAST)TRNTBL=%f %f\n", k, tran_table1_.tran_kd[59][k] * tran_table1_.diff_tran[0][k], tran_table1_.trntblo[k]);
3317 tran_table1_.trntbl[i][k] = tran_table1_.tran_kd[i][k] * tran_table1_.diff_tran[i][k] * tran_table1_.trntblo[k];
3320 tran_table1_.trntbl[i][k], tran_table1_.trntblo[k], tran_table1_.tran_kd[i][k], tran_table1_.diff_tran[i][k]);
3402 float *wavln_med_index = init_speccal13_.wavln_med_index, *fwhm = getinput4_.fwhm, *wavln_std = init_speccal12_.wavln_std;
3406 int32_t ncvtot_wavno, ncvtot, nbands = getinput5_.nbands, *ncvhf = init_speccal15_.ncvhf, *index_med = init_speccal13_.index_med;
3408 float *tran_med_sa_sol = tran_tables1_.tran_med_sa_sol, *tran_med_sap1_sol = tran_tables1_.tran_med_sap1_sol;
3409 float *tran_med_sa_sen = tran_tables1_.tran_med_sa_sen, *tran_med_sap1_sen = tran_tables1_.tran_med_sap1_sen;
3410 float *tran_med_sb_sol = tran_tables1_.tran_med_sb_sol, *tran_med_sbp1_sol = tran_tables1_.tran_med_sbp1_sol;
3411 float *tran_med_sb_sen = tran_tables1_.tran_med_sb_sen, *tran_med_sbp1_sen = tran_tables1_.tran_med_sbp1_sen;
3412 float *tran_med_index_sa_sol = tran_tables1_.tran_med_index_sa_sol, *tran_med_index_sap1_sol = tran_tables1_.tran_med_index_sap1_sol;
3413 float *tran_med_index_sa_sen = tran_tables1_.tran_med_index_sa_sen, *tran_med_index_sap1_sen = tran_tables1_.tran_med_index_sap1_sen;
3414 float *tran_med_index_sb_sol = tran_tables1_.tran_med_index_sb_sol, *tran_med_index_sbp1_sol = tran_tables1_.tran_med_index_sbp1_sol;
3415 float *tran_med_index_sb_sen = tran_tables1_.tran_med_index_sb_sen, *tran_med_index_sbp1_sen = tran_tables1_.tran_med_index_sbp1_sen;
3416 float *tran_std_sa_sol = tran_tables1_.tran_std_sa_sol, *tran_std_sap1_sol = tran_tables1_.tran_std_sap1_sol;
3417 float *tran_std_sa_sen = tran_tables1_.tran_std_sa_sen, *tran_std_sap1_sen = tran_tables1_.tran_std_sap1_sen;
3418 float *tran_std_sb_sol = tran_tables1_.tran_std_sb_sol, *tran_std_sbp1_sol = tran_tables1_.tran_std_sbp1_sol;
3419 float *tran_std_sb_sen = tran_tables1_.tran_std_sb_sen, *tran_std_sbp1_sen = tran_tables1_.tran_std_sbp1_sen;
3456 finstr_wavno[j][i] = exp(-CONST1 * pow((float) (i - ncvhf_wavno[j] + 1) * DWAVNO / fwhm_wavno[j], 2));
3458 // if (j==0) printf("A:finstr_wavno sumins: %d %g %g %d\n",i,sumins,finstr_wavno[j][i],i-ncvhf_wavno[j]+1);
3464 // if (j==0) printf("B:finstr_wavno sumins: %d %g %g %d\n",i,sumins,finstr_wavno[j][i],ncvtot_wavno-i-1);
3487 init_speccal15_.finstr[j][i] = exp(-CONST1 * pow((float) (i - ncvhf[j] + 1) * DWAVLN / fwhm[j], 2));
3489 // if (j==0) printf("c:A:finstr sumins: %d %g %g %d fwhm=%g %g %g %g %g %g\n",i,sumins,init_speccal15_.finstr[j][i],i-ncvhf[j]+1,fwhm[j],DWAVLN,
3490 // (float) (i-ncvhf[j]+1)*DWAVLN/fwhm[j],pow( (float) (i-ncvhf[j]+1)*DWAVLN/fwhm[j],2),-CONST1*pow( (float) (i-ncvhf[j]+1)*DWAVLN/fwhm[j],2),
3497 // if (j==0) printf("c:B:finstr sumins: %d %g %g %d\n",i,sumins,init_speccal15_.finstr[j][i],ncvtot-i-1);
3548 init_speccal13_.tran_med_index[i][j] += tran_hi[i * NP_HI + k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3552 // printf(" TRAN_MED_INDEX: %d %d <%g> %g %g %d %d %d\n",j,k,init_speccal13_.tran_med_index[i][j],tran_hi[i*NP_HI+k],
3557 tran_med_index_sa_sol [j] += tran_tables_.tran_hi_sa [0][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3558 tran_med_index_sa_sen [j] += tran_tables_.tran_hi_sa [1][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3559 tran_med_index_sap1_sol[j] += tran_tables_.tran_hi_sap1[0][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3560 tran_med_index_sap1_sen[j] += tran_tables_.tran_hi_sap1[1][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3561 tran_med_index_sb_sol [j] += tran_tables_.tran_hi_sb [0][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3562 tran_med_index_sb_sen [j] += tran_tables_.tran_hi_sb [1][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3563 tran_med_index_sbp1_sol[j] += tran_tables_.tran_hi_sbp1[0][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3564 tran_med_index_sbp1_sen[j] += tran_tables_.tran_hi_sbp1[1][k] * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
3565 // if (j==8204) printf("SPLIT: TRAN_MED_INDEX: %d %d <%g> %g %g %d %d %d %g\n",j,k,tran_med_index_sa_sol[j],tran_tables_.tran_hi_sa[0][k],
3608 // printf(" TRAN_MED_WAVLN: %d %d <%g> <%g> %g %g\n",j,29,tran_med[29][j],init_speccal13_.tran_med_index[29][j],
3625 tran_med[i][j] = fjm1 * init_speccal13_.tran_med_index[i][j - 1] + fj * init_speccal13_.tran_med_index[i][j];
3627 // printf(" TRAN_MED_INTERP: %d %d <%g> <%g> %g %g %g\n",j,i,init_speccal13_.tran_med_index[i][j-1],init_speccal13_.tran_med_index[i][j],
3633 tran_med_sap1_sol [j] = fjm1 * tran_med_index_sap1_sol[j - 1] + fj * tran_med_index_sap1_sol[j];
3634 tran_med_sap1_sen [j] = fjm1 * tran_med_index_sap1_sen[j - 1] + fj * tran_med_index_sap1_sen[j];
3637 tran_med_sbp1_sol [j] = fjm1 * tran_med_index_sbp1_sol[j - 1] + fj * tran_med_index_sbp1_sol[j];
3638 tran_med_sbp1_sen [j] = fjm1 * tran_med_index_sbp1_sen[j - 1] + fj * tran_med_index_sbp1_sen[j];
3723 // if(i==29) printf("TRAN_IA: %d %d %d %g %g %d %g %d\n",j,k,ia[j],tran_ia[i],tran_std[i][k],k-ia[j]+ncvhf[j]-1,init_speccal15_.finstr[j][k-ia[j]+ncvhf[j]-1],ncvhf[j]);
3728 tran_ia_sap1_sol += tran_std_sap1_sol[k] * init_speccal15_.finstr[j][k - ia[j] + ncvhf[j] - 1];
3729 tran_ia_sap1_sen += tran_std_sap1_sen[k] * init_speccal15_.finstr[j][k - ia[j] + ncvhf[j] - 1];
3732 tran_ia_sbp1_sol += tran_std_sbp1_sol[k] * init_speccal15_.finstr[j][k - ia[j] + ncvhf[j] - 1];
3733 tran_ia_sbp1_sen += tran_std_sbp1_sen[k] * init_speccal15_.finstr[j][k - ia[j] + ncvhf[j] - 1];
3734 // printf("%d %d TRAN_IA_SA_SOL= %g %g %g %d\n",j,k,tran_ia_sa_sol, tran_std_sa_sol [k],init_speccal15_.finstr[j][k-ia[j]+ncvhf[j]-1],ia[j]);
3746 tran_iap1_sap1_sol += tran_std_sap1_sol[k] * init_speccal15_.finstr[j][k - ia_p1 + ncvhf[j] - 1];
3747 tran_iap1_sap1_sen += tran_std_sap1_sen[k] * init_speccal15_.finstr[j][k - ia_p1 + ncvhf[j] - 1];
3750 tran_iap1_sbp1_sol += tran_std_sbp1_sol[k] * init_speccal15_.finstr[j][k - ia_p1 + ncvhf[j] - 1];
3751 tran_iap1_sbp1_sen += tran_std_sbp1_sen[k] * init_speccal15_.finstr[j][k - ia_p1 + ncvhf[j] - 1];
3752 // printf("%d %d TRAN_IAP1_SA_SOL= %g %g %g\n",j,k,tran_iap1_sa_sol, tran_std_sa_sol [k],init_speccal15_.finstr[j][k-ia[j]+ncvhf[j]-1]);
3779 // printf("%d %d TG_SOL_SA= %g %g %g %g %g %g %g <%g %g %g %g>\n",j,ia[j],tg_sol[j],tg_sol_a,tg_sol_ap1,
3783 // printf("%d %d TG_SOL_SB= %g %g %g %g %g %g %g <%g %g %g %g>\n",j,ia[j],tg_sol[j],tg_sol_b,tg_sol_bp1,
3793 // printf("RJH: TRAN2: %d %d %f %f %f\n",j,k,tran_table1_.tran_kd[k][j],tran_table1_.trntbl[k][j],tran_table1_.diff_tran[k][j]);
3856 float *wavln_med_index = init_speccal13_.wavln_med_index, *fwhm = getinput4_.fwhm, *wavln_std = init_speccal12_.wavln_std;
3860 int32_t ncvtot_wavno, ncvtot, nbands = getinput5_.nbands, *ncvhf = init_speccal15_.ncvhf, *index_med = init_speccal13_.index_med;
3903 finstr_wavno[j][i] = exp(-CONST1 * pow((float) (i - ncvhf_wavno[j] + 1) * DWAVNO / fwhm_wavno[j], 2));
3905 // if (j==0) printf("A:finstr_wavno sumins: %d %g %g %d\n",i,sumins,finstr_wavno[j][i],i-ncvhf_wavno[j]+1);
3911 // if (j==0) printf("B:finstr_wavno sumins: %d %g %g %d\n",i,sumins,finstr_wavno[j][i],ncvtot_wavno-i-1);
3931 init_speccal15_.finstr[j][i] = exp(-CONST1 * pow((float) (i - ncvhf[j] + 1) * DWAVLN / fwhm[j], 2));
3933 // if (j==0) printf("c:A:finstr sumins: %d %g %g %d fwhm=%g %g %g %g %g %g\n",i,sumins,init_speccal15_.finstr[j][i],i-ncvhf[j]+1,fwhm[j],DWAVLN,
3934 // (float) (i-ncvhf[j]+1)*DWAVLN/fwhm[j],pow( (float) (i-ncvhf[j]+1)*DWAVLN/fwhm[j],2),-CONST1*pow( (float) (i-ncvhf[j]+1)*DWAVLN/fwhm[j],2),
3941 // if (j==0) printf("c:B:finstr sumins: %d %g %g %d\n",i,sumins,init_speccal15_.finstr[j][i],ncvtot-i-1);
4008 // printf(" TRAN_MED_INDEX_O: %d %d <%g> %g %g %d %d %d %g\n",j,k,tran_med_index_o[j],tran_hi_others[k],
4010 // index_med[j],ncvhf_wavno[j],k-index_med[j]+ncvhf_wavno[j],tran_hi_others[k]*finstr_wavno[j][k-index_med[j]+ncvhf_wavno[j]]);
4016 tran_med_index_os_sol[j] += tran_hi_others_sol * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
4017 tran_med_index_os_sen[j] += tran_hi_others_sen * finstr_wavno[j][k - index_med[j] + ncvhf_wavno[j]];
4052 // printf(" TRAN_MED_INTERP: %d <%g> <%g> %g %g %g\n",j,tran_med_index_o[j-1],tran_med_index_o[j],
4057 // printf(" TRAN_MED_INTERP_OS: %d <%g> <%g> %g %g %g\n",j,tran_med_index_os_sol[j-1],tran_med_index_os_sol[j],
4077 for (i = 0; i < NO3PT; i++) tran_std_o[i] = init_speccal16_.tran_o3_std[i] * init_speccal17_.tran_no2_std[i];
4122 // printf("TRAN_IA: %d %d %d %g %g %d %g %d\n",j,k,ia[j],tran_ia,tran_std_o[k],k-ia[j]+ncvhf[j]-1,init_speccal15_.finstr[j][k-ia[j]+ncvhf[j]-1],ncvhf[j]);
4127 // printf("TRAN_IAS_SOL: %d %d %g %g %d %g %d %d\n",j,k,tran_ias_sol,tran_std_os_sol[k],k-ia[j]+ncvhf[j]-1,mu0,ia[j],ncvhf[j]);
int get_atrem_cor(l1str *l1rec, int32_t ip, float *rhot, float *tg_tot, float *tg_sol, float *tg_sen)
Definition: get_atrem_corl1v3.c:147
void ecdf_(float *xcdf, float *ycdf, int32_t *bin_number, float *xs, int32_t *sample_size)
Definition: numerical.c:22
struct @25 getinput4_
struct @24 getinput3_
struct @22 input_l2gen_
list(APPEND LIBS ${PGSTK_LIBRARIES}) add_executable(atteph_info_modis atteph_info_modis.c) target_link_libraries(atteph_info_modis $
Definition: CMakeLists.txt:7
struct @31 model_adj1_
struct @77 geometry1_
float f1(float x)
float get_atrem(float *tg_tot, float *rhot, paramstr *P)
Definition: get_atrem_corl1v3.c:346
int get_angle_limits(float **anglelimit, float **insenz, float **insolz, int *n_senz, int *n_solz)
Definition: get_atrem_corl1v3.c:1384
void * allocateMemory(size_t numBytes, const char *name)
Definition: allocateMemory.c:7
struct @9 tran_table1_
struct @75 init_speccal17_
struct @65 init_speccal5_
void get_tpvmr(size_t layers, size_t models, int sds_id, char filename[FILENAME_MAX], char *varname, float *var_a)
Definition: get_atrem_corl1v3.c:707
struct @46 debug_atrem
struct @30 getinput14_
struct @4 init_speccal6_
void get_abscf_data(int levels, int bands, int sds_id, char filename[FILENAME_MAX], float *abscf, char *varname)
Definition: get_atrem_corl1v3.c:2296
int32_t findMatch(float *list, int32_t nbands, float elem)
Definition: get_atrem_corl1v3.c:1605
struct @81 geometry5_
float f2(float y)
struct @6 init_speccal8_
struct @21 getinput1_
struct @33 model_adj3_
struct @7 init_speccal10_
struct @1 getinput5_
struct @34 model_adj4_
struct @50 tran_tables_
void unix2yds(double usec, short *year, short *day, double *secs)
struct @43 geometry4_
struct @74 init_speccal16_
void apply_gas_trans(int32_t k_surf, int levels, int bands, float *abscf, float *dp, float *vmrm, float *tran_hi)
Definition: get_atrem_corl1v3.c:2325
struct @51 tran_tables1_
struct @78 geometry2_
struct @44 geometry_l2gen_
struct @63 init_speccal1_
struct @27 getinput6_
int init_atrem(int32_t sensorID, paramstr *P, l1str *l1rec, int32_t nbands)
Definition: get_atrem_corl1v3.c:877
struct @10 geometry3_
struct @71 init_speccal12_
struct @45 tpvmr_init1_
void kdistgasabs(float *kcdf, float *abscf, float *waveno, float *wavobs, int32_t nphi, int32_t n_layers, int32_t nbands)
Definition: get_atrem_corl1v3.c:1706
void locate_pos_(float *xx, int32_t *n1, float *x1, int32_t *jj)
Definition: get_atrem_corl1v3.c:2091
struct @23 tran_table_l2gen_
int32_t rdatreminfo(int32_t sensorID, int32_t evalmask, const char *pname, void **pval)
Definition: rdatreminfo.c:38
float get_current_angle_limit(float insenz, float insolz, int *ii, int *jj, float **anglelimit, float *senz, float *solz, int n_senz, int n_solz)
Definition: get_atrem_corl1v3.c:1553
struct @29 getinput8_
struct @3 init_speccal3_
struct @8 init_speccal11_
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
struct @5 init_speccal7_
struct @72 init_speccal13_
struct @73 init_speccal15_
struct @2 getinput7_