| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#include "coda.h" |
| 33 |
#include "harp-ingestion.h" |
| 34 |
|
| 35 |
#include <assert.h> |
| 36 |
#include <math.h> |
| 37 |
#include <stdlib.h> |
| 38 |
#include <string.h> |
| 39 |
|
| 40 |
|
| 41 |
typedef struct ingest_info_struct |
| 42 |
{ |
| 43 |
coda_product *product; |
| 44 |
int format_version; |
| 45 |
long num_vertical; |
| 46 |
int model_temperature; |
| 47 |
int model_air; |
| 48 |
int has_model_air; |
| 49 |
int has_absolute_error; |
| 50 |
} ingest_info; |
| 51 |
|
| 52 |
static int read_dimensions(void *user_data, long dimension[HARP_NUM_DIM_TYPES]) |
| 53 |
{ |
| 54 |
dimension[harp_dimension_time] = 1; |
| 55 |
dimension[harp_dimension_vertical] = ((ingest_info *)user_data)->num_vertical; |
| 56 |
return 0; |
| 57 |
} |
| 58 |
|
| 59 |
static int get_profile_point(ingest_info *info, const char *datasetname, long index, const char *fieldname, |
| 60 |
harp_array data) |
| 61 |
{ |
| 62 |
coda_cursor cursor; |
| 63 |
|
| 64 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 65 |
{ |
| 66 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 67 |
return -1; |
| 68 |
} |
| 69 |
if (coda_cursor_goto_record_field_by_name(&cursor, datasetname) != 0) |
| 70 |
{ |
| 71 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 72 |
return -1; |
| 73 |
} |
| 74 |
if (coda_cursor_goto_array_element_by_index(&cursor, index) != 0) |
| 75 |
{ |
| 76 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 77 |
return -1; |
| 78 |
} |
| 79 |
if (coda_cursor_goto_record_field_by_name(&cursor, fieldname) != 0) |
| 80 |
{ |
| 81 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 82 |
return -1; |
| 83 |
} |
| 84 |
if (coda_cursor_read_double(&cursor, data.double_data) != 0) |
| 85 |
{ |
| 86 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 87 |
return -1; |
| 88 |
} |
| 89 |
|
| 90 |
return 0; |
| 91 |
} |
| 92 |
|
| 93 |
static int get_profile(ingest_info *info, const char *datasetname, const char *fieldname, harp_array data) |
| 94 |
{ |
| 95 |
coda_cursor cursor; |
| 96 |
int i; |
| 97 |
|
| 98 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 99 |
{ |
| 100 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 101 |
return -1; |
| 102 |
} |
| 103 |
if (coda_cursor_goto_record_field_by_name(&cursor, datasetname) != 0) |
| 104 |
{ |
| 105 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 106 |
return -1; |
| 107 |
} |
| 108 |
if (coda_cursor_goto_first_array_element(&cursor) != 0) |
| 109 |
{ |
| 110 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 111 |
return -1; |
| 112 |
} |
| 113 |
for (i = 0; i < info->num_vertical; i++) |
| 114 |
{ |
| 115 |
if (coda_cursor_goto_record_field_by_name(&cursor, fieldname) != 0) |
| 116 |
{ |
| 117 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 118 |
return -1; |
| 119 |
} |
| 120 |
if (coda_cursor_read_double(&cursor, &data.double_data[info->num_vertical - i - 1]) != 0) |
| 121 |
{ |
| 122 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 123 |
return -1; |
| 124 |
} |
| 125 |
coda_cursor_goto_parent(&cursor); |
| 126 |
|
| 127 |
if (i < info->num_vertical - 1) |
| 128 |
{ |
| 129 |
if (coda_cursor_goto_next_array_element(&cursor) != 0) |
| 130 |
{ |
| 131 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 132 |
return -1; |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
return 0; |
| 138 |
} |
| 139 |
|
| 140 |
static int get_std_profile(ingest_info *info, const char *datasetname, const char *fieldname, |
| 141 |
const char *std_fieldname, harp_array data) |
| 142 |
{ |
| 143 |
coda_cursor cursor; |
| 144 |
int i; |
| 145 |
|
| 146 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 147 |
{ |
| 148 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 149 |
return -1; |
| 150 |
} |
| 151 |
if (coda_cursor_goto_record_field_by_name(&cursor, datasetname) != 0) |
| 152 |
{ |
| 153 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 154 |
return -1; |
| 155 |
} |
| 156 |
if (coda_cursor_goto_first_array_element(&cursor) != 0) |
| 157 |
{ |
| 158 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 159 |
return -1; |
| 160 |
} |
| 161 |
for (i = 0; i < info->num_vertical; i++) |
| 162 |
{ |
| 163 |
long index = info->num_vertical - i - 1; |
| 164 |
|
| 165 |
if (coda_cursor_goto_record_field_by_name(&cursor, std_fieldname) != 0) |
| 166 |
{ |
| 167 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 168 |
return -1; |
| 169 |
} |
| 170 |
if (coda_cursor_read_double(&cursor, &data.double_data[index]) != 0) |
| 171 |
{ |
| 172 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 173 |
return -1; |
| 174 |
} |
| 175 |
coda_cursor_goto_parent(&cursor); |
| 176 |
if (info->has_absolute_error && strcmp(datasetname, "nl_local_species_density") == 0) |
| 177 |
{ |
| 178 |
if (data.double_data[index] == 6554) |
| 179 |
{ |
| 180 |
|
| 181 |
data.double_data[index] = harp_nan(); |
| 182 |
} |
| 183 |
else |
| 184 |
{ |
| 185 |
|
| 186 |
data.double_data[index] = pow(10, 0.005 * data.double_data[index]); |
| 187 |
} |
| 188 |
} |
| 189 |
else |
| 190 |
{ |
| 191 |
if (data.double_data[index] == 6553.5) |
| 192 |
{ |
| 193 |
|
| 194 |
data.double_data[index] = harp_nan(); |
| 195 |
} |
| 196 |
else |
| 197 |
{ |
| 198 |
double value; |
| 199 |
|
| 200 |
if (coda_cursor_goto_record_field_by_name(&cursor, fieldname) != 0) |
| 201 |
{ |
| 202 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 203 |
return -1; |
| 204 |
} |
| 205 |
if (coda_cursor_read_double(&cursor, &value) != 0) |
| 206 |
{ |
| 207 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 208 |
return -1; |
| 209 |
} |
| 210 |
coda_cursor_goto_parent(&cursor); |
| 211 |
|
| 212 |
|
| 213 |
data.double_data[index] = fabs(data.double_data[index] * 0.01 * value); |
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
if (i < info->num_vertical - 1) |
| 218 |
{ |
| 219 |
if (coda_cursor_goto_next_array_element(&cursor) != 0) |
| 220 |
{ |
| 221 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 222 |
return -1; |
| 223 |
} |
| 224 |
} |
| 225 |
} |
| 226 |
|
| 227 |
return 0; |
| 228 |
} |
| 229 |
|
| 230 |
static int get_pcd_profile(ingest_info *info, const char *datasetname, long pcd_index, harp_array data) |
| 231 |
{ |
| 232 |
coda_cursor cursor; |
| 233 |
int i; |
| 234 |
|
| 235 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 236 |
{ |
| 237 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 238 |
return -1; |
| 239 |
} |
| 240 |
if (coda_cursor_goto_record_field_by_name(&cursor, datasetname) != 0) |
| 241 |
{ |
| 242 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 243 |
return -1; |
| 244 |
} |
| 245 |
if (coda_cursor_goto_first_array_element(&cursor) != 0) |
| 246 |
{ |
| 247 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 248 |
return -1; |
| 249 |
} |
| 250 |
for (i = 0; i < info->num_vertical; i++) |
| 251 |
{ |
| 252 |
if (coda_cursor_goto_record_field_by_name(&cursor, "pcd") != 0) |
| 253 |
{ |
| 254 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 255 |
return -1; |
| 256 |
} |
| 257 |
if (coda_cursor_goto_array_element_by_index(&cursor, pcd_index) != 0) |
| 258 |
{ |
| 259 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 260 |
return -1; |
| 261 |
} |
| 262 |
if (coda_cursor_read_int16(&cursor, &data.int16_data[info->num_vertical - i - 1]) != 0) |
| 263 |
{ |
| 264 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 265 |
return -1; |
| 266 |
} |
| 267 |
coda_cursor_goto_parent(&cursor); |
| 268 |
coda_cursor_goto_parent(&cursor); |
| 269 |
|
| 270 |
if (i < info->num_vertical - 1) |
| 271 |
{ |
| 272 |
if (coda_cursor_goto_next_array_element(&cursor) != 0) |
| 273 |
{ |
| 274 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 275 |
return -1; |
| 276 |
} |
| 277 |
} |
| 278 |
} |
| 279 |
|
| 280 |
return 0; |
| 281 |
} |
| 282 |
|
| 283 |
static int read_illumination_condition(void *user_data, long index, harp_array data) |
| 284 |
{ |
| 285 |
ingest_info *info = (ingest_info *)user_data; |
| 286 |
coda_cursor cursor; |
| 287 |
int32_t condition; |
| 288 |
|
| 289 |
(void)index; |
| 290 |
|
| 291 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 292 |
{ |
| 293 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 294 |
return -1; |
| 295 |
} |
| 296 |
if (coda_cursor_goto_record_field_by_name(&cursor, "nl_summary_quality") != 0) |
| 297 |
{ |
| 298 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 299 |
return -1; |
| 300 |
} |
| 301 |
if (coda_cursor_goto_first_array_element(&cursor) != 0) |
| 302 |
{ |
| 303 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 304 |
return -1; |
| 305 |
} |
| 306 |
if (info->format_version == 0) |
| 307 |
{ |
| 308 |
if (coda_cursor_goto_record_field_by_name(&cursor, "limb_flag") != 0) |
| 309 |
{ |
| 310 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 311 |
return -1; |
| 312 |
} |
| 313 |
} |
| 314 |
else |
| 315 |
{ |
| 316 |
if (coda_cursor_goto_record_field_by_name(&cursor, "obs_illum_cond") != 0) |
| 317 |
{ |
| 318 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 319 |
return -1; |
| 320 |
} |
| 321 |
} |
| 322 |
if (coda_cursor_read_int32(&cursor, &condition) != 0) |
| 323 |
{ |
| 324 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 325 |
return -1; |
| 326 |
} |
| 327 |
*data.int8_data = (int8_t)condition; |
| 328 |
|
| 329 |
return 0; |
| 330 |
} |
| 331 |
|
| 332 |
static int read_datetime(void *user_data, harp_array data) |
| 333 |
{ |
| 334 |
ingest_info *info = (ingest_info *)user_data; |
| 335 |
|
| 336 |
return get_profile_point(info, "nl_geolocation", info->num_vertical / 2, "dsr_time", data); |
| 337 |
} |
| 338 |
|
| 339 |
static int read_datetime_start(void *user_data, harp_array data) |
| 340 |
{ |
| 341 |
return get_profile_point((ingest_info *)user_data, "nl_geolocation", 0, "dsr_time", data); |
| 342 |
} |
| 343 |
|
| 344 |
static int read_datetime_stop(void *user_data, harp_array data) |
| 345 |
{ |
| 346 |
ingest_info *info = (ingest_info *)user_data; |
| 347 |
|
| 348 |
return get_profile_point(info, "nl_geolocation", info->num_vertical - 1, "dsr_time", data); |
| 349 |
} |
| 350 |
|
| 351 |
static int read_orbit_index(void *user_data, harp_array data) |
| 352 |
{ |
| 353 |
ingest_info *info = (ingest_info *)user_data; |
| 354 |
coda_cursor cursor; |
| 355 |
|
| 356 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 357 |
{ |
| 358 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 359 |
return -1; |
| 360 |
} |
| 361 |
if (coda_cursor_goto(&cursor, "/mph/abs_orbit") != 0) |
| 362 |
{ |
| 363 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 364 |
return -1; |
| 365 |
} |
| 366 |
if (coda_cursor_read_int32(&cursor, data.int32_data) != 0) |
| 367 |
{ |
| 368 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 369 |
return -1; |
| 370 |
} |
| 371 |
|
| 372 |
return 0; |
| 373 |
} |
| 374 |
|
| 375 |
static int read_altitude(void *user_data, harp_array data) |
| 376 |
{ |
| 377 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "tangent_alt", data); |
| 378 |
} |
| 379 |
|
| 380 |
static int read_latitude(void *user_data, harp_array data) |
| 381 |
{ |
| 382 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "tangent_lat", data); |
| 383 |
} |
| 384 |
|
| 385 |
static int read_longitude(void *user_data, harp_array data) |
| 386 |
{ |
| 387 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "tangent_long", data); |
| 388 |
} |
| 389 |
|
| 390 |
static int read_o3(void *user_data, harp_array data) |
| 391 |
{ |
| 392 |
return get_profile((ingest_info *)user_data, "nl_local_species_density", "o3", data); |
| 393 |
} |
| 394 |
|
| 395 |
static int read_o3_std(void *user_data, harp_array data) |
| 396 |
{ |
| 397 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "o3", "o3_std", data); |
| 398 |
} |
| 399 |
|
| 400 |
static int read_o3_validity(void *user_data, harp_array data) |
| 401 |
{ |
| 402 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 0, data); |
| 403 |
} |
| 404 |
|
| 405 |
static int read_no2(void *user_data, harp_array data) |
| 406 |
{ |
| 407 |
return get_profile((ingest_info *)user_data, "nl_local_species_density", "no2", data); |
| 408 |
} |
| 409 |
|
| 410 |
static int read_no2_std(void *user_data, harp_array data) |
| 411 |
{ |
| 412 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "no2", "no2_std", data); |
| 413 |
} |
| 414 |
|
| 415 |
static int read_no2_validity(void *user_data, harp_array data) |
| 416 |
{ |
| 417 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 1, data); |
| 418 |
} |
| 419 |
|
| 420 |
static int read_no3(void *user_data, harp_array data) |
| 421 |
{ |
| 422 |
return get_profile((ingest_info *)user_data, "nl_local_species_density", "no3", data); |
| 423 |
} |
| 424 |
|
| 425 |
static int read_no3_std(void *user_data, harp_array data) |
| 426 |
{ |
| 427 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "no3", "no3_std", data); |
| 428 |
} |
| 429 |
|
| 430 |
static int read_no3_validity(void *user_data, harp_array data) |
| 431 |
{ |
| 432 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 2, data); |
| 433 |
} |
| 434 |
|
| 435 |
static int read_air(void *user_data, harp_array data) |
| 436 |
{ |
| 437 |
ingest_info *info = (ingest_info *)user_data; |
| 438 |
|
| 439 |
if (info->model_air) |
| 440 |
{ |
| 441 |
return get_profile(info, "nl_geolocation", "tangent_density", data); |
| 442 |
} |
| 443 |
return get_profile(info, "nl_local_species_density", "air", data); |
| 444 |
} |
| 445 |
|
| 446 |
static int read_air_std(void *user_data, harp_array data) |
| 447 |
{ |
| 448 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "air", "air_std", data); |
| 449 |
} |
| 450 |
|
| 451 |
static int read_air_validity(void *user_data, harp_array data) |
| 452 |
{ |
| 453 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 3, data); |
| 454 |
} |
| 455 |
|
| 456 |
static int read_o2(void *user_data, harp_array data) |
| 457 |
{ |
| 458 |
return get_profile((ingest_info *)user_data, "nl_local_species_density", "o2", data); |
| 459 |
} |
| 460 |
|
| 461 |
static int read_o2_std(void *user_data, harp_array data) |
| 462 |
{ |
| 463 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "o2", "o2_std", data); |
| 464 |
} |
| 465 |
|
| 466 |
static int read_o2_validity(void *user_data, harp_array data) |
| 467 |
{ |
| 468 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 4, data); |
| 469 |
} |
| 470 |
|
| 471 |
static int read_h2o(void *user_data, harp_array data) |
| 472 |
{ |
| 473 |
return get_profile((ingest_info *)user_data, "nl_local_species_density", "h2o", data); |
| 474 |
} |
| 475 |
|
| 476 |
static int read_h2o_std(void *user_data, harp_array data) |
| 477 |
{ |
| 478 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "h2o", "h2o_std", data); |
| 479 |
} |
| 480 |
|
| 481 |
static int read_h2o_validity(void *user_data, harp_array data) |
| 482 |
{ |
| 483 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 5, data); |
| 484 |
} |
| 485 |
|
| 486 |
static int read_oclo(void *user_data, harp_array data) |
| 487 |
{ |
| 488 |
return get_profile((ingest_info *)user_data, "nl_local_species_density", "oclo", data); |
| 489 |
} |
| 490 |
|
| 491 |
static int read_oclo_std(void *user_data, harp_array data) |
| 492 |
{ |
| 493 |
return get_std_profile((ingest_info *)user_data, "nl_local_species_density", "oclo", "oclo_std", data); |
| 494 |
} |
| 495 |
|
| 496 |
static int read_oclo_validity(void *user_data, harp_array data) |
| 497 |
{ |
| 498 |
return get_pcd_profile((ingest_info *)user_data, "nl_local_species_density", 6, data); |
| 499 |
} |
| 500 |
|
| 501 |
static int read_extinction_coefficient(void *user_data, harp_array data) |
| 502 |
{ |
| 503 |
return get_profile((ingest_info *)user_data, "nl_aerosols", "local_ext", data); |
| 504 |
} |
| 505 |
|
| 506 |
static int read_extinction_coefficient_std(void *user_data, harp_array data) |
| 507 |
{ |
| 508 |
return get_std_profile((ingest_info *)user_data, "nl_aerosols", "local_ext", "local_ext_std", data); |
| 509 |
} |
| 510 |
|
| 511 |
static int read_pressure(void *user_data, harp_array data) |
| 512 |
{ |
| 513 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "tangent_atm_p", data); |
| 514 |
} |
| 515 |
|
| 516 |
static int read_temperature(void *user_data, harp_array data) |
| 517 |
{ |
| 518 |
ingest_info *info = (ingest_info *)user_data; |
| 519 |
|
| 520 |
if (info->model_temperature) |
| 521 |
{ |
| 522 |
return get_profile(info, "nl_geolocation", "tangent_temp", data); |
| 523 |
} |
| 524 |
return get_profile(info, "nl_geolocation", "local_temp", data); |
| 525 |
} |
| 526 |
|
| 527 |
static int read_temperature_std(void *user_data, harp_array data) |
| 528 |
{ |
| 529 |
return get_std_profile((ingest_info *)user_data, "nl_geolocation", "local_temp", "local_temp_std", data); |
| 530 |
} |
| 531 |
|
| 532 |
static int read_sensor_altitude(void *user_data, harp_array data) |
| 533 |
{ |
| 534 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "alt", data); |
| 535 |
} |
| 536 |
|
| 537 |
static int read_sensor_latitude(void *user_data, harp_array data) |
| 538 |
{ |
| 539 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "lat", data); |
| 540 |
} |
| 541 |
|
| 542 |
static int read_sensor_longitude(void *user_data, harp_array data) |
| 543 |
{ |
| 544 |
return get_profile((ingest_info *)user_data, "nl_geolocation", "longit", data); |
| 545 |
} |
| 546 |
|
| 547 |
static int init_dimensions(ingest_info *info) |
| 548 |
{ |
| 549 |
coda_cursor cursor; |
| 550 |
|
| 551 |
if (coda_cursor_set_product(&cursor, info->product) != 0) |
| 552 |
{ |
| 553 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 554 |
return -1; |
| 555 |
} |
| 556 |
if (coda_cursor_goto_record_field_by_name(&cursor, "nl_geolocation") != 0) |
| 557 |
{ |
| 558 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 559 |
return -1; |
| 560 |
} |
| 561 |
if (coda_cursor_get_num_elements(&cursor, &info->num_vertical) != 0) |
| 562 |
{ |
| 563 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 564 |
return -1; |
| 565 |
} |
| 566 |
|
| 567 |
return 0; |
| 568 |
} |
| 569 |
|
| 570 |
static void ingestion_done(void *user_data) |
| 571 |
{ |
| 572 |
ingest_info *info = (ingest_info *)user_data; |
| 573 |
|
| 574 |
free(info); |
| 575 |
} |
| 576 |
|
| 577 |
static int ingestion_init(const harp_ingestion_module *module, coda_product *product, |
| 578 |
const harp_ingestion_options *options, harp_product_definition **definition, void **user_data) |
| 579 |
{ |
| 580 |
int format_version; |
| 581 |
ingest_info *info; |
| 582 |
|
| 583 |
(void)options; |
| 584 |
|
| 585 |
if (coda_get_product_version(product, &format_version) != 0) |
| 586 |
{ |
| 587 |
harp_set_error(HARP_ERROR_CODA, NULL); |
| 588 |
return -1; |
| 589 |
} |
| 590 |
|
| 591 |
info = malloc(sizeof(ingest_info)); |
| 592 |
if (info == NULL) |
| 593 |
{ |
| 594 |
harp_set_error(HARP_ERROR_OUT_OF_MEMORY, "out of memory (could not allocate %lu bytes) (%s:%u)", |
| 595 |
sizeof(ingest_info), __FILE__, __LINE__); |
| 596 |
return -1; |
| 597 |
} |
| 598 |
info->product = product; |
| 599 |
info->format_version = format_version; |
| 600 |
info->num_vertical = 0; |
| 601 |
info->model_temperature = 0; |
| 602 |
info->model_air = 0; |
| 603 |
info->has_model_air = 0; |
| 604 |
info->has_absolute_error = 0; |
| 605 |
|
| 606 |
if (format_version > 0) |
| 607 |
{ |
| 608 |
info->has_model_air = 1; |
| 609 |
} |
| 610 |
if (format_version >= 2) |
| 611 |
{ |
| 612 |
info->has_absolute_error = 1; |
| 613 |
} |
| 614 |
|
| 615 |
if (init_dimensions(info) != 0) |
| 616 |
{ |
| 617 |
ingestion_done(info); |
| 618 |
return -1; |
| 619 |
} |
| 620 |
|
| 621 |
if (harp_ingestion_options_has_option(options, "temperature")) |
| 622 |
{ |
| 623 |
info->model_temperature = 1; |
| 624 |
} |
| 625 |
|
| 626 |
if (harp_ingestion_options_has_option(options, "air")) |
| 627 |
{ |
| 628 |
info->model_air = 1; |
| 629 |
} |
| 630 |
|
| 631 |
*definition = *module->product_definition; |
| 632 |
*user_data = info; |
| 633 |
|
| 634 |
return 0; |
| 635 |
} |
| 636 |
|
| 637 |
static int include_air(void *user_data) |
| 638 |
{ |
| 639 |
return !((ingest_info *)user_data)->model_air || ((ingest_info *)user_data)->has_model_air; |
| 640 |
} |
| 641 |
|
| 642 |
static int include_air_std(void *user_data) |
| 643 |
{ |
| 644 |
return !((ingest_info *)user_data)->model_air; |
| 645 |
} |
| 646 |
|
| 647 |
static int include_temperature_std(void *user_data) |
| 648 |
{ |
| 649 |
return !((ingest_info *)user_data)->model_temperature; |
| 650 |
} |
| 651 |
|
| 652 |
int harp_ingestion_module_gomos_l2_init(void) |
| 653 |
{ |
| 654 |
const char *scene_type_values[] = { "dark", "bright", "twilight", "straylight", "twilight_straylight" }; |
| 655 |
const char *model_options[] = { "model" }; |
| 656 |
harp_ingestion_module *module; |
| 657 |
harp_product_definition *product_definition; |
| 658 |
harp_variable_definition *variable_definition; |
| 659 |
harp_dimension_type dimension_type[2]; |
| 660 |
const char *description_std_rel; |
| 661 |
const char *description_std_abs; |
| 662 |
const char *description; |
| 663 |
const char *path; |
| 664 |
|
| 665 |
description = "GOMOS Temperature and Atmospheric Constituents Profiles"; |
| 666 |
module = harp_ingestion_register_module("GOMOS_L2", "GOMOS", "ENVISAT_GOMOS", "GOM_NL__2P", description, |
| 667 |
ingestion_init, ingestion_done); |
| 668 |
|
| 669 |
harp_ingestion_register_option(module, "temperature", "retrieve the locally measured temperature (default) or the " |
| 670 |
"temperature from the external model (temperature=model)", 1, model_options); |
| 671 |
|
| 672 |
harp_ingestion_register_option(module, "air", "retrieve the locally measured air density (default) or the air " |
| 673 |
"density from the external model (air=model)", 1, model_options); |
| 674 |
|
| 675 |
description = "profile data"; |
| 676 |
product_definition = harp_ingestion_register_product(module, "GOMOS_L2", description, read_dimensions); |
| 677 |
description = "GOMOS Level 2 products only contain a single profile; all measured profile points will be provided " |
| 678 |
"in reverse order (from low altitude to high altitude) in the profile"; |
| 679 |
harp_product_definition_add_mapping(product_definition, description, NULL); |
| 680 |
|
| 681 |
dimension_type[0] = harp_dimension_time; |
| 682 |
dimension_type[1] = harp_dimension_vertical; |
| 683 |
|
| 684 |
description_std_rel = "values equal to 6553.5% will be set to NaN; value will be converted to an uncertainty by " |
| 685 |
"multiplying with the absolute value of the measured concentration"; |
| 686 |
description_std_abs = "values equal to 6554 will be set to NaN; value will be converted to an uncertainty by " |
| 687 |
"using the log10(v)/0.005 conversion"; |
| 688 |
|
| 689 |
|
| 690 |
description = "time of the profile"; |
| 691 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "datetime", harp_type_double, |
| 692 |
1, dimension_type, NULL, description, |
| 693 |
"seconds since 2000-01-01", NULL, read_datetime); |
| 694 |
path = "/nl_geolocation[]/dsr_time"; |
| 695 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, "time of mid record"); |
| 696 |
|
| 697 |
|
| 698 |
description = "start time of the profile"; |
| 699 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "datetime_start", |
| 700 |
harp_type_double, 1, dimension_type, NULL, |
| 701 |
description, "seconds since 2000-01-01", NULL, |
| 702 |
read_datetime_start); |
| 703 |
path = "/nl_geolocation[]/dsr_time"; |
| 704 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, "time of first record"); |
| 705 |
|
| 706 |
|
| 707 |
description = "stop time of the profile"; |
| 708 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "datetime_stop", |
| 709 |
harp_type_double, 1, dimension_type, NULL, |
| 710 |
description, "seconds since 2000-01-01", NULL, |
| 711 |
read_datetime_stop); |
| 712 |
path = "/nl_geolocation[]/dsr_time"; |
| 713 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, "time of last record"); |
| 714 |
|
| 715 |
|
| 716 |
description = "absolute orbit number"; |
| 717 |
variable_definition = |
| 718 |
harp_ingestion_register_variable_full_read(product_definition, "orbit_index", harp_type_int32, 0, NULL, NULL, |
| 719 |
description, NULL, NULL, read_orbit_index); |
| 720 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, "/mph/abs_orbit", NULL); |
| 721 |
|
| 722 |
|
| 723 |
description = "altitude"; |
| 724 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "altitude", harp_type_double, |
| 725 |
2, dimension_type, NULL, description, "m", NULL, |
| 726 |
read_altitude); |
| 727 |
path = "/nl_geolocation[]/tangent_alt"; |
| 728 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 729 |
|
| 730 |
|
| 731 |
description = "latitude"; |
| 732 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "latitude", harp_type_double, |
| 733 |
2, dimension_type, NULL, description, |
| 734 |
"degree_north", NULL, read_latitude); |
| 735 |
harp_variable_definition_set_valid_range_double(variable_definition, -90.0, 90.0); |
| 736 |
path = "/nl_geolocation[]/tangent_lat"; |
| 737 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 738 |
|
| 739 |
|
| 740 |
description = "longitude"; |
| 741 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "longitude", |
| 742 |
harp_type_double, 2, dimension_type, NULL, |
| 743 |
description, "degree_east", NULL, read_longitude); |
| 744 |
harp_variable_definition_set_valid_range_double(variable_definition, -180.0, 180.0); |
| 745 |
path = "/nl_geolocation[]/tangent_long"; |
| 746 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 747 |
|
| 748 |
|
| 749 |
description = "Ozone local density"; |
| 750 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "O3_number_density", |
| 751 |
harp_type_double, 2, dimension_type, NULL, |
| 752 |
description, "molec/cm3", NULL, read_o3); |
| 753 |
path = "/nl_local_species_density[]/o3"; |
| 754 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 755 |
|
| 756 |
|
| 757 |
description = "standard deviation for the ozone local density"; |
| 758 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 759 |
"O3_number_density_uncertainty", harp_type_double, |
| 760 |
2, dimension_type, NULL, description, "molec/cm3", |
| 761 |
NULL, read_o3_std); |
| 762 |
path = "/nl_local_species_density[]/o3_std"; |
| 763 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version < 2", path, |
| 764 |
description_std_rel); |
| 765 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version >= 2", path, |
| 766 |
description_std_abs); |
| 767 |
|
| 768 |
|
| 769 |
description = "PCD (product confidence data) value for the ozone local density"; |
| 770 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 771 |
"O3_number_density_validity", harp_type_int16, |
| 772 |
2, dimension_type, NULL, description, NULL, |
| 773 |
NULL, read_o3_validity); |
| 774 |
path = "/nl_local_species_density[]/pcd[0]"; |
| 775 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 776 |
|
| 777 |
|
| 778 |
description = "NO2 local density"; |
| 779 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "NO2_number_density", |
| 780 |
harp_type_double, 2, dimension_type, NULL, |
| 781 |
description, "molec/cm3", NULL, read_no2); |
| 782 |
path = "/nl_local_species_density[]/no2"; |
| 783 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 784 |
|
| 785 |
|
| 786 |
description = "standard deviation for the NO2 local density"; |
| 787 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 788 |
"NO2_number_density_uncertainty", harp_type_double, |
| 789 |
2, dimension_type, NULL, description, "molec/cm3", |
| 790 |
NULL, read_no2_std); |
| 791 |
path = "/nl_local_species_density[]/no2_std"; |
| 792 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version < 2", path, |
| 793 |
description_std_rel); |
| 794 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version >= 2", path, |
| 795 |
description_std_abs); |
| 796 |
|
| 797 |
|
| 798 |
description = "PCD (product confidence data) value for the NO2 local density"; |
| 799 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 800 |
"NO2_number_density_validity", harp_type_int16, |
| 801 |
2, dimension_type, NULL, description, NULL, |
| 802 |
NULL, read_no2_validity); |
| 803 |
path = "/nl_local_species_density[]/pcd[1]"; |
| 804 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 805 |
|
| 806 |
|
| 807 |
description = "NO3 local density"; |
| 808 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "NO3_number_density", |
| 809 |
harp_type_double, 2, dimension_type, NULL, |
| 810 |
description, "molec/cm3", NULL, read_no3); |
| 811 |
path = "/nl_local_species_density[]/no3"; |
| 812 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 813 |
|
| 814 |
|
| 815 |
description = "standard deviation for the NO3 local density"; |
| 816 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 817 |
"NO3_number_density_uncertainty", harp_type_double, |
| 818 |
2, dimension_type, NULL, description, "molec/cm3", |
| 819 |
NULL, read_no3_std); |
| 820 |
path = "/nl_local_species_density[]/no3_std"; |
| 821 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version < 2", path, |
| 822 |
description_std_rel); |
| 823 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version >= 2", path, |
| 824 |
description_std_abs); |
| 825 |
|
| 826 |
|
| 827 |
description = "PCD (product confidence data) value for the NO3 local density"; |
| 828 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 829 |
"NO3_number_density_validity", harp_type_int16, |
| 830 |
2, dimension_type, NULL, description, NULL, |
| 831 |
NULL, read_no3_validity); |
| 832 |
path = "/nl_local_species_density[]/pcd[2]"; |
| 833 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 834 |
|
| 835 |
|
| 836 |
description = "O2 local density"; |
| 837 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "O2_number_density", |
| 838 |
harp_type_double, 2, dimension_type, NULL, |
| 839 |
description, "molec/cm3", NULL, read_o2); |
| 840 |
path = "/nl_local_species_density[]/o2"; |
| 841 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 842 |
|
| 843 |
|
| 844 |
description = "standard deviation for the O2 local density"; |
| 845 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 846 |
"O2_number_density_uncertainty", harp_type_double, |
| 847 |
2, dimension_type, NULL, description, "molec/cm3", |
| 848 |
NULL, read_o2_std); |
| 849 |
path = "/nl_local_species_density[]/o2_std"; |
| 850 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version < 2", path, |
| 851 |
description_std_rel); |
| 852 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version >= 2", path, |
| 853 |
description_std_abs); |
| 854 |
|
| 855 |
|
| 856 |
description = "PCD (product confidence data) value for the O2 local density"; |
| 857 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 858 |
"O2_number_density_validity", harp_type_int16, |
| 859 |
2, dimension_type, NULL, description, NULL, |
| 860 |
NULL, read_o2_validity); |
| 861 |
path = "/nl_local_species_density[]/pcd[4]"; |
| 862 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 863 |
|
| 864 |
|
| 865 |
description = "H2O local density"; |
| 866 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "H2O_number_density", |
| 867 |
harp_type_double, 2, dimension_type, NULL, |
| 868 |
description, "molec/cm3", NULL, read_h2o); |
| 869 |
path = "/nl_local_species_density[]/h2o"; |
| 870 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 871 |
|
| 872 |
|
| 873 |
description = "standard deviation for the H2O local density"; |
| 874 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 875 |
"H2O_number_density_uncertainty", harp_type_double, |
| 876 |
2, dimension_type, NULL, description, "molec/cm3", |
| 877 |
NULL, read_h2o_std); |
| 878 |
path = "/nl_local_species_density[]/h2o_std"; |
| 879 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version < 2", path, |
| 880 |
description_std_rel); |
| 881 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version >= 2", path, |
| 882 |
description_std_abs); |
| 883 |
|
| 884 |
|
| 885 |
description = "PCD (product confidence data) value for the H2O local density"; |
| 886 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 887 |
"H2O_number_density_validity", harp_type_int16, |
| 888 |
2, dimension_type, NULL, description, NULL, |
| 889 |
NULL, read_h2o_validity); |
| 890 |
path = "/nl_local_species_density[]/pcd[5]"; |
| 891 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 892 |
|
| 893 |
|
| 894 |
description = "OClO local density"; |
| 895 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "OClO_number_density", |
| 896 |
harp_type_double, 2, dimension_type, NULL, |
| 897 |
description, "molec/cm3", NULL, read_oclo); |
| 898 |
path = "/nl_local_species_density[]/oclo"; |
| 899 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 900 |
|
| 901 |
|
| 902 |
description = "standard deviation for the OClO local density"; |
| 903 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 904 |
"OClO_number_density_uncertainty", |
| 905 |
harp_type_double, 2, dimension_type, NULL, |
| 906 |
description, "molec/cm3", NULL, read_oclo_std); |
| 907 |
path = "/nl_local_species_density[]/oclo_std"; |
| 908 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version < 2", path, |
| 909 |
description_std_rel); |
| 910 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version >= 2", path, |
| 911 |
description_std_abs); |
| 912 |
|
| 913 |
|
| 914 |
description = "PCD (product confidence data) value for the OClO local density"; |
| 915 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 916 |
"OClO_number_density_validity", harp_type_int16, |
| 917 |
2, dimension_type, NULL, description, NULL, |
| 918 |
NULL, read_oclo_validity); |
| 919 |
path = "/nl_local_species_density[]/pcd[6]"; |
| 920 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 921 |
|
| 922 |
|
| 923 |
description = "aerosol extinction coefficient"; |
| 924 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 925 |
"aerosol_extinction_coefficient", harp_type_double, |
| 926 |
2, dimension_type, NULL, description, "1/km", NULL, |
| 927 |
read_extinction_coefficient); |
| 928 |
path = "/nl_aerosols[]/local_ext"; |
| 929 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 930 |
|
| 931 |
|
| 932 |
description = "standard deviation for the aerosol extinction coefficient"; |
| 933 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 934 |
"aerosol_extinction_coefficient_uncertainty", |
| 935 |
harp_type_double, 2, dimension_type, NULL, |
| 936 |
description, "1/km", NULL, |
| 937 |
read_extinction_coefficient_std); |
| 938 |
path = "/nl_aerosols[]/local_ext_std"; |
| 939 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, description_std_rel); |
| 940 |
|
| 941 |
|
| 942 |
description = "atmospheric pressure from external model"; |
| 943 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "pressure", |
| 944 |
harp_type_double, 2, dimension_type, NULL, |
| 945 |
description, "Pa", NULL, read_pressure); |
| 946 |
path = "/nl_geolocation[]/tangent_atm_p"; |
| 947 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 948 |
|
| 949 |
|
| 950 |
description = "temperature"; |
| 951 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "temperature", |
| 952 |
harp_type_double, 2, dimension_type, NULL, |
| 953 |
description, "K", NULL, read_temperature); |
| 954 |
path = "/nl_geolocation[]/local_temp"; |
| 955 |
harp_variable_definition_add_mapping(variable_definition, "temperature unset", NULL, path, NULL); |
| 956 |
path = "/nl_geolocation[]/tangent_temp"; |
| 957 |
harp_variable_definition_add_mapping(variable_definition, "temperature=model", NULL, path, NULL); |
| 958 |
|
| 959 |
|
| 960 |
description = "standard deviation for the local temperature"; |
| 961 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "temperature_uncertainty", |
| 962 |
harp_type_double, 2, dimension_type, NULL, |
| 963 |
description, "K", include_temperature_std, |
| 964 |
read_temperature_std); |
| 965 |
path = "/nl_geolocation[]/local_temp_std"; |
| 966 |
harp_variable_definition_add_mapping(variable_definition, "temperature unset", NULL, path, NULL); |
| 967 |
|
| 968 |
|
| 969 |
description = "air density"; |
| 970 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "number_density", |
| 971 |
harp_type_double, 2, dimension_type, NULL, |
| 972 |
description, "molec/cm3", include_air, read_air); |
| 973 |
path = "/nl_local_species_density[]/air"; |
| 974 |
harp_variable_definition_add_mapping(variable_definition, "air unset", NULL, path, NULL); |
| 975 |
path = "/nl_geolocation[]/tangent_density"; |
| 976 |
harp_variable_definition_add_mapping(variable_definition, "air=model", "CODA product version > 0", path, NULL); |
| 977 |
|
| 978 |
|
| 979 |
description = "standard deviation for the local air density"; |
| 980 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 981 |
"number_density_uncertainty", harp_type_double, |
| 982 |
2, dimension_type, NULL, description, "molec/cm3", |
| 983 |
include_air_std, read_air_std); |
| 984 |
path = "/nl_local_species_density[]/air_std"; |
| 985 |
harp_variable_definition_add_mapping(variable_definition, "air unset", "CODA product version < 2", path, |
| 986 |
description_std_rel); |
| 987 |
harp_variable_definition_add_mapping(variable_definition, "air unset", "CODA product version >= 2", path, |
| 988 |
description_std_abs); |
| 989 |
|
| 990 |
|
| 991 |
description = "PCD (product confidence data) value for the local air density"; |
| 992 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, |
| 993 |
"number_density_validity", harp_type_int16, |
| 994 |
2, dimension_type, NULL, description, NULL, |
| 995 |
include_air_std, read_air_validity); |
| 996 |
path = "/nl_local_species_density[]/pcd[3]"; |
| 997 |
harp_variable_definition_add_mapping(variable_definition, "air unset", NULL, path, NULL); |
| 998 |
|
| 999 |
|
| 1000 |
description = "altitude of the satellite"; |
| 1001 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "sensor_altitude", |
| 1002 |
harp_type_double, 2, dimension_type, NULL, |
| 1003 |
description, "m", NULL, read_sensor_altitude); |
| 1004 |
path = "/nl_geolocation[]/tangent_alt"; |
| 1005 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 1006 |
|
| 1007 |
|
| 1008 |
description = "latitude of the satellite position"; |
| 1009 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "sensor_latitude", |
| 1010 |
harp_type_double, 2, dimension_type, NULL, |
| 1011 |
description, "degree_north", NULL, |
| 1012 |
read_sensor_latitude); |
| 1013 |
harp_variable_definition_set_valid_range_double(variable_definition, -90.0, 90.0); |
| 1014 |
path = "/nl_geolocation[]/lat"; |
| 1015 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 1016 |
|
| 1017 |
|
| 1018 |
description = "longitude of the satellite position"; |
| 1019 |
variable_definition = harp_ingestion_register_variable_full_read(product_definition, "sensor_longitude", |
| 1020 |
harp_type_double, 2, dimension_type, NULL, |
| 1021 |
description, "degree_east", NULL, |
| 1022 |
read_sensor_longitude); |
| 1023 |
harp_variable_definition_set_valid_range_double(variable_definition, -180.0, 180.0); |
| 1024 |
path = "/nl_geolocation[]/longit"; |
| 1025 |
harp_variable_definition_add_mapping(variable_definition, NULL, NULL, path, NULL); |
| 1026 |
|
| 1027 |
|
| 1028 |
description = "illumination condition for the profile"; |
| 1029 |
variable_definition = harp_ingestion_register_variable_block_read(product_definition, "scene_type", harp_type_int8, |
| 1030 |
1, dimension_type, NULL, description, NULL, NULL, |
| 1031 |
read_illumination_condition); |
| 1032 |
harp_variable_definition_set_enumeration_values(variable_definition, 5, scene_type_values); |
| 1033 |
path = "/nl_summary_quality[0]/limb_flag"; |
| 1034 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version 0", path, NULL); |
| 1035 |
path = "/nl_summary_quality[0]/obs_illum_cond"; |
| 1036 |
harp_variable_definition_add_mapping(variable_definition, NULL, "CODA product version 1 and higher", path, NULL); |
| 1037 |
|
| 1038 |
|
| 1039 |
return 0; |
| 1040 |
} |