42 #define THROW_IF_INVALID_DETAILED() {if (!valid) { \
44 if(!validWeather) e.addText("Invalid trop model: weather"); \
45 if(!validRxLatitude) e.addText("Invalid trop model: validRxLatitude"); \
46 if(!validRxHeight) e.addText("Invalid trop model: validRxHeight"); \
47 if(!validDOY) e.addText("Invalid trop model: day of year"); \
52 static const double NBRd=287.054;
53 static const double NBg=9.80665;
54 static const double NBk1=77.604;
55 static const double NBk3p=382000;
57 static const double NBLat[5]={ 15.0, 30.0, 45.0, 60.0, 75.0};
60 static const double NBZP0[5]={1013.25,1017.25,1015.75,1011.75,1013.00};
61 static const double NBZT0[5]={ 299.65, 294.15, 283.15, 272.15, 263.65};
62 static const double NBZW0[5]={ 26.31, 21.79, 11.66, 6.78, 4.11};
63 static const double NBZB0[5]={6.30e-3,6.05e-3,5.58e-3,5.39e-3,4.53e-3};
64 static const double NBZL0[5]={ 2.77, 3.15, 2.57, 1.81, 1.55};
67 static const double NBZPa[5]={ 0.0, -3.75, -2.25, -1.75, -0.50};
68 static const double NBZTa[5]={ 0.0, 7.0, 11.0, 15.0, 14.5};
69 static const double NBZWa[5]={ 0.0, 8.85, 7.24, 5.36, 3.39};
70 static const double NBZBa[5]={ 0.0,0.25e-3,0.32e-3,0.81e-3,0.62e-3};
71 static const double NBZLa[5]={ 0.0, 0.33, 0.46, 0.74, 0.30};
74 static const double NBMad[5]={1.2769934e-3,1.2683230e-3,1.2465397e-3,1.2196049e-3,
76 static const double NBMbd[5]={2.9153695e-3,2.9152299e-3,2.9288445e-3,2.9022565e-3,
78 static const double NBMcd[5]={62.610505e-3,62.837393e-3,63.721774e-3,63.824265e-3,
82 static const double NBMaa[5]={0.0,1.2709626e-5,2.6523662e-5,3.4000452e-5,
84 static const double NBMba[5]={0.0,2.1414979e-5,3.0160779e-5,7.2562722e-5,
86 static const double NBMca[5]={0.0,9.0128400e-5,4.3497037e-5,84.795348e-5,
90 static const double NBMaw[5]={5.8021897e-4,5.6794847e-4,5.8118019e-4,5.9727542e-4,
92 static const double NBMbw[5]={1.4275268e-3,1.5138625e-3,1.4572752e-3,1.5007428e-3,
94 static const double NBMcw[5]={4.3472961e-2,4.6729510e-2,4.3908931e-2,4.4626982e-2,
98 enum TableEntry {
ZP=1,
ZT,
ZW,
ZB,
ZL,
Mad,
Mbd,
Mcd,
Maw,
Mbw,
Mcw };
103 const double *pave =
NULL, *pamp =
NULL;
104 double ret,
day=double(doy);
121 InvalidRequest exc(
"NB_Interpolate called with unknown entry");
127 int i = int(
ABS(lat)/15.0)-1;
131 ret = pave[i]+m*(pave[i+1]-pave[i]);
133 ret -= (pamp[i]+m*(pamp[i+1]-pamp[i]))
137 if(i<0) i=0;
else i=4;
149 validWeather(false), validRxLatitude(false),
150 validDOY(false), validRxHeight(false)
156 : validWeather(false), validRxLatitude(false), validDOY(false),
168 : validWeather(false), validRxLatitude(false), validDOY(false),
182 : validWeather(false), validRxLatitude(false), validDOY(false),
194 : validWeather(false), validRxLatitude(false), validDOY(false),
209 if(elevation < 0.0)
return 0.0;
275 kw = std::exp(base*(-1.0+(lam+1)*
NBg/(
NBRd*
beta)));
287 if(elevation < 0.0)
return 0.0;
295 map = (1.0+a/(1.0+b/(1.0+c))) / (
se+a/(
se+b/(
se+c)));
300 if(
ABS(elevation)<=0.001)
se=0.001;
301 map += ((1.0/
se)-(1.0+a/(1.0+b/(1.0+c)))/(
se+a/(
se+b/(
se+c))))*
height/1000.0;
312 if(elevation < 0.0)
return 0.0;
320 return ( (1.0+a/(1.0+b/(1.0+c))) / (
se+a/(
se+b/(
se+c))) );
333 humid = 2.409e9*H*th*th*th*th*std::exp(-22.64*th);
348 humid = 2.409e9*
humid*th*th*th*th*std::exp(-22.64*th);
352 catch(InvalidParameter& e)
367 InvalidTropModel e(
"NBTropModel must have Rx latitude before interpolating weather");
373 InvalidTropModel e(
"NBTropModel must have day of year before interpolating weather ");