| 1 |
#include <stdio.h> |
| 2 |
#include <stdlib.h> |
| 3 |
#include <string.h> |
| 4 |
#include <math.h> |
| 5 |
|
| 6 |
#include <grass/gis.h> |
| 7 |
#include <grass/glocale.h> |
| 8 |
|
| 9 |
#include "local_proto.h" |
| 10 |
#include "earth_sun.h" |
| 11 |
|
| 12 |
void sensor_MSS(lsat_data *lsat) |
| 13 |
{ |
| 14 |
int i; |
| 15 |
|
| 16 |
/* green, red, near infrared, near infrared */ |
| 17 |
int band[] = {1, 2, 3, 4}; |
| 18 |
int code[] = {4, 5, 6, 7}; /* corrected for MSS4 and MSS5 to 1,2,3,4 */ |
| 19 |
double wmin[] = {0.5, 0.6, 0.7, 0.8}; |
| 20 |
double wmax[] = {0.6, 0.7, 0.8, 1.1}; |
| 21 |
/* original: 79x57, now all 60 m */ |
| 22 |
|
| 23 |
strcpy(lsat->sensor, "MSS"); |
| 24 |
|
| 25 |
lsat->bands = 4; |
| 26 |
for (i = 0; i < lsat->bands; i++) { |
| 27 |
lsat->band[i].number = *(band + i); |
| 28 |
lsat->band[i].code = *(code + i); |
| 29 |
lsat->band[i].wavemax = *(wmax + i); |
| 30 |
lsat->band[i].wavemin = *(wmin + i); |
| 31 |
lsat->band[i].qcalmax = 255.; |
| 32 |
lsat->band[i].qcalmin = 0.; |
| 33 |
lsat->band[i].thermal = 0; |
| 34 |
} |
| 35 |
return; |
| 36 |
} |
| 37 |
|
| 38 |
void sensor_TM(lsat_data *lsat) |
| 39 |
{ |
| 40 |
int i; |
| 41 |
|
| 42 |
/* blue, green red, near infrared, shortwave IR, thermal IR, shortwave IR */ |
| 43 |
int band[] = {1, 2, 3, 4, 5, 6, 7}; |
| 44 |
double wmin[] = {0.45, 0.52, 0.63, 0.76, 1.55, 10.40, 2.08}; |
| 45 |
double wmax[] = {0.52, 0.60, 0.69, 0.90, 1.75, 12.50, 2.35}; |
| 46 |
/* 30, 30, 30, 30, 30, 120 original, 60 resamples before Feb 25, 2010 and 30 |
| 47 |
* after, 30 */ |
| 48 |
|
| 49 |
strcpy(lsat->sensor, "TM"); |
| 50 |
|
| 51 |
lsat->bands = 7; |
| 52 |
for (i = 0; i < lsat->bands; i++) { |
| 53 |
lsat->band[i].number = *(band + i); |
| 54 |
lsat->band[i].code = *(band + i); |
| 55 |
lsat->band[i].wavemax = *(wmax + i); |
| 56 |
lsat->band[i].wavemin = *(wmin + i); |
| 57 |
lsat->band[i].qcalmax = 255.; |
| 58 |
lsat->band[i].qcalmin = 0.; /* Modified in set_TM5 by date */ |
| 59 |
lsat->band[i].thermal = (lsat->band[i].number == 6 ? 1 : 0); |
| 60 |
} |
| 61 |
return; |
| 62 |
} |
| 63 |
|
| 64 |
void sensor_ETM(lsat_data *lsat) |
| 65 |
{ |
| 66 |
int i; |
| 67 |
|
| 68 |
/* blue, green, red, near infrared, shortwave IR, thermal IR, shortwave IR, |
| 69 |
* panchromatic */ |
| 70 |
int band[] = {1, 2, 3, 4, 5, 6, 6, 7, 8}; |
| 71 |
int code[] = {1, 2, 3, 4, 5, 61, 62, 7, 8}; |
| 72 |
double wmin[] = {0.450, 0.525, 0.630, 0.75, 1.55, 10.40, 10.40, 2.09, 0.52}; |
| 73 |
double wmax[] = {0.515, 0.605, 0.690, 0.90, 1.75, 12.50, 12.50, 2.35, 0.90}; |
| 74 |
/* 30, 30, 30, 30, 30, 60 (after Feb. 25, 2010: 30), 30, 15 */ |
| 75 |
|
| 76 |
strcpy(lsat->sensor, "ETM+"); |
| 77 |
|
| 78 |
lsat->bands = 9; |
| 79 |
for (i = 0; i < lsat->bands; i++) { |
| 80 |
lsat->band[i].number = *(band + i); |
| 81 |
lsat->band[i].code = *(code + i); |
| 82 |
lsat->band[i].wavemax = *(wmax + i); |
| 83 |
lsat->band[i].wavemin = *(wmin + i); |
| 84 |
lsat->band[i].qcalmax = 255.; |
| 85 |
lsat->band[i].qcalmin = 1.; |
| 86 |
lsat->band[i].thermal = (lsat->band[i].number == 6 ? 1 : 0); |
| 87 |
} |
| 88 |
return; |
| 89 |
} |
| 90 |
|
| 91 |
void sensor_OLI(lsat_data *lsat) |
| 92 |
{ |
| 93 |
int i; |
| 94 |
|
| 95 |
/* coastal aerosol, blue, green, red, near infrared, shortwave IR (SWIR) 1, |
| 96 |
* SWIR 2, panchromatic, cirrus, thermal infrared (TIR) 1, TIR 2 */ |
| 97 |
int band[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; |
| 98 |
int code[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; |
| 99 |
double wmin[] = {0.433, 0.450, 0.525, 0.630, 0.845, 1.560, |
| 100 |
2.100, 0.500, 1.360, 10.3, 11.5}; |
| 101 |
double wmax[] = {0.453, 0.515, 0.600, 0.680, 0.885, 1.660, |
| 102 |
2.300, 0.680, 1.390, 11.3, 12.5}; |
| 103 |
/* 30, 30, 30, 30, 30, 30, 30, 15, 30, 100, 100 */ |
| 104 |
|
| 105 |
strcpy(lsat->sensor, "OLI/TIRS"); |
| 106 |
|
| 107 |
lsat->bands = 11; |
| 108 |
for (i = 0; i < lsat->bands; i++) { |
| 109 |
lsat->band[i].number = *(band + i); |
| 110 |
lsat->band[i].code = *(code + i); |
| 111 |
lsat->band[i].wavemax = *(wmax + i); |
| 112 |
lsat->band[i].wavemin = *(wmin + i); |
| 113 |
lsat->band[i].qcalmax = 65535.; |
| 114 |
lsat->band[i].qcalmin = 1.; |
| 115 |
lsat->band[i].thermal = (lsat->band[i].number > 9 ? 1 : 0); |
| 116 |
} |
| 117 |
return; |
| 118 |
} |
| 119 |
|
| 120 |
/** ********************************************** |
| 121 |
** Before access to these functions ... |
| 122 |
** store previously |
| 123 |
** >>> acquisition date, |
| 124 |
** >>> creation date, and |
| 125 |
** >>> sun_elev |
| 126 |
** **********************************************/ |
| 127 |
|
| 128 |
/**************************************************************************** |
| 129 |
* PURPOSE: Store values of Landsat-1 MSS |
| 130 |
* July 23, 1972 to January 6, 1978 |
| 131 |
*****************************************************************************/ |
| 132 |
void set_MSS1(lsat_data *lsat) |
| 133 |
{ |
| 134 |
int i, j; |
| 135 |
|
| 136 |
/** USGS Calibration Parameter Files 2012 */ |
| 137 |
|
| 138 |
/* Spectral radiances at detector */ |
| 139 |
double lmax[] = {248., 200., 176., 153.}; |
| 140 |
double lmin[] = {0., 0., 0., 0.}; |
| 141 |
|
| 142 |
/* Solar exoatmospheric spectral irradiances */ |
| 143 |
double esun[] = {1824., 1570., 1249., 853.4}; |
| 144 |
|
| 145 |
lsat->number = 1; |
| 146 |
sensor_MSS(lsat); |
| 147 |
|
| 148 |
lsat->dist_es = earth_sun(lsat->date); |
| 149 |
|
| 150 |
for (i = 0; i < lsat->bands; i++) { |
| 151 |
j = lsat->band[i].number - 1; |
| 152 |
lsat->band[i].esun = *(esun + j); |
| 153 |
lsat->band[i].lmax = *(lmax + j); |
| 154 |
lsat->band[i].lmin = *(lmin + j); |
| 155 |
} |
| 156 |
G_debug(1, "Landsat-1 MSS"); |
| 157 |
return; |
| 158 |
} |
| 159 |
|
| 160 |
/**************************************************************************** |
| 161 |
* PURPOSE: Store values of Landsat-2 MSS |
| 162 |
* January 22, 1975 to February 5, 1982 |
| 163 |
*****************************************************************************/ |
| 164 |
void set_MSS2(lsat_data *lsat) |
| 165 |
{ |
| 166 |
int i, j; |
| 167 |
double julian, *lmax, *lmin; |
| 168 |
|
| 169 |
/** USGS Calibration Parameter Files 2012 */ |
| 170 |
|
| 171 |
/* Spectral radiances at detector */ |
| 172 |
double Lmax[][4] = { |
| 173 |
{210., 156., 140., 138.}, /* before July 16, 1975 */ |
| 174 |
{263., 176., 152., 130.} /* on or after July 16, 1975 */ |
| 175 |
}; |
| 176 |
double Lmin[][4] = {{10., 7., 7., 5.}, {8., 6., 6., 4.}}; |
| 177 |
|
| 178 |
/* Solar exoatmospheric spectral irradiances */ |
| 179 |
double esun[] = {1824., 1570., 1249., 853.4}; |
| 180 |
|
| 181 |
julian = julian_char(lsat->creation); |
| 182 |
if (julian < julian_char("1975-07-16")) |
| 183 |
i = 0; |
| 184 |
else |
| 185 |
i = 1; |
| 186 |
|
| 187 |
lmax = Lmax[i]; |
| 188 |
lmin = Lmin[i]; |
| 189 |
|
| 190 |
lsat->number = 2; |
| 191 |
sensor_MSS(lsat); |
| 192 |
|
| 193 |
lsat->dist_es = earth_sun(lsat->date); |
| 194 |
|
| 195 |
for (i = 0; i < lsat->bands; i++) { |
| 196 |
j = lsat->band[i].number - 1; |
| 197 |
lsat->band[i].esun = *(esun + j); |
| 198 |
lsat->band[i].lmax = *(lmax + j); |
| 199 |
lsat->band[i].lmin = *(lmin + j); |
| 200 |
} |
| 201 |
G_debug(1, "Landsat-2 MSS"); |
| 202 |
return; |
| 203 |
} |
| 204 |
|
| 205 |
/**************************************************************************** |
| 206 |
* PURPOSE: Store values of Landsat-3 MSS |
| 207 |
* March 5, 1978 to March 31, 1983 |
| 208 |
* |
| 209 |
* tiene una banda 8 thermal |
| 210 |
*****************************************************************************/ |
| 211 |
void set_MSS3(lsat_data *lsat) |
| 212 |
{ |
| 213 |
int i, j; |
| 214 |
double julian, *lmax, *lmin; |
| 215 |
|
| 216 |
/** USGS Calibration Parameter Files 2012 */ |
| 217 |
|
| 218 |
/* Spectral radiances at detector */ |
| 219 |
double Lmax[][4] = { |
| 220 |
{220., 175., 145., 147.}, /* before June 1, 1978 */ |
| 221 |
{259., 179., 149., 128.} /* on or after June 1, 1978 */ |
| 222 |
}; |
| 223 |
double Lmin[][4] = {{4., 3., 3., 1.}, {4., 3., 3., 1.}}; |
| 224 |
/* Solar exoatmospheric spectral irradiances */ |
| 225 |
double esun[] = {1824., 1570., 1249., 853.4}; |
| 226 |
|
| 227 |
julian = julian_char(lsat->creation); |
| 228 |
if (julian < julian_char("1978-06-01")) |
| 229 |
i = 0; |
| 230 |
else |
| 231 |
i = 1; |
| 232 |
|
| 233 |
lmax = Lmax[i]; |
| 234 |
lmin = Lmin[i]; |
| 235 |
|
| 236 |
lsat->number = 3; |
| 237 |
sensor_MSS(lsat); |
| 238 |
|
| 239 |
lsat->dist_es = earth_sun(lsat->date); |
| 240 |
|
| 241 |
for (i = 0; i < lsat->bands; i++) { |
| 242 |
j = lsat->band[i].number - 1; |
| 243 |
lsat->band[i].esun = *(esun + j); |
| 244 |
lsat->band[i].lmax = *(lmax + j); |
| 245 |
lsat->band[i].lmin = *(lmin + j); |
| 246 |
} |
| 247 |
G_debug(1, "Landsat-3 MSS"); |
| 248 |
return; |
| 249 |
} |
| 250 |
|
| 251 |
/**************************************************************************** |
| 252 |
* PURPOSE: Store values of Landsat-4 MSS/TM |
| 253 |
* July 16, 1982 to June 15, 2001 |
| 254 |
*****************************************************************************/ |
| 255 |
void set_MSS4(lsat_data *lsat) |
| 256 |
{ |
| 257 |
int i, j; |
| 258 |
double julian, *lmax, *lmin; |
| 259 |
|
| 260 |
/** USGS Calibration Parameter Files 2012 */ |
| 261 |
|
| 262 |
/* Spectral radiances at detector */ |
| 263 |
double Lmax[][4] = { |
| 264 |
{250., 180., 150., 133.}, /* before August 26, 1982 */ |
| 265 |
{230., 180., 130., 133.}, /* between */ |
| 266 |
{238., 164., 142., 116.} /* on or after April 1, 1983 */ |
| 267 |
}; |
| 268 |
double Lmin[][4] = {{2., 4., 4., 3.}, {2., 4., 4., 3.}, {4., 4., 5., 4.}}; |
| 269 |
|
| 270 |
/* Solar exoatmospheric spectral irradiances */ |
| 271 |
double esun[] = {1824., 1570., 1249., 853.4}; |
| 272 |
|
| 273 |
julian = julian_char(lsat->creation); |
| 274 |
if (julian < julian_char("1982-08-26")) |
| 275 |
i = 0; |
| 276 |
else if (julian < julian_char("1983-03-31")) |
| 277 |
i = 1; |
| 278 |
else |
| 279 |
i = 2; |
| 280 |
|
| 281 |
lmax = Lmax[i]; |
| 282 |
lmin = Lmin[i]; |
| 283 |
|
| 284 |
lsat->number = 4; |
| 285 |
sensor_MSS(lsat); |
| 286 |
|
| 287 |
lsat->dist_es = earth_sun(lsat->date); |
| 288 |
|
| 289 |
for (i = 0; i < lsat->bands; i++) { |
| 290 |
j = lsat->band[i].number - 1; |
| 291 |
lsat->band[i].esun = *(esun + j); |
| 292 |
lsat->band[i].lmax = *(lmax + j); |
| 293 |
lsat->band[i].lmin = *(lmin + j); |
| 294 |
} |
| 295 |
G_debug(1, "Landsat-4 MSS"); |
| 296 |
return; |
| 297 |
} |
| 298 |
|
| 299 |
void set_TM4(lsat_data *lsat) |
| 300 |
{ |
| 301 |
int i, j; |
| 302 |
double julian, *lmax, *lmin; |
| 303 |
|
| 304 |
/** USGS Calibration Parameter Files 2012 */ |
| 305 |
|
| 306 |
/* Spectral radiances at detector */ |
| 307 |
double Lmax[][7] = { |
| 308 |
{158.42, 308.17, 234.63, 224.32, 32.42, 15.64, |
| 309 |
17.00}, /* before August 1983 */ |
| 310 |
{142.86, 291.25, 225.00, 214.29, 30.00, 12.40, |
| 311 |
15.93}, /* before January 15, 1984 */ |
| 312 |
{171.00, 336.00, 254.00, 221.00, 31.40, 15.303, 16.60} |
| 313 |
/* after January 15, 1984 */ |
| 314 |
}; |
| 315 |
double Lmin[][7] = {{-1.52, -2.84, -1.17, -1.51, -0.37, 2.00, -0.15}, |
| 316 |
{0.00, 0.00, 0.00, 0.00, 0.00, 4.84, 0.00}, |
| 317 |
{-1.52, -2.84, -1.17, -1.51, -0.37, 1.2378, -0.15}}; |
| 318 |
|
| 319 |
/* Solar exoatmospheric spectral irradiances */ |
| 320 |
double esun[] = {1957., 1825., 1557., 1033., 214.9, 0., 80.72}; |
| 321 |
|
| 322 |
/* Thermal band calibration constants: K1 = 671.62 K2 = 1284.30 */ |
| 323 |
|
| 324 |
julian = julian_char(lsat->creation); |
| 325 |
if (julian < julian_char("1983-08-01")) |
| 326 |
i = 0; |
| 327 |
else if (julian < julian_char("1984-01-15")) |
| 328 |
i = 1; |
| 329 |
else |
| 330 |
i = 2; |
| 331 |
|
| 332 |
lmax = Lmax[i]; |
| 333 |
lmin = Lmin[i]; |
| 334 |
|
| 335 |
lsat->number = 4; |
| 336 |
sensor_TM(lsat); |
| 337 |
|
| 338 |
lsat->dist_es = earth_sun(lsat->date); |
| 339 |
|
| 340 |
for (i = 0; i < lsat->bands; i++) { |
| 341 |
j = lsat->band[i].number - 1; |
| 342 |
lsat->band[i].esun = *(esun + j); |
| 343 |
lsat->band[i].lmax = *(lmax + j); |
| 344 |
lsat->band[i].lmin = *(lmin + j); |
| 345 |
if (lsat->band[i].thermal) { |
| 346 |
lsat->band[i].K1 = 671.62; |
| 347 |
lsat->band[i].K2 = 1284.30; |
| 348 |
} |
| 349 |
} |
| 350 |
G_debug(1, "Landsat-4 TM"); |
| 351 |
return; |
| 352 |
} |
| 353 |
|
| 354 |
/**************************************************************************** |
| 355 |
* PURPOSE: Store values of Landsat-5 MSS/TM |
| 356 |
* March 1, 1984 to today |
| 357 |
*****************************************************************************/ |
| 358 |
void set_MSS5(lsat_data *lsat) |
| 359 |
{ |
| 360 |
int i, j; |
| 361 |
double julian, *lmax, *lmin; |
| 362 |
|
| 363 |
/** USGS Calibration Parameter Files 2012 */ |
| 364 |
|
| 365 |
/* Spectral radiances at detector */ |
| 366 |
double Lmax[][4] = { |
| 367 |
{240., 170., 150., 127.}, /* before April 6, 1984 */ |
| 368 |
{268., 179., 159., 123.}, /* between */ |
| 369 |
{268., 179., 148., 123.} /* after November 9, 1984 */ |
| 370 |
}; |
| 371 |
double Lmin[][4] = {{4., 3., 4., 2.}, {3., 3., 4., 3.}, {3., 3., 5., 3.}}; |
| 372 |
|
| 373 |
/* Solar exoatmospheric spectral irradiances */ |
| 374 |
double esun[] = {1824., 1570., 1249., 853.4}; |
| 375 |
|
| 376 |
julian = julian_char(lsat->creation); |
| 377 |
if (julian < julian_char("1984-04-06")) |
| 378 |
i = 0; |
| 379 |
else if (julian < julian_char("1984-11-08")) |
| 380 |
i = 1; |
| 381 |
else |
| 382 |
i = 2; |
| 383 |
|
| 384 |
lmax = Lmax[i]; |
| 385 |
lmin = Lmin[i]; |
| 386 |
|
| 387 |
lsat->number = 5; |
| 388 |
sensor_MSS(lsat); |
| 389 |
|
| 390 |
lsat->dist_es = earth_sun(lsat->date); |
| 391 |
|
| 392 |
for (i = 0; i < lsat->bands; i++) { |
| 393 |
j = lsat->band[i].number - 1; |
| 394 |
lsat->band[i].esun = *(esun + j); |
| 395 |
lsat->band[i].lmax = *(lmax + j); |
| 396 |
lsat->band[i].lmin = *(lmin + j); |
| 397 |
} |
| 398 |
G_debug(1, "Landsat-5 MSS"); |
| 399 |
return; |
| 400 |
} |
| 401 |
|
| 402 |
void set_TM5(lsat_data *lsat) |
| 403 |
{ |
| 404 |
int i, j; |
| 405 |
double julian, *lmax, *lmin, jbuf; |
| 406 |
|
| 407 |
/** USGS Calibration Parameter Files 2012 */ |
| 408 |
|
| 409 |
/* Spectral radiances at detector */ |
| 410 |
double Lmax[][7] = { |
| 411 |
{152.10, 296.81, 204.30, 206.20, 27.19, 15.303, |
| 412 |
14.38}, /* before May 4, 2003 */ |
| 413 |
{193.00, 365.00, 264.00, 221.00, 30.20, 15.303, |
| 414 |
16.50}, /* after May 4, 2003 */ |
| 415 |
{169.00, 333.00, 264.00, 221.00, 30.20, 15.303, 16.50} |
| 416 |
/* after April 2, 2007 */ |
| 417 |
}; |
| 418 |
double Lmin[][7] = {{-1.52, -2.84, -1.17, -1.51, -0.37, 1.2378, -0.15}, |
| 419 |
{-1.52, -2.84, -1.17, -1.51, -0.37, 1.2378, -0.15}, |
| 420 |
{-1.52, -2.84, -1.17, -1.51, -0.37, 1.2378, -0.15}}; |
| 421 |
|
| 422 |
/* Solar exoatmospheric spectral irradiances */ |
| 423 |
double esun[] = {1957., 1826., 1554., 1036., 215.0, 0., 80.67}; |
| 424 |
|
| 425 |
/* Thermal band calibration constants: K1 = 607.76 K2 = 1260.56 */ |
| 426 |
|
| 427 |
julian = julian_char(lsat->creation); |
| 428 |
if (julian < julian_char("2003-05-04")) |
| 429 |
i = 0; |
| 430 |
else if (julian < julian_char("2007-04-02")) |
| 431 |
i = 1; |
| 432 |
else |
| 433 |
i = 2; |
| 434 |
|
| 435 |
lmax = Lmax[i]; |
| 436 |
lmin = Lmin[i]; |
| 437 |
/* in Chander, Markham and Barsi 2007 */ |
| 438 |
if (i == 2) { |
| 439 |
julian = julian_char(lsat->date); /* Yes, here acquisition date */ |
| 440 |
if (julian >= julian_char("1992-01-01")) { |
| 441 |
lmax[0] = 193.0; |
| 442 |
lmax[1] = 365.0; |
| 443 |
} |
| 444 |
} |
| 445 |
|
| 446 |
jbuf = julian_char("2004-04-04"); |
| 447 |
if (julian >= jbuf && !(lsat->flag & METADATAFILE)) { |
| 448 |
G_warning( |
| 449 |
"Using QCalMin=1.0 as a NLAPS product processed after 04/04/2004"); |
| 450 |
} |
| 451 |
lsat->number = 5; |
| 452 |
sensor_TM(lsat); |
| 453 |
|
| 454 |
lsat->dist_es = earth_sun(lsat->date); |
| 455 |
|
| 456 |
for (i = 0; i < lsat->bands; i++) { |
| 457 |
if (julian >= jbuf) |
| 458 |
lsat->band[i].qcalmin = 1.; |
| 459 |
j = lsat->band[i].number - 1; |
| 460 |
lsat->band[i].esun = *(esun + j); |
| 461 |
lsat->band[i].lmax = *(lmax + j); |
| 462 |
lsat->band[i].lmin = *(lmin + j); |
| 463 |
if (lsat->band[i].thermal) { |
| 464 |
lsat->band[i].K1 = 607.76; |
| 465 |
lsat->band[i].K2 = 1260.56; |
| 466 |
} |
| 467 |
} |
| 468 |
G_debug(1, "Landsat-5 TM"); |
| 469 |
return; |
| 470 |
} |
| 471 |
|
| 472 |
/**************************************************************************** |
| 473 |
* PURPOSE: Store values of Landsat-7 ETM+ |
| 474 |
* April 15, 1999 to May 31, 2003 (SLC failure) |
| 475 |
*****************************************************************************/ |
| 476 |
void set_ETM(lsat_data *lsat, char gain[]) |
| 477 |
{ |
| 478 |
int i, k, j; |
| 479 |
double julian, *lmax, *lmin; |
| 480 |
|
| 481 |
/** USGS Calibration Parameter Files 2012 */ |
| 482 |
|
| 483 |
/* Spectral radiances at detector */ |
| 484 |
/* - LOW GAIN - */ |
| 485 |
double LmaxL[][8] = { |
| 486 |
{297.5, 303.4, 235.5, 235.0, 47.70, 17.04, 16.60, |
| 487 |
244.0}, /* before July 1, 2000 */ |
| 488 |
{293.7, 300.9, 234.4, 241.1, 47.57, 17.04, 16.54, 243.1} |
| 489 |
/* on or after July 1, 2000 */ |
| 490 |
}; |
| 491 |
double LminL[][8] = {{-6.2, -6.0, -4.5, -4.5, -1.0, 0.0, -0.35, -5.0}, |
| 492 |
{-6.2, -6.4, -5.0, -5.1, -1.0, 0.0, -0.35, -4.7}}; |
| 493 |
/* - HIGH GAIN - */ |
| 494 |
double LmaxH[][8] = { |
| 495 |
{194.3, 202.4, 158.6, 157.5, 31.76, 12.65, 10.932, 158.4}, |
| 496 |
{191.6, 196.5, 152.9, 157.4, 31.06, 12.65, 10.80, 158.3}}; |
| 497 |
double LminH[][8] = {{-6.2, -6.0, -4.5, -4.5, -1.0, 3.2, -0.35, -5.0}, |
| 498 |
{-6.2, -6.4, -5.0, -5.1, -1.0, 3.2, -0.35, -4.7}}; |
| 499 |
|
| 500 |
/* Solar exoatmospheric spectral irradiances */ |
| 501 |
double esun[] = {1969., 1840., 1551., 1044., 225.7, 0., 82.07, 1368.}; |
| 502 |
|
| 503 |
/* Thermal band calibration constants: K1 = 666.09 K2 = 1282.71 */ |
| 504 |
|
| 505 |
julian = julian_char(lsat->creation); |
| 506 |
k = ((julian < julian_char("2000-07-01")) ? 0 : 1); |
| 507 |
|
| 508 |
lsat->number = 7; |
| 509 |
sensor_ETM(lsat); |
| 510 |
|
| 511 |
lsat->dist_es = earth_sun(lsat->date); |
| 512 |
|
| 513 |
for (i = 0; i < lsat->bands; i++) { |
| 514 |
j = lsat->band[i].number - 1; |
| 515 |
if (gain[i] == 'H' || gain[i] == 'h') { |
| 516 |
lmax = LmaxH[k]; |
| 517 |
lmin = LminH[k]; |
| 518 |
} |
| 519 |
else { |
| 520 |
lmax = LmaxL[k]; |
| 521 |
lmin = LminL[k]; |
| 522 |
} |
| 523 |
lsat->band[i].esun = *(esun + j); |
| 524 |
lsat->band[i].lmax = *(lmax + j); |
| 525 |
lsat->band[i].lmin = *(lmin + j); |
| 526 |
if (lsat->band[i].thermal) { |
| 527 |
lsat->band[i].K1 = 666.09; |
| 528 |
lsat->band[i].K2 = 1282.71; |
| 529 |
} |
| 530 |
} |
| 531 |
G_debug(1, "Landsat-7 ETM+"); |
| 532 |
return; |
| 533 |
} |
| 534 |
|
| 535 |
/**************************************************************************** |
| 536 |
* PURPOSE: Store values of Landsat-8 OLI/TIRS |
| 537 |
* February 14, 2013 |
| 538 |
*****************************************************************************/ |
| 539 |
void set_OLI(lsat_data *lsat) |
| 540 |
{ |
| 541 |
int i, j; |
| 542 |
double *lmax, *lmin; |
| 543 |
|
| 544 |
/* Spectral radiances at detector */ |
| 545 |
/* estimates */ |
| 546 |
double Lmax[][11] = {{755.8, 770.7, 705.7, 597.7, 362.7, 91.4, 29.7, 673.3, |
| 547 |
149.0, 22.0, 22.0}}; |
| 548 |
double Lmin[][11] = {{-62.4, -63.6, -58.3, -49.4, -30.0, -7.5, -2.5, -55.6, |
| 549 |
-12.3, 0.1, 0.1}}; |
| 550 |
|
| 551 |
/* Solar exoatmospheric spectral irradiances */ |
| 552 |
/* estimates */ |
| 553 |
double esun[] = {2026.8, 2066.8, 1892.5, 1602.8, 972.6, 245.0, |
| 554 |
79.7, 1805.5, 399.7, 0., 0.}; |
| 555 |
|
| 556 |
lmax = Lmax[0]; |
| 557 |
lmin = Lmin[0]; |
| 558 |
|
| 559 |
lsat->number = 8; |
| 560 |
sensor_OLI(lsat); |
| 561 |
|
| 562 |
lsat->dist_es = earth_sun(lsat->date); |
| 563 |
|
| 564 |
for (i = 0; i < lsat->bands; i++) { |
| 565 |
j = lsat->band[i].number - 1; |
| 566 |
lsat->band[i].esun = *(esun + j); |
| 567 |
lsat->band[i].lmax = *(lmax + j); |
| 568 |
lsat->band[i].lmin = *(lmin + j); |
| 569 |
if (lsat->band[i].thermal) { |
| 570 |
lsat->band[i].K1 = (lsat->band[i].number == 10 ? 774.89 : 480.89); |
| 571 |
lsat->band[i].K2 = (lsat->band[i].number == 10 ? 1321.08 : 1201.14); |
| 572 |
} |
| 573 |
} |
| 574 |
G_debug(1, "Landsat-8 OLI/TIRS"); |
| 575 |
return; |
| 576 |
} |