49g2c_get_datetime(
int ipdtn,
long long int *ipdtmpl,
short year,
unsigned char month,
unsigned char day,
50 unsigned char hour,
unsigned char minute,
unsigned char second,
char *tabbrev)
52 int iutpos, iutpos2, iunit, iunit2;
55 int itemp, itemp2, is;
66 0, 0, 0, 0, 0, 0, 0, 16, 23, 17, 19, 18, 32, 31, 0, 0, 0, 0, 0, 0,
67 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
68 0, 17, 20, 0, 0, 22, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
69 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
70 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0,
71 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
73 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
75 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
80 0, 0, 0, 0, 0, 0, 0, 26, 33, 27,
81 29, 28, 42, 41, 0, 0, 0, 0, 0, 0,
82 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
83 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
84 0, 22, 30, 0, 0, 32, 35, 0, 0, 0,
85 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
86 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
87 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
88 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
89 33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
90 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
91 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
94 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
103 assert(ipdtn >= 0 && ipdtmpl && tabbrev);
108 if (ipdtn <= 15 || ipdtn == 32 || ipdtn == 50 || ipdtn == 51 || ipdtn == 91)
110 else if (ipdtn >= 40 && ipdtn <= 43)
112 else if (ipdtn >= 44 && ipdtn <= 47)
114 else if (ipdtn == 48)
116 else if (ipdtn == 52)
122 switch (ipdtmpl[iutpos])
125 strcpy(tunit,
"minute");
129 strcpy(tunit,
"hour");
133 strcpy(tunit,
"day");
137 strcpy(tunit,
"month");
141 strcpy(tunit,
"year");
145 strcpy(tunit,
"hour");
149 strcpy(tunit,
"hour");
153 strcpy(tunit,
"hour");
159 iutpos2 = ipos2[ipdtn - 1];
162 switch (ipdtmpl[iutpos2])
165 strcpy(tunit2,
"minute");
169 strcpy(tunit2,
"hour");
173 strcpy(tunit2,
"day");
177 strcpy(tunit2,
"month");
181 strcpy(tunit2,
"year");
185 strcpy(tunit2,
"hour");
189 strcpy(tunit2,
"hour");
193 strcpy(tunit2,
"hour");
198 sprintf(reftime,
"%4.4d%2.2d%2.2d%2.2d:%2.2d:%2.2d", year, month, day, hour, minute, second);
200 itemp = abs(ipdtmpl[iutpos + 1]) * iunit;
204 sprintf(tabbrev,
"valid at %lld", ipdtmpl[iutpos + 1]);
209 if ((ipdtn >= 0 && ipdtn <= 7) || ipdtn == 15 || ipdtn == 20 || (ipdtn >= 30 && ipdtn <= 32) || ipdtn == 40 ||
210 ipdtn == 41 || ipdtn == 44 || ipdtn == 45 || ipdtn == 48 || (ipdtn >= 50 && ipdtn <= 52))
212 sprintf(tabbrev,
"valid %d %s after %s", itemp, tunit, reftime);
216 is = ipos[ipdtn - 1] - 1;
217 sprintf(endtime,
"%4.4d%2.2d%2.2d%2.2d:%2.2d:%2.2d", (
int)ipdtmpl[is], (
int)ipdtmpl[is + 1],
218 (
int)ipdtmpl[is + 2], (
int)ipdtmpl[is + 3], (
int)ipdtmpl[is + 4], (
int)ipdtmpl[is + 5]);
220 itemp2 = abs(ipdtmpl[iutpos2]) * iunit2;
221 itemp2 = itemp + itemp2;
222 sprintf(tmpval2,
"%d", itemp2);
223 if (ipdtn == 8 && ipdtmpl[8] < 0)
226 sprintf(tabbrev,
"(%d -%d) valid %d %s before %s to %s", itemp, itemp2, itemp, tunit, reftime, endtime);
228 else if ((ipdtn >= 8 && ipdtn <= 14) || (ipdtn >= 42 && ipdtn <= 47) ||
233 sprintf(tabbrev,
"(%d -%d hr) valid %d %s after %s to %s", itemp, itemp2, itemp, tunit, reftime, endtime);
317 assert(ipdtn >= 0 && ipdtmpl && level_desc);
324 else if (ipdtn >= 40 && ipdtn <= 43)
326 else if (ipdtn >= 44 && ipdtn <= 47)
328 else if (ipdtn == 48)
330 else if (ipdtn >= 50 && ipdtn <= 51)
332 else if (ipdtn == 52)
334 else if (ipdtn == 91)
340 if (ipdtmpl[ipos] == 100 && ipdtmpl[ipos + 3] == 255)
342 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1] + 2)))
344 sprintf(level_desc,
"%s %s", tmpval1,
"mb");
347 else if (ipdtmpl[ipos] == 100 && ipdtmpl[ipos + 3] == 100)
349 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1] + 2)))
351 if ((ret =
format_level(tmpval2, ipdtmpl[ipos + 5], ipdtmpl[ipos + 4] + 2)))
353 sprintf(level_desc,
"%s - %s mb", tmpval1, tmpval2);
358 else if (ipdtmpl[ipos] == 101)
360 strcpy(level_desc,
" Mean Sea Level");
363 else if (ipdtmpl[ipos] == 102 && ipdtmpl[ipos + 3] == 255)
365 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
367 sprintf(level_desc,
"%s %s", tmpval1,
"m above MSL");
372 else if (ipdtmpl[ipos] == 103 && ipdtmpl[ipos + 3] == 255)
376 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
378 sprintf(level_desc,
"%s %s", tmpval1,
"m above ground");
381 else if (ipdtmpl[ipos] == 103 && ipdtmpl[ipos + 3] == 103)
383 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
385 if ((ret =
format_level(tmpval2, ipdtmpl[ipos + 5], ipdtmpl[ipos + 4])))
387 sprintf(level_desc,
"%s - %s m AGL", tmpval1, tmpval2);
393 else if (ipdtmpl[ipos] == 104 && ipdtmpl[ipos + 3] == 255)
395 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
397 sprintf(level_desc,
"%s %s", tmpval1,
"sigma");
402 else if (ipdtmpl[ipos] == 104 && ipdtmpl[ipos + 3] == 104)
404 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
406 if ((ret =
format_level(tmpval2, ipdtmpl[ipos + 5], ipdtmpl[ipos + 4])))
408 sprintf(level_desc,
"%s - %s sigma", tmpval1, tmpval2);
414 else if (ipdtmpl[ipos] == 105 && ipdtmpl[ipos + 3] == 255)
416 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
418 sprintf(level_desc,
"%s %s", tmpval1,
"hybrid lvl");
423 else if (ipdtmpl[ipos] == 105 && ipdtmpl[ipos + 3] == 105)
425 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
427 if ((ret =
format_level(tmpval2, ipdtmpl[ipos + 5], ipdtmpl[ipos + 4])))
429 sprintf(level_desc,
"%s - %s hybrid lvl", tmpval1, tmpval2);
435 else if (ipdtmpl[ipos] == 106 && ipdtmpl[ipos + 3] == 255)
437 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
439 sprintf(level_desc,
"%s %s", tmpval1,
"m below land");
444 else if (ipdtmpl[ipos] == 106 && ipdtmpl[ipos + 3] == 106)
446 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
448 if ((ret =
format_level(tmpval2, ipdtmpl[ipos + 5], ipdtmpl[ipos + 4])))
450 sprintf(level_desc,
"%s - %s m DBLY", tmpval1, tmpval2);
455 else if (ipdtmpl[ipos] == 107)
457 strcpy(level_desc,
" Isentropic level");
460 else if (ipdtmpl[ipos] == 108 && ipdtmpl[ipos + 3] == 108)
462 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1] + 2)))
464 if ((ret =
format_level(tmpval2, ipdtmpl[ipos + 5], ipdtmpl[ipos + 4] + 2)))
466 sprintf(level_desc,
"%s - %s mb SPDY", tmpval1, tmpval2);
473 else if (ipdtmpl[ipos] == 110)
475 strcpy(level_desc,
" Layer bet 2-hyb lvl");
478 else if (ipdtmpl[ipos] == 109 && ipdtmpl[ipos + 3] == 255)
480 if ((ret =
format_level(tmpval1, ipdtmpl[ipos + 2], ipdtmpl[ipos + 1])))
482 sprintf(level_desc,
"%s %s", tmpval1,
"pv surface");
487 else if (ipdtmpl[ipos] == 111)
488 strcpy(level_desc,
" Eta level");
489 else if (ipdtmpl[ipos] == 114)
490 strcpy(level_desc,
" Layer bet. 2-isent.");
491 else if (ipdtmpl[ipos] == 117)
492 strcpy(level_desc,
" Mixed layer depth");
493 else if (ipdtmpl[ipos] == 120)
494 strcpy(level_desc,
" Layer bet. 2-Eta lvl");
495 else if (ipdtmpl[ipos] == 121)
496 strcpy(level_desc,
" Layer bet. 2-isob.");
497 else if (ipdtmpl[ipos] == 125)
498 strcpy(level_desc,
" Specified height lvl");
499 else if (ipdtmpl[ipos] == 126)
500 strcpy(level_desc,
" Isobaric level");
501 else if (ipdtmpl[ipos] == 160)
502 strcpy(level_desc,
" Depth below sea lvl");
503 else if (ipdtmpl[ipos] == 170)
504 strcpy(level_desc,
" Ionospheric D-region lvl");
505 else if (ipdtmpl[ipos] == 1)
506 strcpy(level_desc,
" Surface");
507 else if (ipdtmpl[ipos] == 2)
508 strcpy(level_desc,
" Cloud base lvl");
509 else if (ipdtmpl[ipos] == 3)
510 strcpy(level_desc,
" Cloud top lvl");
511 else if (ipdtmpl[ipos] == 4)
512 strcpy(level_desc,
" 0 Deg Isotherm");
513 else if (ipdtmpl[ipos] == 5)
514 strcpy(level_desc,
" Level of adiabatic");
515 else if (ipdtmpl[ipos] == 6)
516 strcpy(level_desc,
" Max wind lvl");
517 else if (ipdtmpl[ipos] == 7)
518 strcpy(level_desc,
" Tropopause");
519 else if (ipdtmpl[ipos] == 8)
520 strcpy(level_desc,
" Nom. top");
521 else if (ipdtmpl[ipos] == 9)
522 strcpy(level_desc,
" Sea Bottom");
523 else if (ipdtmpl[ipos] == 10)
524 strcpy(level_desc,
" Entire Atmosphere");
525 else if (ipdtmpl[ipos] == 11)
526 strcpy(level_desc,
" Cumulonimbus Base");
527 else if (ipdtmpl[ipos] == 12)
528 strcpy(level_desc,
" Cumulonimbus Top");
529 else if (ipdtmpl[ipos] == 20)
530 strcpy(level_desc,
" Isothermal level");
531 else if (ipdtmpl[ipos] == 200)
532 strcpy(level_desc,
" Entire Atmosphere");
533 else if (ipdtmpl[ipos] == 201)
534 strcpy(level_desc,
" Entire ocean");
535 else if (ipdtmpl[ipos] == 204)
536 strcpy(level_desc,
" Highest Frz. lvl");
537 else if (ipdtmpl[ipos] == 206)
538 strcpy(level_desc,
" Grid scale cloud bl");
539 else if (ipdtmpl[ipos] == 207)
540 strcpy(level_desc,
" Grid scale cloud tl");
541 else if (ipdtmpl[ipos] == 209)
542 strcpy(level_desc,
" Boundary layer cbl");
543 else if (ipdtmpl[ipos] == 210)
544 strcpy(level_desc,
" Boundary layer ctl");
545 else if (ipdtmpl[ipos] == 211)
546 strcpy(level_desc,
" Boundary layer cl");
547 else if (ipdtmpl[ipos] == 212)
548 strcpy(level_desc,
" Low cloud bot. lvl");
549 else if (ipdtmpl[ipos] == 213)
550 strcpy(level_desc,
" Low cloud top lvl");
551 else if (ipdtmpl[ipos] == 214)
552 strcpy(level_desc,
" Low cloud layer");
553 else if (ipdtmpl[ipos] == 215)
554 strcpy(level_desc,
" Cloud ceiling");
555 else if (ipdtmpl[ipos] == 220)
556 strcpy(level_desc,
" Planetary boundary");
557 else if (ipdtmpl[ipos] == 221)
558 strcpy(level_desc,
" Layer 2 Hybrid lvl");
559 else if (ipdtmpl[ipos] == 222)
560 strcpy(level_desc,
" Mid. cloud bot. lvl");
561 else if (ipdtmpl[ipos] == 223)
562 strcpy(level_desc,
" Mid. cloud top lvl");
563 else if (ipdtmpl[ipos] == 224)
564 strcpy(level_desc,
" Middle cloud layer");
565 else if (ipdtmpl[ipos] == 232)
566 strcpy(level_desc,
" High cloud bot. lvl");
567 else if (ipdtmpl[ipos] == 233)
568 strcpy(level_desc,
" High cloud top lvl");
569 else if (ipdtmpl[ipos] == 234)
570 strcpy(level_desc,
" High cloud layer");
571 else if (ipdtmpl[ipos] == 235)
572 strcpy(level_desc,
" Ocean Isotherm lvl");
573 else if (ipdtmpl[ipos] == 236)
574 strcpy(level_desc,
" Layer 2-depth below");
575 else if (ipdtmpl[ipos] == 237)
576 strcpy(level_desc,
" Bot. Ocean mix. lyr");
577 else if (ipdtmpl[ipos] == 238)
578 strcpy(level_desc,
" Bot. Ocean iso. lyr");
579 else if (ipdtmpl[ipos] == 239)
580 strcpy(level_desc,
" layer ocean sfc 26C");
581 else if (ipdtmpl[ipos] == 240)
582 strcpy(level_desc,
" Ocean Mixed Layer");
583 else if (ipdtmpl[ipos] == 241)
584 strcpy(level_desc,
" Order Seq. Of Data");
585 else if (ipdtmpl[ipos] == 242)
586 strcpy(level_desc,
" Con. cloud bot. lvl");
587 else if (ipdtmpl[ipos] == 243)
588 strcpy(level_desc,
" Con. cloud top lvl");
589 else if (ipdtmpl[ipos] == 244)
590 strcpy(level_desc,
" Conv. cloud layer");
591 else if (ipdtmpl[ipos] == 245)
592 strcpy(level_desc,
" Lowest lvl wet bulb");
593 else if (ipdtmpl[ipos] == 246)
594 strcpy(level_desc,
" Max. equi. potential");
595 else if (ipdtmpl[ipos] == 247)
596 strcpy(level_desc,
" Equilibrium level");
597 else if (ipdtmpl[ipos] == 248)
598 strcpy(level_desc,
" Shallow con. cld bl");
599 else if (ipdtmpl[ipos] == 249)
600 strcpy(level_desc,
" Shallow con. cld tl");
601 else if (ipdtmpl[ipos] == 251)
602 strcpy(level_desc,
" Deep conv. cld bl");
603 else if (ipdtmpl[ipos] == 252)
604 strcpy(level_desc,
" Deep conv. cld tl");
605 else if (ipdtmpl[ipos] == 253)
606 strcpy(level_desc,
" Lowest bot. lvl sup");
607 else if (ipdtmpl[ipos] == 254)
608 strcpy(level_desc,
" highest top lvl sup");
611 sprintf(level_desc,
" %4d (Unknown Lvl)", (
int)ipdtmpl[ipos]);