JURASSIC
jurassic.h
Go to the documentation of this file.
1/*
2 This file is part of JURASSIC.
3
4 JURASSIC is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 JURASSIC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with JURASSIC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2003-2021 Forschungszentrum Juelich GmbH
18*/
19
100#ifndef JURASSIC_H
101#define JURASSIC_H
102
103#include <gsl/gsl_math.h>
104#include <gsl/gsl_blas.h>
105#include <gsl/gsl_linalg.h>
106#include <gsl/gsl_randist.h>
107#include <gsl/gsl_rng.h>
108#include <gsl/gsl_statistics.h>
109#include <math.h>
110#include <omp.h>
111#include <stdio.h>
112#include <stdlib.h>
113#include <string.h>
114#include <time.h>
115
116/* ------------------------------------------------------------
117 Macros...
118 ------------------------------------------------------------ */
119
121#define ALLOC(ptr, type, n) \
122 if((ptr=malloc((size_t)(n)*sizeof(type)))==NULL) \
123 ERRMSG("Out of memory!");
124
126#define DIST(a, b) sqrt(DIST2(a, b))
127
129#define DIST2(a, b) \
130 ((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])+(a[2]-b[2])*(a[2]-b[2]))
131
133#define DOTP(a, b) (a[0]*b[0]+a[1]*b[1]+a[2]*b[2])
134
136#define FREAD(ptr, type, size, out) { \
137 if(fread(ptr, sizeof(type), size, out)!=size) \
138 ERRMSG("Error while reading!"); \
139 }
140
142#define FWRITE(ptr, type, size, out) { \
143 if(fwrite(ptr, sizeof(type), size, out)!=size) \
144 ERRMSG("Error while writing!"); \
145 }
146
148#define MAX(a,b) \
149 (((a)>(b))?(a):(b))
150
152#define MIN(a,b) \
153 (((a)<(b))?(a):(b))
154
156#define LIN(x0, y0, x1, y1, x) \
157 ((y0)+((y1)-(y0))/((x1)-(x0))*((x)-(x0)))
158
160#define LOGX(x0, y0, x1, y1, x) \
161 (((x)/(x0)>0 && (x1)/(x0)>0) \
162 ? ((y0)+((y1)-(y0))*log((x)/(x0))/log((x1)/(x0))) \
163 : LIN(x0, y0, x1, y1, x))
164
166#define LOGY(x0, y0, x1, y1, x) \
167 (((y1)/(y0)>0) \
168 ? ((y0)*exp(log((y1)/(y0))/((x1)-(x0))*((x)-(x0)))) \
169 : LIN(x0, y0, x1, y1, x))
170
172#define NORM(a) sqrt(DOTP(a, a))
173
175#define POW2(x) ((x)*(x))
176
178#define POW3(x) ((x)*(x)*(x))
179
181#define TIMER(name, mode) \
182 {timer(name, __FILE__, __func__, __LINE__, mode);}
183
185#define TOK(line, tok, format, var) { \
186 if(((tok)=strtok((line), " \t"))) { \
187 if(sscanf(tok, format, &(var))!=1) continue; \
188 } else ERRMSG("Error while reading!"); \
189 }
190
191/* ------------------------------------------------------------
192 Log messages...
193 ------------------------------------------------------------ */
194
196#ifndef LOGLEV
197#define LOGLEV 2
198#endif
199
201#define LOG(level, ...) { \
202 if(level >= 2) \
203 printf(" "); \
204 if(level <= LOGLEV) { \
205 printf(__VA_ARGS__); \
206 printf("\n"); \
207 } \
208 }
209
211#define WARN(...) { \
212 printf("\nWarning (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
213 LOG(0, __VA_ARGS__); \
214 }
215
217#define ERRMSG(...) { \
218 printf("\nError (%s, %s, l%d): ", __FILE__, __func__, __LINE__); \
219 LOG(0, __VA_ARGS__); \
220 exit(EXIT_FAILURE); \
221 }
222
224#define PRINT(format, var) \
225 printf("Print (%s, %s, l%d): %s= "format"\n", \
226 __FILE__, __func__, __LINE__, #var, var);
227
228/* ------------------------------------------------------------
229 Constants...
230 ------------------------------------------------------------ */
231
233#ifndef C1
234#define C1 1.19104259e-8
235#endif
236
238#ifndef C2
239#define C2 1.43877506
240#endif
241
243#ifndef EPSMIN
244#define EPSMIN 0
245#endif
246
248#ifndef EPSMAX
249#define EPSMAX 1
250#endif
251
253#ifndef G0
254#define G0 9.80665
255#endif
256
258#ifndef H0
259#define H0 7.0
260#endif
261
263#ifndef KB
264#define KB 1.3806504e-23
265#endif
266
268#ifndef ME
269#define ME 5.976e24
270#endif
271
273#ifndef NA
274#define NA 6.02214199e23
275#endif
276
278#ifndef RE
279#define RE 6367.421
280#endif
281
283#ifndef RI
284#define RI 8.3144598
285#endif
286
288#ifndef P0
289#define P0 1013.25
290#endif
291
293#ifndef T0
294#define T0 273.15
295#endif
296
298#ifndef TMIN
299#define TMIN 100.
300#endif
301
303#ifndef TMAX
304#define TMAX 400.
305#endif
306
308#ifndef TSUN
309#define TSUN 5780.
310#endif
311
313#ifndef UMIN
314#define UMIN 0
315#endif
316
318#ifndef UMAX
319#define UMAX 1e30
320#endif
321
322/* ------------------------------------------------------------
323 Dimensions...
324 ------------------------------------------------------------ */
325
327#ifndef NCL
328#define NCL 8
329#endif
330
332#ifndef ND
333#define ND 128
334#endif
335
337#ifndef NG
338#define NG 8
339#endif
340
342#ifndef NP
343#define NP 256
344#endif
345
347#ifndef NR
348#define NR 256
349#endif
350
352#ifndef NSF
353#define NSF 8
354#endif
355
357#ifndef NW
358#define NW 4
359#endif
360
362#ifndef LEN
363#define LEN 10000
364#endif
365
367#ifndef M
368#define M (NR*ND)
369#endif
370
372#ifndef N
373#define N ((2+NG+NW)*NP+NCL+NSF+5)
374#endif
375
377#ifndef NQ
378#define NQ (7+NG+NW+NCL+NSF)
379#endif
380
382#ifndef NLOS
383#define NLOS 4096
384#endif
385
387#ifndef NSHAPE
388#define NSHAPE 20000
389#endif
390
392#ifndef NFOV
393#define NFOV 5
394#endif
395
397#ifndef TBLNP
398#define TBLNP 41
399#endif
400
402#ifndef TBLNT
403#define TBLNT 30
404#endif
405
407#ifndef TBLNU
408#define TBLNU 320
409#endif
410
412#ifndef TBLNS
413#define TBLNS 1200
414#endif
415
417#ifndef RFMNPTS
418#define RFMNPTS 10000000
419#endif
420
422#ifndef RFMLINE
423#define RFMLINE 100000
424#endif
425
426/* ------------------------------------------------------------
427 Quantity indices...
428 ------------------------------------------------------------ */
429
431#define IDXP 0
432
434#define IDXT 1
435
437#define IDXQ(ig) (2+ig)
438
440#define IDXK(iw) (2+ctl->ng+iw)
441
443#define IDXCLZ (2+ctl->ng+ctl->nw)
444
446#define IDXCLDZ (3+ctl->ng+ctl->nw)
447
449#define IDXCLK(icl) (4+ctl->ng+ctl->nw+icl)
450
452#define IDXSFZ (4+ctl->ng+ctl->nw+ctl->ncl)
453
455#define IDXSFP (5+ctl->ng+ctl->nw+ctl->ncl)
456
458#define IDXSFT (6+ctl->ng+ctl->nw+ctl->ncl)
459
461#define IDXSFEPS(isf) (7+ctl->ng+ctl->nw+ctl->ncl+isf)
462
463/* ------------------------------------------------------------
464 Structs...
465 ------------------------------------------------------------ */
466
468typedef struct {
469
471 int np;
472
474 double time[NP];
475
477 double z[NP];
478
480 double lon[NP];
481
483 double lat[NP];
484
486 double p[NP];
487
489 double t[NP];
490
492 double q[NG][NP];
493
495 double k[NW][NP];
496
498 double clz;
499
501 double cldz;
502
504 double clk[NCL];
505
507 double sfz;
508
510 double sfp;
511
513 double sft;
514
516 double sfeps[NSF];
517
518} atm_t;
519
521typedef struct {
522
524 int ng;
525
527 char emitter[NG][LEN];
528
530 int nd;
531
533 double nu[ND];
534
536 int nw;
537
539 int window[ND];
540
542 int ncl;
543
545 double clnu[NCL];
546
548 int nsf;
549
551 double sfnu[NSF];
552
555
557 double sfsza;
558
560 char tblbase[LEN];
561
564
566 double hydz;
567
570
573
576
579
582
584 double rayds;
585
587 double raydz;
588
590 char fov[LEN];
591
593 double retp_zmin;
594
596 double retp_zmax;
597
599 double rett_zmin;
600
602 double rett_zmax;
603
605 double retq_zmin[NG];
606
608 double retq_zmax[NG];
609
611 double retk_zmin[NW];
612
614 double retk_zmax[NW];
615
618
621
624
627
630
633
636
639
642
645
647 char rfmbin[LEN];
648
650 char rfmhit[LEN];
651
653 char rfmxsc[NG][LEN];
654
655} ctl_t;
656
658typedef struct {
659
661 int np;
662
664 double z[NLOS];
665
667 double lon[NLOS];
668
670 double lat[NLOS];
671
673 double p[NLOS];
674
676 double t[NLOS];
677
679 double q[NLOS][NG];
680
682 double k[NLOS][ND];
683
685 double sft;
686
688 double sfeps[ND];
689
691 double ds[NLOS];
692
694 double u[NLOS][NG];
695
697 double cgp[NLOS][NG];
698
700 double cgt[NLOS][NG];
701
703 double cgu[NLOS][NG];
704
706 double eps[NLOS][ND];
707
709 double src[NLOS][ND];
710
711} los_t;
712
714typedef struct {
715
717 int nr;
718
720 double time[NR];
721
723 double obsz[NR];
724
726 double obslon[NR];
727
729 double obslat[NR];
730
732 double vpz[NR];
733
735 double vplon[NR];
736
738 double vplat[NR];
739
741 double tpz[NR];
742
744 double tplon[NR];
745
747 double tplat[NR];
748
750 double tau[ND][NR];
751
753 double rad[ND][NR];
754
755} obs_t;
756
758typedef struct {
759
761 int np[ND][NG];
762
764 int nt[ND][NG][TBLNP];
765
767 int nu[ND][NG][TBLNP][TBLNT];
768
770 double p[ND][NG][TBLNP];
771
773 double t[ND][NG][TBLNP][TBLNT];
774
776 float u[ND][NG][TBLNP][TBLNT][TBLNU];
777
779 float eps[ND][NG][TBLNP][TBLNT][TBLNU];
780
782 double st[TBLNS];
783
785 double sr[TBLNS][ND];
786
787} tbl_t;
788
789/* ------------------------------------------------------------
790 Functions...
791 ------------------------------------------------------------ */
792
794size_t atm2x(
795 ctl_t * ctl,
796 atm_t * atm,
797 gsl_vector * x,
798 int *iqa,
799 int *ipa);
800
802void atm2x_help(
803 double value,
804 int value_iqa,
805 int value_ip,
806 gsl_vector * x,
807 int *iqa,
808 int *ipa,
809 size_t *n);
810
812double brightness(
813 double rad,
814 double nu);
815
817void cart2geo(
818 double *x,
819 double *z,
820 double *lon,
821 double *lat);
822
824void climatology(
825 ctl_t * ctl,
826 atm_t * atm_mean);
827
829double ctmco2(
830 double nu,
831 double p,
832 double t,
833 double u);
834
836double ctmh2o(
837 double nu,
838 double p,
839 double t,
840 double q,
841 double u);
842
844double ctmn2(
845 double nu,
846 double p,
847 double t);
848
850double ctmo2(
851 double nu,
852 double p,
853 double t);
854
856void copy_atm(
857 ctl_t * ctl,
858 atm_t * atm_dest,
859 atm_t * atm_src,
860 int init);
861
863void copy_obs(
864 ctl_t * ctl,
865 obs_t * obs_dest,
866 obs_t * obs_src,
867 int init);
868
870int find_emitter(
871 ctl_t * ctl,
872 const char *emitter);
873
875void formod(
876 ctl_t * ctl,
877 atm_t * atm,
878 obs_t * obs);
879
881void formod_continua(
882 ctl_t * ctl,
883 los_t * los,
884 int ip,
885 double *beta);
886
888void formod_fov(
889 ctl_t * ctl,
890 obs_t * obs);
891
893void formod_pencil(
894 ctl_t * ctl,
895 atm_t * atm,
896 obs_t * obs,
897 int ir);
898
900void formod_rfm(
901 ctl_t * ctl,
902 atm_t * atm,
903 obs_t * obs);
904
906void formod_srcfunc(
907 ctl_t * ctl,
908 tbl_t * tbl,
909 double t,
910 double *src);
911
913void geo2cart(
914 double z,
915 double lon,
916 double lat,
917 double *x);
918
920void hydrostatic(
921 ctl_t * ctl,
922 atm_t * atm);
923
925void idx2name(
926 ctl_t * ctl,
927 int idx,
928 char *quantity);
929
931void init_srcfunc(
932 ctl_t * ctl,
933 tbl_t * tbl);
934
936void intpol_atm(
937 ctl_t * ctl,
938 atm_t * atm,
939 double z,
940 double *p,
941 double *t,
942 double *q,
943 double *k);
944
946void intpol_tbl_cga(
947 ctl_t * ctl,
948 tbl_t * tbl,
949 los_t * los,
950 int ip,
951 double tau_path[ND][NG],
952 double tau_seg[ND]);
953
955void intpol_tbl_ega(
956 ctl_t * ctl,
957 tbl_t * tbl,
958 los_t * los,
959 int ip,
960 double tau_path[ND][NG],
961 double tau_seg[ND]);
962
964double intpol_tbl_eps(
965 tbl_t * tbl,
966 int ig,
967 int id,
968 int ip,
969 int it,
970 double u);
971
973double intpol_tbl_u(
974 tbl_t * tbl,
975 int ig,
976 int id,
977 int ip,
978 int it,
979 double eps);
980
982void jsec2time(
983 double jsec,
984 int *year,
985 int *mon,
986 int *day,
987 int *hour,
988 int *min,
989 int *sec,
990 double *remain);
991
993void kernel(
994 ctl_t * ctl,
995 atm_t * atm,
996 obs_t * obs,
997 gsl_matrix * k);
998
1000int locate_irr(
1001 double *xx,
1002 int n,
1003 double x);
1004
1006int locate_reg(
1007 double *xx,
1008 int n,
1009 double x);
1010
1012int locate_tbl(
1013 float *xx,
1014 int n,
1015 double x);
1016
1018size_t obs2y(
1019 ctl_t * ctl,
1020 obs_t * obs,
1021 gsl_vector * y,
1022 int *ida,
1023 int *ira);
1024
1026double planck(
1027 double t,
1028 double nu);
1029
1031void raytrace(
1032 ctl_t * ctl,
1033 atm_t * atm,
1034 obs_t * obs,
1035 los_t * los,
1036 int ir);
1037
1039void read_atm(
1040 const char *dirname,
1041 const char *filename,
1042 ctl_t * ctl,
1043 atm_t * atm);
1044
1046void read_ctl(
1047 int argc,
1048 char *argv[],
1049 ctl_t * ctl);
1050
1052void read_matrix(
1053 const char *dirname,
1054 const char *filename,
1055 gsl_matrix * matrix);
1056
1058void read_obs(
1059 const char *dirname,
1060 const char *filename,
1061 ctl_t * ctl,
1062 obs_t * obs);
1063
1065double read_obs_rfm(
1066 const char *basename,
1067 double z,
1068 double *nu,
1069 double *f,
1070 int n);
1071
1073void read_rfm_spec(
1074 const char *filename,
1075 double *nu,
1076 double *rad,
1077 int *npts);
1078
1080void read_shape(
1081 const char *filename,
1082 double *x,
1083 double *y,
1084 int *n);
1085
1087void read_tbl(
1088 ctl_t * ctl,
1089 tbl_t * tbl);
1090
1092double refractivity(
1093 double p,
1094 double t);
1095
1097double scan_ctl(
1098 int argc,
1099 char *argv[],
1100 const char *varname,
1101 int arridx,
1102 const char *defvalue,
1103 char *value);
1104
1106double sza(
1107 double sec,
1108 double lon,
1109 double lat);
1110
1112void tangent_point(
1113 los_t * los,
1114 double *tpz,
1115 double *tplon,
1116 double *tplat);
1117
1119void time2jsec(
1120 int year,
1121 int mon,
1122 int day,
1123 int hour,
1124 int min,
1125 int sec,
1126 double remain,
1127 double *jsec);
1128
1130void timer(
1131 const char *name,
1132 const char *file,
1133 const char *func,
1134 int line,
1135 int mode);
1136
1138void write_atm(
1139 const char *dirname,
1140 const char *filename,
1141 ctl_t * ctl,
1142 atm_t * atm);
1143
1145void write_atm_rfm(
1146 const char *filename,
1147 ctl_t * ctl,
1148 atm_t * atm);
1149
1151void write_matrix(
1152 const char *dirname,
1153 const char *filename,
1154 ctl_t * ctl,
1155 gsl_matrix * matrix,
1156 atm_t * atm,
1157 obs_t * obs,
1158 const char *rowspace,
1159 const char *colspace,
1160 const char *sort);
1161
1163void write_obs(
1164 const char *dirname,
1165 const char *filename,
1166 ctl_t * ctl,
1167 obs_t * obs);
1168
1170void write_shape(
1171 const char *filename,
1172 double *x,
1173 double *y,
1174 int n);
1175
1177void write_tbl(
1178 ctl_t * ctl,
1179 tbl_t * tbl);
1180
1182void x2atm(
1183 ctl_t * ctl,
1184 gsl_vector * x,
1185 atm_t * atm);
1186
1188void x2atm_help(
1189 double *value,
1190 gsl_vector * x,
1191 size_t *n);
1192
1194void y2obs(
1195 ctl_t * ctl,
1196 gsl_vector * y,
1197 obs_t * obs);
1198
1199#endif
#define LEN
Maximum length of ASCII data lines.
Definition: jurassic.h:363
void write_shape(const char *filename, double *x, double *y, int n)
Write shape function.
Definition: jurassic.c:5807
double planck(double t, double nu)
Compute Planck function.
Definition: jurassic.c:4207
int locate_tbl(float *xx, int n, double x)
Find array index in float array.
Definition: jurassic.c:4158
void read_matrix(const char *dirname, const char *filename, gsl_matrix *matrix)
Read matrix.
Definition: jurassic.c:4671
void timer(const char *name, const char *file, const char *func, int line, int mode)
Measure wall-clock time.
Definition: jurassic.c:5323
void read_rfm_spec(const char *filename, double *nu, double *rad, int *npts)
Read RFM spectrum.
Definition: jurassic.c:4870
void x2atm(ctl_t *ctl, gsl_vector *x, atm_t *atm)
Decompose parameter vector or state vector.
Definition: jurassic.c:5923
int locate_irr(double *xx, int n, double x)
Find array index for irregular grid.
Definition: jurassic.c:4109
void read_atm(const char *dirname, const char *filename, ctl_t *ctl, atm_t *atm)
Read atmospheric data.
Definition: jurassic.c:4456
void init_srcfunc(ctl_t *ctl, tbl_t *tbl)
Initialize source function table.
Definition: jurassic.c:3633
void x2atm_help(double *value, gsl_vector *x, size_t *n)
Get element from state vector.
Definition: jurassic.c:5977
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read forward model control parameters.
Definition: jurassic.c:4561
void y2obs(ctl_t *ctl, gsl_vector *y, obs_t *obs)
Decompose measurement vector.
Definition: jurassic.c:5989
void raytrace(ctl_t *ctl, atm_t *atm, obs_t *obs, los_t *los, int ir)
Do ray-tracing to determine LOS.
Definition: jurassic.c:4216
void copy_obs(ctl_t *ctl, obs_t *obs_dest, obs_t *obs_src, int init)
Copy and initialize observation data.
Definition: jurassic.c:2982
void write_atm(const char *dirname, const char *filename, ctl_t *ctl, atm_t *atm)
Write atmospheric data.
Definition: jurassic.c:5361
double intpol_tbl_eps(tbl_t *tbl, int ig, int id, int ip, int it, double u)
Interpolate emissivity from look-up tables.
Definition: jurassic.c:3896
void read_tbl(ctl_t *ctl, tbl_t *tbl)
Read look-up table data.
Definition: jurassic.c:4963
void formod_fov(ctl_t *ctl, obs_t *obs)
Apply field of view convolution.
Definition: jurassic.c:3128
size_t obs2y(ctl_t *ctl, obs_t *obs, gsl_vector *y, int *ida, int *ira)
Compose measurement vector.
Definition: jurassic.c:4180
void time2jsec(int year, int mon, int day, int hour, int min, int sec, double remain, double *jsec)
Convert date to seconds.
Definition: jurassic.c:5292
void formod_pencil(ctl_t *ctl, atm_t *atm, obs_t *obs, int ir)
Compute radiative transfer for a pencil beam.
Definition: jurassic.c:3203
void tangent_point(los_t *los, double *tpz, double *tplon, double *tplat)
Find tangent point of a given LOS.
Definition: jurassic.c:5248
void write_obs(const char *dirname, const char *filename, ctl_t *ctl, obs_t *obs)
Write observation data.
Definition: jurassic.c:5697
void write_atm_rfm(const char *filename, ctl_t *ctl, atm_t *atm)
Write atmospheric data in RFM format.
Definition: jurassic.c:5479
#define ND
Maximum number of radiance channels.
Definition: jurassic.h:333
void write_matrix(const char *dirname, const char *filename, ctl_t *ctl, gsl_matrix *matrix, atm_t *atm, obs_t *obs, const char *rowspace, const char *colspace, const char *sort)
Write matrix.
Definition: jurassic.c:5519
double refractivity(double p, double t)
Compute refractivity (return value is n - 1).
Definition: jurassic.c:5128
void hydrostatic(ctl_t *ctl, atm_t *atm)
Set hydrostatic equilibrium.
Definition: jurassic.c:3522
int locate_reg(double *xx, int n, double x)
Find array index for regular grid.
Definition: jurassic.c:4139
void intpol_atm(ctl_t *ctl, atm_t *atm, double z, double *p, double *t, double *q, double *k)
Interpolate atmospheric data.
Definition: jurassic.c:3687
#define TBLNU
Maximum number of column densities in emissivity tables.
Definition: jurassic.h:408
double ctmo2(double nu, double p, double t)
Compute oxygen continuum (absorption coefficient).
Definition: jurassic.c:2869
void idx2name(ctl_t *ctl, int idx, char *quantity)
Determine name of state vector quantity for given index.
Definition: jurassic.c:3588
void intpol_tbl_ega(ctl_t *ctl, tbl_t *tbl, los_t *los, int ip, double tau_path[ND][NG], double tau_seg[ND])
Get transmittance from look-up tables (EGA method).
Definition: jurassic.c:3801
void formod_srcfunc(ctl_t *ctl, tbl_t *tbl, double t, double *src)
Compute Planck source function.
Definition: jurassic.c:3490
void jsec2time(double jsec, int *year, int *mon, int *day, int *hour, int *min, int *sec, double *remain)
Convert seconds to date.
Definition: jurassic.c:3975
double brightness(double rad, double nu)
Compute brightness temperature.
Definition: jurassic.c:109
#define TBLNT
Maximum number of temperatures in emissivity tables.
Definition: jurassic.h:403
#define NP
Maximum number of atmospheric data points.
Definition: jurassic.h:343
void intpol_tbl_cga(ctl_t *ctl, tbl_t *tbl, los_t *los, int ip, double tau_path[ND][NG], double tau_seg[ND])
Get transmittance from look-up tables (CGA method).
Definition: jurassic.c:3712
void read_obs(const char *dirname, const char *filename, ctl_t *ctl, obs_t *obs)
Read observation data.
Definition: jurassic.c:4711
#define NG
Maximum number of emitters.
Definition: jurassic.h:338
double ctmn2(double nu, double p, double t)
Compute nitrogen continuum (absorption coefficient).
Definition: jurassic.c:2805
int find_emitter(ctl_t *ctl, const char *emitter)
Find index of an emitter.
Definition: jurassic.c:3020
#define TBLNS
Maximum number of source function temperature levels.
Definition: jurassic.h:413
double scan_ctl(int argc, char *argv[], const char *varname, int arridx, const char *defvalue, char *value)
Search control parameter file for variable entry.
Definition: jurassic.c:5138
double sza(double sec, double lon, double lat)
Calculate solar zenith angle.
Definition: jurassic.c:5207
void read_shape(const char *filename, double *x, double *y, int *n)
Read shape function.
Definition: jurassic.c:4921
void geo2cart(double z, double lon, double lat, double *x)
Convert geolocation to Cartesian coordinates.
Definition: jurassic.c:3507
void climatology(ctl_t *ctl, atm_t *atm_mean)
Interpolate climatological data.
Definition: jurassic.c:134
void formod(ctl_t *ctl, atm_t *atm, obs_t *obs)
Determine ray paths and compute radiative transfer.
Definition: jurassic.c:3033
double ctmh2o(double nu, double p, double t, double q, double u)
Compute water vapor continuum (optical depth).
Definition: jurassic.c:1755
#define TBLNP
Maximum number of pressure levels in emissivity tables.
Definition: jurassic.h:398
#define NSF
Maximum number of surface layer spectral grid points.
Definition: jurassic.h:353
double read_obs_rfm(const char *basename, double z, double *nu, double *f, int n)
Read observation data in RFM format.
Definition: jurassic.c:4812
#define NCL
Maximum number of cloud layer spectral grid points.
Definition: jurassic.h:328
#define NLOS
Maximum number of LOS points.
Definition: jurassic.h:383
void kernel(ctl_t *ctl, atm_t *atm, obs_t *obs, gsl_matrix *k)
Compute Jacobians.
Definition: jurassic.c:4008
#define NR
Maximum number of ray paths.
Definition: jurassic.h:348
void formod_continua(ctl_t *ctl, los_t *los, int ip, double *beta)
Compute absorption coefficient of continua.
Definition: jurassic.c:3082
void atm2x_help(double value, int value_iqa, int value_ip, gsl_vector *x, int *iqa, int *ipa, size_t *n)
Add element to state vector.
Definition: jurassic.c:87
double intpol_tbl_u(tbl_t *tbl, int ig, int id, int ip, int it, double eps)
Interpolate column density from look-up tables.
Definition: jurassic.c:3935
void write_tbl(ctl_t *ctl, tbl_t *tbl)
Write look-up table data.
Definition: jurassic.c:5837
void copy_atm(ctl_t *ctl, atm_t *atm_dest, atm_t *atm_src, int init)
Copy and initialize atmospheric data.
Definition: jurassic.c:2928
#define NW
Maximum number of spectral windows.
Definition: jurassic.h:358
size_t atm2x(ctl_t *ctl, atm_t *atm, gsl_vector *x, int *iqa, int *ipa)
Compose state vector or parameter vector.
Definition: jurassic.c:29
void formod_rfm(ctl_t *ctl, atm_t *atm, obs_t *obs)
Apply RFM for radiative transfer calculations.
Definition: jurassic.c:3349
void cart2geo(double *x, double *z, double *lon, double *lat)
Convert Cartesian coordinates to geolocation.
Definition: jurassic.c:119
double ctmco2(double nu, double p, double t, double u)
Compute carbon dioxide continuum (optical depth).
Definition: jurassic.c:897
Atmospheric data.
Definition: jurassic.h:468
double sfz
Surface height [km].
Definition: jurassic.h:507
double sfp
Surface pressure [hPa].
Definition: jurassic.h:510
double clz
Cloud layer height [km].
Definition: jurassic.h:498
int np
Number of data points.
Definition: jurassic.h:471
double cldz
Cloud layer depth [km].
Definition: jurassic.h:501
double sft
Surface temperature [K].
Definition: jurassic.h:513
Forward model control parameters.
Definition: jurassic.h:521
int write_matrix
Write matrix file (0=no, 1=yes).
Definition: jurassic.h:641
int nw
Number of spectral windows.
Definition: jurassic.h:536
double retp_zmin
Minimum altitude for pressure retrieval [km].
Definition: jurassic.h:593
double hydz
Reference height for hydrostatic pressure profile (-999 to skip) [km].
Definition: jurassic.h:566
int ret_sfz
Retrieve surface layer height (0=no, 1=yes).
Definition: jurassic.h:626
int ctm_co2
Compute CO2 continuum (0=no, 1=yes).
Definition: jurassic.h:569
double rett_zmax
Maximum altitude for temperature retrieval [km].
Definition: jurassic.h:602
int ret_sfeps
Retrieve surface layer emissivity (0=no, 1=yes).
Definition: jurassic.h:635
int ret_sft
Retrieve surface layer temperature (0=no, 1=yes).
Definition: jurassic.h:632
int ret_clz
Retrieve cloud layer height (0=no, 1=yes).
Definition: jurassic.h:617
int ctm_n2
Compute N2 continuum (0=no, 1=yes).
Definition: jurassic.h:575
int ctm_h2o
Compute H2O continuum (0=no, 1=yes).
Definition: jurassic.h:572
int formod
Forward model (0=CGA, 1=EGA, 2=RFM).
Definition: jurassic.h:644
int ng
Number of emitters.
Definition: jurassic.h:524
int refrac
Take into account refractivity (0=no, 1=yes).
Definition: jurassic.h:581
double rett_zmin
Minimum altitude for temperature retrieval [km].
Definition: jurassic.h:599
double sfsza
Solar zenith angle at the surface [deg] (-999=auto).
Definition: jurassic.h:557
int nd
Number of radiance channels.
Definition: jurassic.h:530
int sftype
Surface treatment (0=none, 1=emissions, 2=downward, 3=solar).
Definition: jurassic.h:554
int ret_sfp
Retrieve surface layer pressure (0=no, 1=yes).
Definition: jurassic.h:629
int ncl
Number of cloud layer spectral grid points.
Definition: jurassic.h:542
int ctm_o2
Compute O2 continuum (0=no, 1=yes).
Definition: jurassic.h:578
int ret_clk
Retrieve cloud layer extinction (0=no, 1=yes).
Definition: jurassic.h:623
int nsf
Number of surface layer spectral grid points.
Definition: jurassic.h:548
double rayds
Maximum step length for raytracing [km].
Definition: jurassic.h:584
int ret_cldz
Retrieve cloud layer depth (0=no, 1=yes).
Definition: jurassic.h:620
int tblfmt
Look-up table file format (1=ASCII, 2=binary).
Definition: jurassic.h:563
double raydz
Vertical step length for raytracing [km].
Definition: jurassic.h:587
int write_bbt
Use brightness temperature instead of radiance (0=no, 1=yes).
Definition: jurassic.h:638
double retp_zmax
Maximum altitude for pressure retrieval [km].
Definition: jurassic.h:596
Line-of-sight data.
Definition: jurassic.h:658
double sft
Surface temperature [K].
Definition: jurassic.h:685
int np
Number of LOS points.
Definition: jurassic.h:661
Observation geometry and radiance data.
Definition: jurassic.h:714
int nr
Number of ray paths.
Definition: jurassic.h:717
Emissivity look-up tables.
Definition: jurassic.h:758