Changeset 13742 for trunk/psModules/src/concepts/pmConceptsStandard.c
- Timestamp:
- Jun 10, 2007, 7:54:46 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r13646 r13742 49 49 // FPA.FILTER 50 50 psMetadataItem *p_pmConceptParse_FPA_FILTER(const psMetadataItem *concept, 51 const psMetadataItem *pattern,51 const psMetadataItem *pattern, 52 52 pmConceptSource source, 53 const psMetadata *cameraFormat,54 const pmFPA *fpa,55 const pmChip *chip,56 const pmCell *cell)53 const psMetadata *cameraFormat, 54 const pmFPA *fpa, 55 const pmChip *chip, 56 const pmCell *cell) 57 57 { 58 58 assert(concept); … … 86 86 87 87 psMetadataItem *p_pmConceptFormat_FPA_FILTER(const psMetadataItem *concept, 88 pmConceptSource source,89 const psMetadata *cameraFormat,90 const pmFPA *fpa,91 const pmChip *chip,92 const pmCell *cell)88 pmConceptSource source, 89 const psMetadata *cameraFormat, 90 const pmFPA *fpa, 91 const pmChip *chip, 92 const pmCell *cell) 93 93 { 94 94 assert(concept); … … 137 137 // FPA.RA and FPA.DEC 138 138 psMetadataItem *p_pmConceptParse_FPA_Coords(const psMetadataItem *concept, 139 const psMetadataItem *pattern,139 const psMetadataItem *pattern, 140 140 pmConceptSource source, 141 const psMetadata *cameraFormat,142 const pmFPA *fpa,143 const pmChip *chip,144 const pmCell *cell)141 const psMetadata *cameraFormat, 142 const pmFPA *fpa, 143 const pmChip *chip, 144 const pmCell *cell) 145 145 { 146 146 assert(concept); … … 150 150 double coords = NAN; // The coordinates 151 151 switch (concept->type) { 152 case PS_TYPE_F32:152 case PS_TYPE_F32: 153 153 coords = concept->data.F32; 154 154 break; 155 case PS_TYPE_F64:155 case PS_TYPE_F64: 156 156 coords = concept->data.F64; 157 157 break; 158 case PS_DATA_STRING:158 case PS_DATA_STRING: 159 159 // Sexagesimal format 160 160 { … … 163 163 // XXX: Upgrade path is to allow dd:mm.mmm 164 164 if (sscanf(concept->data.V, "%d:%d:%f", &big, &medium, &small) != 3 && 165 sscanf(concept->data.V, "%d %d %f", &big, &medium, &small) != 3)165 sscanf(concept->data.V, "%d %d %f", &big, &medium, &small) != 3) 166 166 { 167 167 psError(PS_ERR_UNKNOWN, true, "Cannot interpret %s: %s\n", pattern->name, concept->data.str); … … 175 175 } 176 176 break; 177 default:177 default: 178 178 psError(PS_ERR_UNKNOWN, true, "%s concept is of an unexpected type: %x\n", 179 179 pattern->name, concept->type); … … 208 208 // FPA.RA and FPA.DEC 209 209 psMetadataItem *p_pmConceptFormat_FPA_Coords(const psMetadataItem *concept, 210 pmConceptSource source,211 const psMetadata *cameraFormat,212 const pmFPA *fpa,213 const pmChip *chip,214 const pmCell *cell)210 pmConceptSource source, 211 const psMetadata *cameraFormat, 212 const pmFPA *fpa, 213 const pmChip *chip, 214 const pmCell *cell) 215 215 { 216 216 assert(concept); … … 226 226 bool mdok = true; // Status of MD lookup 227 227 psMetadata *formats = psMetadataLookupMetadata(&mdok, 228 cameraFormat,229 "FORMATS");228 cameraFormat, 229 "FORMATS"); 230 230 if (mdok && formats) { 231 231 psString format = psMetadataLookupStr(&mdok,formats, concept->name); … … 270 270 271 271 psMetadataItem *p_pmConceptParse_CELL_TRIMSEC(const psMetadataItem *concept, 272 const psMetadataItem *pattern,273 pmConceptSource source,274 const psMetadata *cameraFormat,275 const pmFPA *fpa,276 const pmChip *chip,277 const pmCell *cell)272 const psMetadataItem *pattern, 273 pmConceptSource source, 274 const psMetadata *cameraFormat, 275 const pmFPA *fpa, 276 const pmChip *chip, 277 const pmCell *cell) 278 278 { 279 279 assert(concept); … … 281 281 assert(pattern); 282 282 283 int xParity = 0; 284 int yParity = 0; 283 285 psRegion *trimsec = psRegionAlloc(0, 0, 0, 0); 284 286 … … 288 290 return NULL; 289 291 } else { 290 *trimsec = psRegionFromString(concept->data.V); 292 // allow for x and y flips in regions 293 *trimsec = psRegionAndParityFromString(&xParity, &yParity, concept->data.V); 291 294 } 292 295 … … 304 307 305 308 psMetadataItem *p_pmConceptParse_CELL_BIASSEC(const psMetadataItem *concept, 306 const psMetadataItem *pattern,307 pmConceptSource source,308 const psMetadata *cameraFormat,309 const pmFPA *fpa,310 const pmChip *chip,311 const pmCell *cell)309 const psMetadataItem *pattern, 310 pmConceptSource source, 311 const psMetadata *cameraFormat, 312 const pmFPA *fpa, 313 const pmChip *chip, 314 const pmCell *cell) 312 315 { 313 316 assert(concept); … … 321 324 // a single BIASSEC is of the form [AAAA] 322 325 // we may have multiple BIASSEC entries separated by space, commas, or semicolons 326 int xParity = 0; 327 int yParity = 0; 323 328 char *p = strchr (concept->data.V, '['); 324 329 while (p != NULL) { … … 330 335 331 336 psRegion *region = psAlloc(sizeof(psRegion)); // The region 332 *region = psRegion FromString(regionString);337 *region = psRegionAndParityFromString(&xParity, &yParity, regionString); 333 338 psListAdd(biassecs, PS_LIST_TAIL, region); 334 339 psFree(region); // Drop reference … … 340 345 } 341 346 case PS_DATA_LIST: { 342 psList *regions = concept->data.V; // The list of regions 343 psListIterator *regionsIter = psListIteratorAlloc(regions, PS_LIST_HEAD, false); // Iterator 344 psMetadataItem *regionItem = NULL; // Item from list iteration 345 while ((regionItem = psListGetAndIncrement(regionsIter))) { 346 if (regionItem->type != PS_DATA_STRING) { 347 psWarning("CELL.BIASSEC member is not of type STR --- ignored.\n"); 348 continue; 349 } 350 psRegion *region = psAlloc(sizeof(psRegion)); // The region 351 *region = psRegionFromString(regionItem->data.V); 352 psListAdd(biassecs, PS_LIST_TAIL, region); 353 psFree(region); // Drop reference 354 } 355 psFree(regionsIter); 356 break; 357 } 358 default: 347 psList *regions = concept->data.V; // The list of regions 348 psListIterator *regionsIter = psListIteratorAlloc(regions, PS_LIST_HEAD, false); // Iterator 349 psMetadataItem *regionItem = NULL; // Item from list iteration 350 while ((regionItem = psListGetAndIncrement(regionsIter))) { 351 if (regionItem->type != PS_DATA_STRING) { 352 psWarning("CELL.BIASSEC member is not of type STR --- ignored.\n"); 353 continue; 354 } 355 int xParity = 0; 356 int yParity = 0; 357 psRegion *region = psAlloc(sizeof(psRegion)); // The region 358 *region = psRegionAndParityFromString(&xParity, &yParity, regionItem->data.V); 359 psListAdd(biassecs, PS_LIST_TAIL, region); 360 psFree(region); // Drop reference 361 } 362 psFree(regionsIter); 363 break; 364 } 365 default: 359 366 psError(PS_ERR_UNKNOWN, true, "CELL.BIASSEC after read is not of type STRING or LIST --- assuming " 360 367 "blank.\n"); … … 375 382 // CELL.XBIN and CELL.YBIN 376 383 psMetadataItem *p_pmConceptParse_CELL_Binning(const psMetadataItem *concept, 377 const psMetadataItem *pattern,378 pmConceptSource source,379 const psMetadata *cameraFormat,380 const pmFPA *fpa,381 const pmChip *chip,382 const pmCell *cell)384 const psMetadataItem *pattern, 385 pmConceptSource source, 386 const psMetadata *cameraFormat, 387 const pmFPA *fpa, 388 const pmChip *chip, 389 const pmCell *cell) 383 390 { 384 391 assert(concept); … … 387 394 int binning = 1; // Binning factor in x 388 395 switch (concept->type) { 389 case PS_DATA_STRING: {390 psString binString = concept->data.V; // The string containing the binning391 if ((strcmp(pattern->name, "CELL.XBIN") == 0 && sscanf(binString, "%d %*d", &binning) != 1 &&392 sscanf(binString, "%d,%*d", &binning) != 1) ||393 (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 &&394 sscanf(binString, "%*d,%d", &binning) != 1)) {395 psError(PS_ERR_UNKNOWN, true, "Unable to parse string to get %s: %s\n", pattern->name, binString);396 }397 break;398 }396 case PS_DATA_STRING: { 397 psString binString = concept->data.V; // The string containing the binning 398 if ((strcmp(pattern->name, "CELL.XBIN") == 0 && sscanf(binString, "%d %*d", &binning) != 1 && 399 sscanf(binString, "%d,%*d", &binning) != 1) || 400 (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 && 401 sscanf(binString, "%*d,%d", &binning) != 1)) { 402 psError(PS_ERR_UNKNOWN, true, "Unable to parse string to get %s: %s\n", pattern->name, binString); 403 } 404 break; 405 } 399 406 TYPE_CASE(binning, concept, U8); 400 407 TYPE_CASE(binning, concept, U16); … … 403 410 TYPE_CASE(binning, concept, S16); 404 411 TYPE_CASE(binning, concept, S32); 405 default:412 default: 406 413 psError(PS_ERR_UNKNOWN, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name, 407 414 concept->type); … … 413 420 414 421 psMetadataItem *p_pmConceptParse_TIMESYS(const psMetadataItem *concept, 415 const psMetadataItem *pattern,416 pmConceptSource source,417 const psMetadata *cameraFormat,418 const pmFPA *fpa,419 const pmChip *chip,420 const pmCell *cell)422 const psMetadataItem *pattern, 423 pmConceptSource source, 424 const psMetadata *cameraFormat, 425 const pmFPA *fpa, 426 const pmChip *chip, 427 const pmCell *cell) 421 428 { 422 429 assert(concept); … … 444 451 psMetadataItem *p_pmConceptParse_TIME(const psMetadataItem *concept, 445 452 const psMetadataItem *pattern, 446 pmConceptSource source,453 pmConceptSource source, 447 454 const psMetadata *cameraFormat, 448 455 const pmFPA *fpa, … … 469 476 if (!mdok || (timeSys == 0xffffffff)) { 470 477 psWarning("Unable to find %s in concepts when parsing %s --- assuming UTC.\n", 471 timesysName, pattern->name);478 timesysName, pattern->name); 472 479 timeSys = PS_TIME_UTC; 473 480 } … … 548 555 psTime *time = NULL; // The time 549 556 switch (concept->type) { 550 case PS_DATA_LIST: {551 if (!separateTime) {552 psWarning ("DATE and TIME stored separately, but not specified in format\n");553 }554 // The date and time are stored separately555 // Assume the date is first and the time second556 psList *dateTime = concept->data.V; // The list containing items for date and time557 if (psListLength(dateTime) != 2) {558 psError(PS_ERR_BAD_PARAMETER_SIZE, false,559 "Unable to parse %s: date and time are not both available.", pattern->name);560 return NULL;561 }562 psMetadataItem *dateItem = psListGet(dateTime, PS_LIST_HEAD); // Item containing the date563 if (!dateItem) {564 psError(PS_ERR_UNKNOWN, true, "Date is not found.\n");565 return NULL;566 }567 if (dateItem->type != PS_DATA_STRING) {568 psError(PS_ERR_UNKNOWN, true, "Date is not of type STR.\n");569 return NULL;570 }571 psString dateString = dateItem->data.V; // The string with the date572 int day = 0, month = 0, year = 0;573 if (sscanf(dateString, "%d-%d-%d", &year, &month, &day) != 3 &&574 sscanf(dateString, "%d/%d/%d", &year, &month, &day) != 3) {575 psError(PS_ERR_UNKNOWN, true, "Unable to read date: %s\n", dateString);576 return NULL;577 }578 if (backwardsTime) {579 // Need to switch days and years580 int temp = day;581 day = year;582 year = temp;583 }584 if (usaTime) {585 // Need to switch everything around.... Yanks!586 int temp = day;587 day = month;588 month = year;589 year = temp;590 }591 if (year < 100) {592 if (pre2000Time) {593 year += 1900;594 } else {595 year += 2000;596 }597 }598 sprintf(dateString,"%04d-%02d-%02d", year, month, day);599 600 psMetadataItem *timeItem = psListGet(dateTime, PS_LIST_HEAD + 1); // Item containing the time601 if (!timeItem) {602 psError(PS_ERR_UNKNOWN, true, "Time is not found.\n");603 return NULL;604 }605 psString timeString = NULL; // The string with the time606 if (timeItem->type == PS_DATA_STRING) {607 timeString = timeItem->data.V;608 } else {609 // Assume that time is specified in Second of Day (!)610 double seconds = NAN;611 switch (timeItem->type) {612 TYPE_CASE(seconds, timeItem, U8);613 TYPE_CASE(seconds, timeItem, U16);614 TYPE_CASE(seconds, timeItem, U32);615 TYPE_CASE(seconds, timeItem, S8);616 TYPE_CASE(seconds, timeItem, S16);617 TYPE_CASE(seconds, timeItem, S32);618 TYPE_CASE(seconds, timeItem, F32);619 TYPE_CASE(seconds, timeItem, F64);557 case PS_DATA_LIST: { 558 if (!separateTime) { 559 psWarning ("DATE and TIME stored separately, but not specified in format\n"); 560 } 561 // The date and time are stored separately 562 // Assume the date is first and the time second 563 psList *dateTime = concept->data.V; // The list containing items for date and time 564 if (psListLength(dateTime) != 2) { 565 psError(PS_ERR_BAD_PARAMETER_SIZE, false, 566 "Unable to parse %s: date and time are not both available.", pattern->name); 567 return NULL; 568 } 569 psMetadataItem *dateItem = psListGet(dateTime, PS_LIST_HEAD); // Item containing the date 570 if (!dateItem) { 571 psError(PS_ERR_UNKNOWN, true, "Date is not found.\n"); 572 return NULL; 573 } 574 if (dateItem->type != PS_DATA_STRING) { 575 psError(PS_ERR_UNKNOWN, true, "Date is not of type STR.\n"); 576 return NULL; 577 } 578 psString dateString = dateItem->data.V; // The string with the date 579 int day = 0, month = 0, year = 0; 580 if (sscanf(dateString, "%d-%d-%d", &year, &month, &day) != 3 && 581 sscanf(dateString, "%d/%d/%d", &year, &month, &day) != 3) { 582 psError(PS_ERR_UNKNOWN, true, "Unable to read date: %s\n", dateString); 583 return NULL; 584 } 585 if (backwardsTime) { 586 // Need to switch days and years 587 int temp = day; 588 day = year; 589 year = temp; 590 } 591 if (usaTime) { 592 // Need to switch everything around.... Yanks! 593 int temp = day; 594 day = month; 595 month = year; 596 year = temp; 597 } 598 if (year < 100) { 599 if (pre2000Time) { 600 year += 1900; 601 } else { 602 year += 2000; 603 } 604 } 605 sprintf(dateString,"%04d-%02d-%02d", year, month, day); 606 607 psMetadataItem *timeItem = psListGet(dateTime, PS_LIST_HEAD + 1); // Item containing the time 608 if (!timeItem) { 609 psError(PS_ERR_UNKNOWN, true, "Time is not found.\n"); 610 return NULL; 611 } 612 psString timeString = NULL; // The string with the time 613 if (timeItem->type == PS_DATA_STRING) { 614 timeString = timeItem->data.V; 615 } else { 616 // Assume that time is specified in Second of Day (!) 617 double seconds = NAN; 618 switch (timeItem->type) { 619 TYPE_CASE(seconds, timeItem, U8); 620 TYPE_CASE(seconds, timeItem, U16); 621 TYPE_CASE(seconds, timeItem, U32); 622 TYPE_CASE(seconds, timeItem, S8); 623 TYPE_CASE(seconds, timeItem, S16); 624 TYPE_CASE(seconds, timeItem, S32); 625 TYPE_CASE(seconds, timeItem, F32); 626 TYPE_CASE(seconds, timeItem, F64); 620 627 default: 621 psError(PS_ERR_UNKNOWN, true, "Time is not of an expected type: %x\n", timeItem->type);622 return NULL;623 }624 // Now print to timeString as "hh:mm:ss.ss"625 int hours = seconds / 3600;626 seconds -= (double)hours * 3600.0;627 int minutes = seconds / 60;628 seconds -= (double)minutes * 60.0;629 psStringAppend(&timeString, "%02d:%02d:%02f", hours, minutes, seconds);630 }631 psString dateTimeString = NULL;632 psStringAppend(&dateTimeString, "%sT%s", dateString, timeString);633 time = psTimeFromISO(dateTimeString, timeSys);634 psFree(dateTimeString);635 break;636 }637 case PS_DATA_STRING: {638 psString timeString = concept->data.V; // String with the time639 if (jdTime) {640 double timeValue = strtod (timeString, NULL);641 time = psTimeFromJD(timeValue);642 } else if (mjdTime) {643 double timeValue = strtod (timeString, NULL);644 time = psTimeFromMJD(timeValue);645 } else {646 // It's ISO647 time = psTimeFromISO(timeString, timeSys);648 } // Interpreting the time string649 break;650 }651 case PS_TYPE_F32: {652 double timeValue = (double)concept->data.F32;653 if (jdTime) {654 time = psTimeFromJD(timeValue);655 } else if (mjdTime) {656 time = psTimeFromMJD(timeValue);657 } else {658 psError(PS_ERR_UNKNOWN, true, "Not sure how to parse %s (%f) --- trying JD\n",659 pattern->name, timeValue);660 time = psTimeFromJD(timeValue);661 }662 break;663 }664 case PS_TYPE_F64: {665 double timeValue = (double)concept->data.F64;666 if (jdTime) {667 time = psTimeFromJD(timeValue);668 } else if (mjdTime) {669 time = psTimeFromMJD(timeValue);670 } else {671 psError(PS_ERR_UNKNOWN, true, "Not sure how to parse %s (%f) --- trying JD\n",672 pattern->name, timeValue);673 time = psTimeFromJD(timeValue);674 }675 break;676 }677 default:628 psError(PS_ERR_UNKNOWN, true, "Time is not of an expected type: %x\n", timeItem->type); 629 return NULL; 630 } 631 // Now print to timeString as "hh:mm:ss.ss" 632 int hours = seconds / 3600; 633 seconds -= (double)hours * 3600.0; 634 int minutes = seconds / 60; 635 seconds -= (double)minutes * 60.0; 636 psStringAppend(&timeString, "%02d:%02d:%02f", hours, minutes, seconds); 637 } 638 psString dateTimeString = NULL; 639 psStringAppend(&dateTimeString, "%sT%s", dateString, timeString); 640 time = psTimeFromISO(dateTimeString, timeSys); 641 psFree(dateTimeString); 642 break; 643 } 644 case PS_DATA_STRING: { 645 psString timeString = concept->data.V; // String with the time 646 if (jdTime) { 647 double timeValue = strtod (timeString, NULL); 648 time = psTimeFromJD(timeValue); 649 } else if (mjdTime) { 650 double timeValue = strtod (timeString, NULL); 651 time = psTimeFromMJD(timeValue); 652 } else { 653 // It's ISO 654 time = psTimeFromISO(timeString, timeSys); 655 } // Interpreting the time string 656 break; 657 } 658 case PS_TYPE_F32: { 659 double timeValue = (double)concept->data.F32; 660 if (jdTime) { 661 time = psTimeFromJD(timeValue); 662 } else if (mjdTime) { 663 time = psTimeFromMJD(timeValue); 664 } else { 665 psError(PS_ERR_UNKNOWN, true, "Not sure how to parse %s (%f) --- trying JD\n", 666 pattern->name, timeValue); 667 time = psTimeFromJD(timeValue); 668 } 669 break; 670 } 671 case PS_TYPE_F64: { 672 double timeValue = (double)concept->data.F64; 673 if (jdTime) { 674 time = psTimeFromJD(timeValue); 675 } else if (mjdTime) { 676 time = psTimeFromMJD(timeValue); 677 } else { 678 psError(PS_ERR_UNKNOWN, true, "Not sure how to parse %s (%f) --- trying JD\n", 679 pattern->name, timeValue); 680 time = psTimeFromJD(timeValue); 681 } 682 break; 683 } 684 default: 678 685 psError(PS_ERR_UNKNOWN, true, "Unable to parse %s.\n", pattern->name); 679 686 return NULL; … … 688 695 static int fortranCorr(const psMetadata *cameraFormat, // The camera format description 689 696 const char *name // Name of concept to check for FORTRAN indexing 690 )697 ) 691 698 { 692 699 bool mdok = false; // Result of MD lookup … … 702 709 703 710 psMetadataItem *p_pmConceptParse_Positions(const psMetadataItem *concept, 704 const psMetadataItem *pattern,705 pmConceptSource source,706 const psMetadata *cameraFormat,707 const pmFPA *fpa,708 const pmChip *chip,709 const pmCell *cell)711 const psMetadataItem *pattern, 712 pmConceptSource source, 713 const psMetadata *cameraFormat, 714 const pmFPA *fpa, 715 const pmChip *chip, 716 const pmCell *cell) 710 717 { 711 718 assert(concept); … … 721 728 TYPE_CASE(offset, concept, S16); 722 729 TYPE_CASE(offset, concept, S32); 723 #if 0 724 725 case PS_DATA_STRING: { 726 // Interpret as a region specifier [x0:x1,y0:y1] 727 psRegion region = psRegionFromString(concept->data.V); 728 if (strstr(pattern->name, ".X0")) { 729 offset = region.x0; 730 } else if (strstr(pattern->name, ".Y0")) { 731 offset = region.y0; 732 } else if (strstr(pattern->name, ".X1")) { 733 offset = region.x1; 734 } else if (strstr(pattern->name, ".Y1")) { 735 offset = region.y1; 736 } else { 737 psError(PS_ERR_UNKNOWN, true, 738 "Unable to interpret %s because unable to determine if concept is X or Y.\n", 739 pattern->name); 740 return NULL; 741 } 742 break; 743 } 744 #endif 745 default: 730 #if 0 731 732 case PS_DATA_STRING: { 733 // Interpret as a region specifier [x0:x1,y0:y1] 734 int xParity = 0; 735 int yParity = 0; 736 psRegion region = psRegionAndParityFromString(&xParity, &yParity, concept->data.V); 737 if (strstr(pattern->name, ".X0")) { 738 offset = region.x0; 739 } else if (strstr(pattern->name, ".Y0")) { 740 offset = region.y0; 741 } else if (strstr(pattern->name, ".X1")) { 742 offset = region.x1; 743 } else if (strstr(pattern->name, ".Y1")) { 744 offset = region.y1; 745 } else { 746 psError(PS_ERR_UNKNOWN, true, 747 "Unable to interpret %s because unable to determine if concept is X or Y.\n", 748 pattern->name); 749 return NULL; 750 } 751 break; 752 } 753 #endif 754 default: 746 755 if (concept->type == PS_TYPE_F32 && concept->data.F32 - (int)concept->data.F32 == 0) { 747 756 offset = concept->data.F32; … … 759 768 760 769 psMetadataItem *p_pmConceptFormat_CELL_TRIMSEC(const psMetadataItem *concept, 761 pmConceptSource source,762 const psMetadata *cameraFormat,763 const pmFPA *fpa,764 const pmChip *chip,765 const pmCell *cell)770 pmConceptSource source, 771 const psMetadata *cameraFormat, 772 const pmFPA *fpa, 773 const pmChip *chip, 774 const pmCell *cell) 766 775 { 767 776 assert(concept); … … 788 797 psFree(trimsec); 789 798 psMetadataItem *formatted = psMetadataItemAllocStr(concept->name, concept->comment, 790 trimsecString);799 trimsecString); 791 800 psFree(trimsecString); 792 801 return formatted; … … 794 803 795 804 psMetadataItem *p_pmConceptFormat_CELL_BIASSEC(const psMetadataItem *concept, 796 pmConceptSource source,797 const psMetadata *cameraFormat,798 const pmFPA *fpa,799 const pmChip *chip,800 const pmCell *cell)805 pmConceptSource source, 806 const psMetadata *cameraFormat, 807 const pmFPA *fpa, 808 const pmChip *chip, 809 const pmCell *cell) 801 810 { 802 811 // Return a metadata item containing a list of metadata items of region strings … … 840 849 psMetadataItem *p_pmConceptFormat_CELL_XBIN(const psMetadataItem *concept, 841 850 pmConceptSource source, 842 const psMetadata *cameraFormat,843 const pmFPA *fpa,844 const pmChip *chip,845 const pmCell *cell)851 const psMetadata *cameraFormat, 852 const pmFPA *fpa, 853 const pmChip *chip, 854 const pmCell *cell) 846 855 { 847 856 assert(concept); … … 852 861 psString yKeyword = psMetadataLookupStr(&yBinOK, translation, "CELL.YBIN"); 853 862 if (xBinOK && yBinOK && strlen(xKeyword) > 0 && strlen(yKeyword) > 0 && 854 strcasecmp(xKeyword, yKeyword) == 0) {863 strcasecmp(xKeyword, yKeyword) == 0) { 855 864 psMetadataItem *yBinItem = psMetadataLookup(cell->concepts, "CELL.YBIN"); // Binning factor in y 856 865 psString binString = NULL; … … 868 877 psMetadataItem *p_pmConceptFormat_CELL_YBIN(const psMetadataItem *concept, 869 878 pmConceptSource source, 870 const psMetadata *cameraFormat,871 const pmFPA *fpa,872 const pmChip *chip,873 const pmCell *cell)879 const psMetadata *cameraFormat, 880 const pmFPA *fpa, 881 const pmChip *chip, 882 const pmCell *cell) 874 883 { 875 884 assert(concept); … … 880 889 psString yKeyword = psMetadataLookupStr(&yBinOK, translation, "CELL.YBIN"); 881 890 if (xBinOK && yBinOK && strlen(xKeyword) > 0 && strlen(yKeyword) > 0 && 882 strcasecmp(xKeyword, yKeyword) == 0) {891 strcasecmp(xKeyword, yKeyword) == 0) { 883 892 // Censor this --- it's already done (though no harm if it's done twice 884 893 return NULL; … … 891 900 892 901 psMetadataItem *p_pmConceptFormat_TIMESYS(const psMetadataItem *concept, 893 pmConceptSource source,894 const psMetadata *cameraFormat,895 const pmFPA *fpa,896 const pmChip *chip,897 const pmCell *cell)902 pmConceptSource source, 903 const psMetadata *cameraFormat, 904 const pmFPA *fpa, 905 const pmChip *chip, 906 const pmCell *cell) 898 907 { 899 908 psString sys = NULL; // String to store 900 909 switch (concept->data.S32) { 901 case PS_TIME_TAI:910 case PS_TIME_TAI: 902 911 sys = psStringCopy("TAI"); 903 912 break; 904 case PS_TIME_UTC:913 case PS_TIME_UTC: 905 914 sys = psStringCopy("UTC"); 906 915 break; 907 case PS_TIME_UT1:916 case PS_TIME_UT1: 908 917 sys = psStringCopy("UT1"); 909 918 break; 910 case PS_TIME_TT:919 case PS_TIME_TT: 911 920 sys = psStringCopy("TT"); 912 921 break; 913 default:922 default: 914 923 sys = psStringCopy("Unknown"); 915 924 } … … 921 930 922 931 psMetadataItem *p_pmConceptFormat_TIME(const psMetadataItem *concept, 923 pmConceptSource source,932 pmConceptSource source, 924 933 const psMetadata *cameraFormat, 925 934 const pmFPA *fpa, … … 980 989 } else { 981 990 psWarning("Unrecognised FORMATS option for %s: %s --- " 982 "ignored.\n", concept->name, format);991 "ignored.\n", concept->name, format); 983 992 } 984 993 } … … 1021 1030 1022 1031 psMetadataItem *dateItem = psMetadataItemAllocStr(concept->name, "The date of observation", 1023 dateString);1032 dateString); 1024 1033 psMetadataItem *timeItem = psMetadataItemAllocStr(concept->name, "The time of observation", 1025 timeString);1034 timeString); 1026 1035 1027 1036 psListRemove(dateTime, PS_LIST_HEAD); … … 1032 1041 1033 1042 psMetadataItem *item = psMetadataItemAllocPtr(concept->name, PS_DATA_LIST, concept->comment, 1034 dateTime);1043 dateTime); 1035 1044 psFree (dateItem); 1036 1045 psFree (timeItem); … … 1057 1066 psMetadataItem *p_pmConceptFormat_Positions(const psMetadataItem *concept, 1058 1067 pmConceptSource source, 1059 const psMetadata *cameraFormat,1060 const pmFPA *fpa,1061 const pmChip *chip,1062 const pmCell *cell)1068 const psMetadata *cameraFormat, 1069 const pmFPA *fpa, 1070 const pmChip *chip, 1071 const pmCell *cell) 1063 1072 { 1064 1073 assert(concept); … … 1070 1079 } 1071 1080 1072 #if 01081 #if 0 1073 1082 // If both the X0 and Y0 positions are specified by the same header keyword, write both together, as part 1074 1083 // of the call for the X0 position. … … 1090 1099 psString yKeyword = psMetadataLookupStr(&yFound, translation, companion); 1091 1100 if (xFound && yFound && strlen(xKeyword) > 0 && strlen(yKeyword) > 0 && 1092 strcasecmp(xKeyword, yKeyword) == 0) {1101 strcasecmp(xKeyword, yKeyword) == 0) { 1093 1102 psMetadataItem *yItem = psMetadataLookup(cell->concepts, companion); // Corresponding y value 1094 1103 … … 1115 1124 psFree(companion); 1116 1125 if (xFound && yFound && strlen(xKeyword) > 0 && strlen(yKeyword) > 0 && 1117 strcasecmp(xKeyword, yKeyword) == 0) {1126 strcasecmp(xKeyword, yKeyword) == 0) { 1118 1127 return NULL; // We did it with the X; don't do anything. 1119 1128 } 1120 1129 } 1121 #endif1130 #endif 1122 1131 1123 1132 int offset = concept->data.S32;
Note:
See TracChangeset
for help on using the changeset viewer.
