Changeset 2783 for trunk/external-alma
- Timestamp:
- 03/07/13 19:56:52 (12 years ago)
- Location:
- trunk/external-alma/atnf/PKSIO
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/external-alma/atnf/PKSIO/ASTEDataset.cc
r2782 r2783 53 53 54 54 // it must be called 55 NRODataset::initialize() ;55 initializeCommon() ; 56 56 57 57 // additional initialization … … 79 79 int arymax = arrayMax(); 80 80 81 string str4( 4, ' ' ) ;82 string str8( 8, ' ' ) ;83 string str16( 16, ' ' ) ;84 string str18( 18, ' ' ) ;85 string str24( 24, ' ' ) ;86 string str40( 40, ' ' ) ;87 81 string str120( 120, ' ' ) ; 88 char c4[4] ;89 char c8[8] ;90 char c16[16] ;91 char c18[18] ;92 char c24[24] ;93 char c40[40] ;94 82 char c120[120] ; 95 83 // make sure file pointer points a beginning of the file 96 84 fseek( fp_, 0, SEEK_SET ) ; 97 85 98 // read data header 99 strcpy( c8, str8.c_str() ) ; 100 if ( readHeader( c8, 8 ) == -1 ) { 101 os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ; 102 return -1 ; 103 } 104 LOFIL = string( c8 ) ; 105 // DEBUG 106 //cout << "LOFIL = " << LOFIL << endl ; 107 // 108 strcpy( c8, str8.c_str() ) ; 109 if ( readHeader( c8, 8 ) == -1 ) { 110 os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ; 111 return -1 ; 112 } 113 VER = string( c8 ) ; 114 // DEBUG 115 //cout << "VER = " << VER << endl ; 116 // 117 strcpy( c16, str16.c_str() ) ; 118 if ( readHeader( c16, 16 ) == -1 ) { 119 os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ; 120 return -1 ; 121 } 122 GROUP = string( c16 ) ; 123 // DEBUG 124 //cout << "GROUP = " << GROUP << endl ; 125 // 126 strcpy( c16, str16.c_str() ) ; 127 if ( readHeader( c16, 16 ) == -1 ) { 128 os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ; 129 return -1 ; 130 } 131 PROJ = string( c16 ) ; 132 // DEBUG 133 //cout << "PROJ = " << PROJ << endl ; 134 // 135 strcpy( c24, str24.c_str() ) ; 136 if ( readHeader( c24, 24 ) == -1 ) { 137 os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ; 138 return -1 ; 139 } 140 SCHED = string( c24 ) ; 141 // DEBUG 142 //cout << "SCHED = " << SCHED << endl ; 143 // 144 strcpy( c40, str40.c_str() ) ; 145 if ( readHeader( c40, 40 ) == -1 ) { 146 os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ; 147 return -1 ; 148 } 149 OBSVR = string( c40 ) ; 150 // DEBUG 151 //cout << "OBSVR = " << OBSVR << endl ; 152 // 153 strcpy( c16, str16.c_str() ) ; 154 if ( readHeader( c16, 16 ) == -1 ) { 155 os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ; 156 return -1 ; 157 } 158 LOSTM = string( c16 ) ; 159 // DEBUG 160 //cout << "LOSTM = " << LOSTM << endl ; 161 // 162 strcpy( c16, str16.c_str() ) ; 163 if ( readHeader( c16, 16 ) == -1 ) { 164 os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ; 165 return -1 ; 166 } 167 LOETM = string( c16 ) ; 168 // DEBUG 169 //cout << "LOETM = " << LOETM << endl ; 170 // 171 if ( readHeader( ARYNM, sameEndian ) == -1 ) { 172 os << LogIO::WARN << "Error while reading data ARYNM." << LogIO::POST ; 173 return -1 ; 174 } 175 // DEBUG 176 //cout << "ARYNM = " << ARYNM << endl ; 177 // 178 if ( readHeader( NSCAN, sameEndian ) == -1 ) { 179 os << LogIO::WARN << "Error while reading data NSCAN." << LogIO::POST ; 180 return -1 ; 181 } 182 // DEBUG 183 //cout << "NSCAN = " << NSCAN << endl ; 184 // 185 strcpy( c120, str120.c_str() ) ; 186 if ( readHeader( c120, 120 ) == -1 ) { 187 os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ; 188 return -1 ; 189 } 190 TITLE = string( c120 ) ; 191 // DEBUG 192 //cout << "TITLE = " << TITLE << endl ; 193 // 194 strcpy( c16, str16.c_str() ) ; 195 if ( readHeader( c16, 16 ) == -1 ) { 196 os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ; 197 return -1 ; 198 } 199 OBJ = string( c16 ) ; 200 // DEBUG 201 //cout << "OBJ = " << OBJ << endl ; 202 // 203 strcpy( c8, str8.c_str() ) ; 204 if ( readHeader( c8, 8 ) == -1 ) { 205 os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ; 206 return -1 ; 207 } 208 EPOCH = string( c8 ) ; 209 // DEBUG 210 //cout << "EPOCH = " << EPOCH << endl ; 211 // 212 if ( readHeader( RA0, sameEndian ) == -1 ) { 213 os << LogIO::WARN << "Error while reading data RA0." << LogIO::POST ; 214 return -1 ; 215 } 216 // DEBUG 217 //cout << "RA0 = " << RA0 << endl ; 218 // 219 if ( readHeader( DEC0, sameEndian ) == -1 ) { 220 os << LogIO::WARN << "Error while reading data DEC0." << LogIO::POST ; 221 return -1 ; 222 } 223 // DEBUG 224 //cout << "DEC0 = " << DEC0 << endl ; 225 // 226 if ( readHeader( GLNG0, sameEndian ) == -1 ) { 227 os << LogIO::WARN << "Error while reading data GLNG0." << LogIO::POST ; 228 return -1 ; 229 } 230 // DEBUG 231 //cout << "GLNG0 = " << GLNG0 << endl ; 232 // 233 if ( readHeader( GLAT0, sameEndian ) == -1 ) { 234 os << LogIO::WARN << "Error while reading data GLAT0." << LogIO::POST ; 235 return -1 ; 236 } 237 // DEBUG 238 //cout << "GLAT0 = " << GLAT0 << endl ; 239 // 240 if ( readHeader( NCALB, sameEndian ) == -1 ) { 241 os << LogIO::WARN << "Error while reading data NCALB." << LogIO::POST ; 242 return -1 ; 243 } 244 // DEBUG 245 //cout << "NCALB = " << NCALB << endl ; 246 // 247 if ( readHeader( SCNCD, sameEndian ) == -1 ) { 248 os << LogIO::WARN << "Error while reading data SCNCD." << LogIO::POST ; 249 return -1 ; 250 } 251 // DEBUG 252 //cout << "SCNCD = " << SCNCD << endl ; 253 // 254 strcpy( c120, str120.c_str() ) ; 255 if ( readHeader( c120, 120 ) == -1 ) { 256 os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ; 257 return -1 ; 258 } 259 SCMOD = string( c120 ) ; 260 // DEBUG 261 //cout << "SCMOD = " << SCMOD << endl ; 262 // 263 if ( readHeader( URVEL, sameEndian ) == -1 ) { 264 os << LogIO::WARN << "Error while reading data URVEL." << LogIO::POST ; 265 return -1 ; 266 } 267 // DEBUG 268 //cout << "URVEL = " << URVEL << endl ; 269 // 270 strcpy( c4, str4.c_str() ) ; 271 if ( readHeader( c4, 4 ) == -1 ) { 272 os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ; 273 return -1 ; 274 } 275 VREF = string( c4 ) ; 276 // DEBUG 277 //cout << "VREF = " << VREF << endl ; 278 // 279 strcpy( c4, str4.c_str() ) ; 280 if ( readHeader( c4, 4 ) == -1 ) { 281 os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ; 282 return -1 ; 283 } 284 VDEF = string( c4 ) ; 285 // DEBUG 286 //cout << "VDEF = " << VDEF << endl ; 287 // 288 strcpy( c8, str8.c_str() ) ; 289 if ( readHeader( c8, 8 ) == -1 ) { 290 os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ; 291 return -1 ; 292 } 293 SWMOD = string( c8 ) + "::OTF" ; 294 // DEBUG 295 //cout << "SWMOD = " << SWMOD << endl ; 296 // 297 if ( readHeader( FRQSW, sameEndian ) == -1 ) { 298 os << LogIO::WARN << "Error while reading data FRQSW." << LogIO::POST ; 299 return -1 ; 300 } 301 // DEBUG 302 //cout << "FRQSW = " << FRQSW << endl ; 303 // 304 if ( readHeader( DBEAM, sameEndian ) == -1 ) { 305 os << LogIO::WARN << "Error while reading data DBEAM." << LogIO::POST ; 306 return -1 ; 307 } 308 // DEBUG 309 //cout << "DBEAM = " << DBEAM << endl ; 310 // 311 if ( readHeader( MLTOF, sameEndian ) == -1 ) { 312 os << LogIO::WARN << "Error while reading data MLTOF." << LogIO::POST ; 313 return -1 ; 314 } 315 // DEBUG 316 //cout << "MLTOF = " << MLTOF << endl ; 317 // 318 if ( readHeader( CMTQ, sameEndian ) == -1 ) { 319 os << LogIO::WARN << "Error while reading data CMTQ." << LogIO::POST ; 320 return -1 ; 321 } 322 // DEBUG 323 //cout << "CMTQ = " << CMTQ << endl ; 324 // 325 if ( readHeader( CMTE, sameEndian ) == -1 ) { 326 os << LogIO::WARN << "Error while reading data CMTE." << LogIO::POST ; 327 return -1 ; 328 } 329 // DEBUG 330 //cout << "CMTE = " << CMTE << endl ; 331 // 332 if ( readHeader( CMTSOM, sameEndian ) == -1 ) { 333 os << LogIO::WARN << "Error while reading data CMTSOM." << LogIO::POST ; 334 return -1 ; 335 } 336 // DEBUG 337 //cout << "CMTSOM = " << CMTSOM << endl ; 338 // 339 if ( readHeader( CMTNODE, sameEndian ) == -1 ) { 340 os << LogIO::WARN << "Error while reading data CMTNODE." << LogIO::POST ; 341 return -1 ; 342 } 343 // DEBUG 344 //cout << "CMTNODE = " << CMTNODE << endl ; 345 // 346 if ( readHeader( CMTI, sameEndian ) == -1 ) { 347 os << LogIO::WARN << "Error while reading data CMTI." << LogIO::POST ; 348 return -1 ; 349 } 350 // DEBUG 351 //cout << "CMTI = " << CMTI << endl ; 352 // 353 strcpy( c24, str24.c_str() ) ; 354 if ( readHeader( c24, 24 ) == -1 ) { 355 os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ; 356 return -1 ; 357 } 358 CMTTM = string( c24 ) ; 359 // DEBUG 360 //cout << "CMTTM = " << CMTTM << endl ; 361 // 362 if ( readHeader( SBDX, sameEndian ) == -1 ) { 363 os << LogIO::WARN << "Error while reading data SBDX." << LogIO::POST ; 364 return -1 ; 365 } 366 // DEBUG 367 //cout << "SBDX = " << SBDX << endl ; 368 // 369 if ( readHeader( SBDY, sameEndian ) == -1 ) { 370 os << LogIO::WARN << "Error while reading data SBDY." << LogIO::POST ; 371 return -1 ; 372 } 373 // DEBUG 374 //cout << "SBDY = " << SBDY << endl ; 375 // 376 if ( readHeader( SBDZ1, sameEndian ) == -1 ) { 377 os << LogIO::WARN << "Error while reading data SBDZ1." << LogIO::POST ; 378 return -1 ; 379 } 380 // DEBUG 381 //cout << "SBDZ1 = " << SBDZ1 << endl ; 382 // 383 if ( readHeader( SBDZ2, sameEndian ) == -1 ) { 384 os << LogIO::WARN << "Error while reading data SBDZ2." << LogIO::POST ; 385 return -1 ; 386 } 387 // DEBUG 388 //cout << "SBDZ2 = " << SBDZ2 << endl ; 389 // 390 if ( readHeader( DAZP, sameEndian ) == -1 ) { 391 os << LogIO::WARN << "Error while reading data DAZP." << LogIO::POST ; 392 return -1 ; 393 } 394 // DEBUG 395 //cout << "DAZP = " << DAZP << endl ; 396 // 397 if ( readHeader( DELP, sameEndian ) == -1 ) { 398 os << LogIO::WARN << "Error while reading data DELP." << LogIO::POST ; 399 return -1 ; 400 } 401 // DEBUG 402 //cout << "DELP = " << DELP << endl ; 403 // 404 if ( readHeader( CHBIND, sameEndian ) == -1 ) { 405 os << LogIO::WARN << "Error while reading data CHBIND." << LogIO::POST ; 406 return -1 ; 407 } 408 // DEBUG 409 //cout << "CHBIND = " << CHBIND << endl ; 410 // 411 if ( readHeader( NUMCH, sameEndian ) == -1 ) { 412 os << LogIO::WARN << "Error while reading data NUMCH." << LogIO::POST ; 413 return -1 ; 414 } 415 // DEBUG 416 //cout << "NUMCH = " << NUMCH << endl ; 417 // 418 if ( readHeader( CHMIN, sameEndian ) == -1 ) { 419 os << LogIO::WARN << "Error while reading data CHMIN." << LogIO::POST ; 420 return -1 ; 421 } 422 // DEBUG 423 //cout << "CHMIN = " << CHMIN << endl ; 424 // 425 if ( readHeader( CHMAX, sameEndian ) == -1 ) { 426 os << LogIO::WARN << "Error while reading data CHMAX." << LogIO::POST ; 427 return -1 ; 428 } 429 // DEBUG 430 //cout << "CHMAX = " << CHMAX << endl ; 431 // 432 if ( readHeader( ALCTM, sameEndian ) == -1 ) { 433 os << LogIO::WARN << "Error while reading data ALCTM." << LogIO::POST ; 434 return -1 ; 435 } 436 // DEBUG 437 //cout << "ALCTM = " << ALCTM << endl ; 438 // 439 if ( readHeader( IPTIM, sameEndian ) == -1 ) { 440 os << LogIO::WARN << "Error while reading data IPTIM." << LogIO::POST ; 441 return -1 ; 442 } 443 // DEBUG 444 //cout << "IPTIM = " << IPTIM << endl ; 445 // 446 if ( readHeader( PA, sameEndian ) == -1 ) { 447 os << LogIO::WARN << "Error while reading data PA." << LogIO::POST ; 448 return -1 ; 449 } 450 // DEBUG 451 //cout << "PA = " << PA << endl ; 452 // 453 for ( int i = 0 ; i < arymax ; i++ ) { 454 strcpy( c18, str18.c_str() ) ; 455 if ( readHeader( c18, 16 ) == -1 ) { 456 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ; 457 return -1 ; 458 } 459 c18[16] = '\0' ; 460 RX[i] = string( c18 ) ; 461 } 462 // DEBUG 463 // nro_debug_output( "RX", arymax, RX ) ; 464 // 465 for ( int i = 0 ; i < arymax ; i++ ) { 466 if ( readHeader( HPBW[i], sameEndian ) == -1 ) { 467 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ; 468 return -1 ; 469 } 470 } 471 // DEBUG 472 // nro_debug_output( "HPBW", arymax, HPBW ) ; 473 // 474 for ( int i = 0 ; i < arymax ; i++ ) { 475 if ( readHeader( EFFA[i], sameEndian ) == -1 ) { 476 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ; 477 return -1 ; 478 } 479 } 480 // DEBUG 481 // nro_debug_output( "EFFA", arymax, EFFA ) ; 482 // 483 for ( int i = 0 ; i < arymax ; i++ ) { 484 if ( readHeader( EFFB[i], sameEndian ) == -1 ) { 485 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ; 486 return -1 ; 487 } 488 } 489 // DEBUG 490 // nro_debug_output( "EFFB", arymax, EFFB ) ; 491 // 492 for ( int i = 0 ; i < arymax ; i++ ) { 493 if ( readHeader( EFFL[i], sameEndian ) == -1 ) { 494 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ; 495 return -1 ; 496 } 497 } 498 // DEBUG 499 // nro_debug_output( "EFFL", arymax, EFFL ) ; 500 // 501 for ( int i = 0 ; i < arymax ; i++ ) { 502 if ( readHeader( EFSS[i], sameEndian ) == -1 ) { 503 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ; 504 return -1 ; 505 } 506 } 507 // DEBUG 508 // nro_debug_output( "EFSS", arymax, EFSS ) ; 509 // 510 for ( int i= 0 ; i < arymax ; i++) { 511 if ( readHeader( GAIN[i], sameEndian ) == -1 ) { 512 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ; 513 return -1 ; 514 } 515 } 516 // DEBUG 517 // nro_debug_output( "GAIN", arymax, GAIN ) ; 518 // 519 for ( int i= 0 ; i < arymax ; i++) { 520 strcpy( c4, str4.c_str() ) ; 521 if ( readHeader( c4, 4 ) == -1 ) { 522 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ; 523 return -1 ; 524 } 525 HORN[i] = string( c4 ) ; 526 } 527 // DEBUG 528 // nro_debug_output( "HORN", arymax, HORN ) ; 529 // 530 for ( int i= 0 ; i < arymax ; i++) { 531 strcpy( c4, str4.c_str() ) ; 532 if ( readHeader( c4, 4 ) == -1 ) { 533 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ; 534 return -1 ; 535 } 536 POLTP[i] = string( c4 ) ; 537 } 538 // DEBUG 539 // nro_debug_output( "POLTP", arymax, POLTP ) ; 540 // 541 for ( int i= 0 ; i < arymax ; i++) { 542 if ( readHeader( POLDR[i], sameEndian ) == -1 ) { 543 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ; 544 return -1 ; 545 } 546 } 547 // DEBUG 548 // nro_debug_output( "POLDR", arymax, POLDR ) ; 549 // 550 for ( int i= 0 ; i < arymax ; i++) { 551 if ( readHeader( POLAN[i], sameEndian ) == -1 ) { 552 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ; 553 return -1 ; 554 } 555 } 556 // DEBUG 557 // nro_debug_output( "POLAN", arymax, POLAN ) ; 558 // 559 for ( int i= 0 ; i < arymax ; i++) { 560 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) { 561 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ; 562 return -1 ; 563 } 564 } 565 // DEBUG 566 // nro_debug_output( "DFRQ", arymax, DFRQ ) ; 567 // 568 for ( int i= 0 ; i < arymax ; i++) { 569 strcpy( c4, str4.c_str() ) ; 570 if ( readHeader( c4, 4 ) == -1 ) { 571 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ; 572 return -1 ; 573 } 574 SIDBD[i] = string( c4 ) ; 575 } 576 // DEBUG 577 // nro_debug_output( "SIDBD", arymax, SIDBD ) ; 578 // 579 for ( int i= 0 ; i < arymax ; i++) { 580 if ( readHeader( REFN[i], sameEndian ) == -1 ) { 581 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ; 582 return -1 ; 583 } 584 } 585 // DEBUG 586 // nro_debug_output( "REFN", arymax, REFN ) ; 587 // 588 for ( int i= 0 ; i < arymax ; i++) { 589 if ( readHeader( IPINT[i], sameEndian ) == -1 ) { 590 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ; 591 return -1 ; 592 } 593 } 594 // DEBUG 595 // nro_debug_output( "IPINT", arymax, IPINT ) ; 596 // 597 for ( int i= 0 ; i < arymax ; i++) { 598 if ( readHeader( MULTN[i], sameEndian ) == -1 ) { 599 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ; 600 return -1 ; 601 } 602 } 603 // DEBUG 604 // nro_debug_output( "MULTN", arymax, MULTN ) ; 605 // 606 for ( int i= 0 ; i < arymax ; i++) { 607 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) { 608 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ; 609 return -1 ; 610 } 611 } 612 // DEBUG 613 // nro_debug_output( "MLTSCF", arymax, MLTSCF ) ; 614 // 615 for ( int i= 0 ; i < arymax ; i++) { 616 strcpy( c8, str8.c_str() ) ; 617 if ( readHeader( c8, 8 ) == -1 ) { 618 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ; 619 return -1 ; 620 } 621 LAGWIND[i] = string( c8 ) ; 622 } 623 // DEBUG 624 // nro_debug_output( "LAGWIND", arymax, LAGWIND ) ; 625 // 626 for ( int i= 0 ; i < arymax ; i++) { 627 if ( readHeader( BEBW[i], sameEndian ) == -1 ) { 628 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ; 629 return -1 ; 630 } 631 } 632 // DEBUG 633 // nro_debug_output( "BEBW", arymax, BEBW ) ; 634 // 635 for ( int i= 0 ; i < arymax ; i++) { 636 if ( readHeader( BERES[i], sameEndian ) == -1 ) { 637 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ; 638 return -1 ; 639 } 640 } 641 // DEBUG 642 // nro_debug_output( "BERES", arymax, BERES ) ; 643 // 644 for ( int i= 0 ; i < arymax ; i++) { 645 if ( readHeader( CHWID[i], sameEndian ) == -1 ) { 646 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ; 647 return -1 ; 648 } 649 } 650 // DEBUG 651 // nro_debug_output( "CHWID", arymax, CHWID ) ; 652 // 653 for ( int i= 0 ; i < arymax ; i++) { 654 if ( readHeader( ARRY[i], sameEndian ) == -1 ) { 655 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ; 656 return -1 ; 657 } 658 } 659 // DEBUG 660 // nro_debug_output( "ARRY", arymax, ARRY ) ; 661 // 662 for ( int i= 0 ; i < arymax ; i++) { 663 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) { 664 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ; 665 return -1 ; 666 } 667 } 668 // DEBUG 669 // nro_debug_output( "NFCAL", arymax, NFCAL ) ; 670 // 671 for ( int i= 0 ; i < arymax ; i++) { 672 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) { 673 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ; 674 return -1 ; 675 } 676 } 677 // DEBUG 678 // nro_debug_output( "F0CAL", arymax, F0CAL ) ; 679 // 680 for ( int i= 0 ; i < arymax ; i++) { 681 for ( int j = 0 ; j < 10 ; j++ ) { 682 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) { 683 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << LogIO::POST ; 684 return -1 ; 685 } 686 } 687 } 688 // DEBUG 689 // nro_debug_output( "FQCAL", arymax, 10, FQCAL ) ; 690 // 691 for ( int i= 0 ; i < arymax ; i++) { 692 for ( int j = 0 ; j < 10 ; j++ ) { 693 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) { 694 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << LogIO::POST ; 695 return -1 ; 696 } 697 } 698 } 699 // DEBUG 700 // nro_debug_output( "CHCAL", arymax, 10, CHCAL ) ; 701 // 702 for ( int i= 0 ; i < arymax ; i++) { 703 for ( int j = 0 ; j < 10 ; j++ ) { 704 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) { 705 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << LogIO::POST ; 706 return -1 ; 707 } 708 } 709 } 710 // DEBUG 711 // nro_debug_output( "CWCAL", arymax, 10, CWCAL ) ; 712 // 713 if ( readHeader( SCNLEN, sameEndian ) == -1 ) { 714 os << LogIO::WARN << "Error while reading data SCNLEN." << LogIO::POST ; 715 return -1 ; 716 } 717 // DEBUG 718 //cout << "SCNLEN = " << SCNLEN << endl ; 719 // 720 if ( readHeader( SBIND, sameEndian ) == -1 ) { 721 os << LogIO::WARN << "Error while reading data SBIND." << LogIO::POST ; 722 return -1 ; 723 } 724 // DEBUG 725 //cout << "SBIND = " << SBIND << endl ; 726 // 727 if ( readHeader( IBIT, sameEndian ) == -1 ) { 728 os << LogIO::WARN << "Error while reading data IBIT." << LogIO::POST ; 729 return -1 ; 730 } 731 // DEBUG 732 //cout << "IBIT = " << IBIT << endl ; 733 // 734 strcpy( c8, str8.c_str() ) ; 735 if ( readHeader( c8, 8 ) == -1 ) { 736 os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ; 737 return -1 ; 738 } 739 SITE = string( c8 ) ; 740 // DEBUG 741 //cout << "SITE = " << SITE << endl ; 742 // 86 fillHeaderCommon( sameEndian ) ; 87 88 // specific part 743 89 strcpy( c120, str120.c_str() ) ; 744 90 if ( readHeader( c120, 116 ) == -1 ) { -
trunk/external-alma/atnf/PKSIO/NRO45FITSReader.cc
r1757 r2783 56 56 } 57 57 58 // Read data header 59 Int NRO45FITSReader::read() 58 // // Read data header 59 // Int NRO45FITSReader::read() 60 // { 61 // LogIO os( LogOrigin( "NRO45FITSReader", "read()", WHERE ) ) ; 62 63 // // DEBUG 64 // //cout << "NRO45FITSReader::read()" << endl ; 65 // // 66 // int status = 0 ; 67 68 // // create NRO45Dataset 69 // dataset_ = new NROFITSDataset( filename_ ) ; 70 71 // // fill NROFITSDataset 72 // status = dataset_->fillHeader() ; 73 74 // if ( status != 0 ) { 75 // //cerr << "Failed to fill data header." << endl ; 76 // os << LogIO::SEVERE << "Failed to fill data header." << LogIO::EXCEPTION ; 77 // } 78 79 // return status ; 80 // } 81 82 void NRO45FITSReader::initDataset() 60 83 { 61 LogIO os( LogOrigin( "NRO45FITSReader", "read()", WHERE ) ) ;62 63 // DEBUG64 //cout << "NRO45FITSReader::read()" << endl ;65 //66 int status = 0 ;67 68 // create NRO45Dataset69 84 dataset_ = new NROFITSDataset( filename_ ) ; 70 71 // fill NROFITSDataset 72 status = dataset_->fillHeader() ; 73 74 if ( status != 0 ) { 75 //cerr << "Failed to fill data header." << endl ; 76 os << LogIO::SEVERE << "Failed to fill data header." << LogIO::EXCEPTION ; 77 } 78 79 return status ; 85 dataset_->initialize() ; 80 86 } -
trunk/external-alma/atnf/PKSIO/NRO45FITSReader.h
r1757 r2783 74 74 class NRO45FITSReader : public NRO45Reader 75 75 { 76 76 public: 77 77 // Constructor 78 78 NRO45FITSReader( string name ) ; … … 81 81 ~NRO45FITSReader() ; 82 82 83 // Read data header 84 virtual int read() ; 83 // // Read data header 84 // virtual int read() ; 85 protected: 86 // initialize Dataset 87 void initDataset(); 85 88 }; 86 89 -
trunk/external-alma/atnf/PKSIO/NRODataset.cc
r2782 r2783 67 67 same_(-1), 68 68 frec_() 69 {} 69 { 70 // size for common part of data 71 datasize_ = sizeof( char ) * 8 // LOFIL 72 + sizeof( char ) * 8 // VER 73 + sizeof( char ) * 16 // GROUP 74 + sizeof( char ) * 16 // PROJ 75 + sizeof( char ) * 24 // SCHED 76 + sizeof( char ) * 40 // OBSVR 77 + sizeof( char ) * 16 // LOSTM 78 + sizeof( char ) * 16 // LOETM 79 + sizeof( int ) * 2 // ARYNM, NSCAN 80 + sizeof( char ) * 120 // TITLE 81 + sizeof( char ) * 16 // OBJ 82 + sizeof( char ) * 8 // EPOCH 83 + sizeof( double ) * 4 // RA0, DEC0, GLNG0, GLAT0 84 + sizeof( int ) * 2 // NCALB, SCNCD 85 + sizeof( char ) * 120 // SCMOD 86 + sizeof( double ) // URVEL 87 + sizeof( char ) * 4 // VREF 88 + sizeof( char ) * 4 // VDEF 89 + sizeof( char ) * 8 // SWMOD 90 + sizeof( double ) * 8 // FRQSW, DBEAM, MLTOF, CMTQ, CMTE, CMTSOM, CMTNODE, CMTI 91 + sizeof( char ) * 24 // CMTTM 92 + sizeof( double ) * 6 // SBDX, SBDY, SBDZ1, SBDZ2, DAZP, DELP 93 + sizeof( int ) * 4 // CHBIND, NUMCH, CHMIN, CHMAX 94 + sizeof( double ) * 3 // ALCTM, IPTIM, PA 95 + sizeof( int ) * 3 // SCNLEN, SBIND, IBIT 96 + sizeof( char ) * 8 ; // SITE 97 } 70 98 71 99 // destructor … … 80 108 81 109 // data initialization 82 void NRODataset::initialize ()110 void NRODataset::initializeCommon() 83 111 { 84 112 LogIO os( LogOrigin( "NRODataset", "initialize()", WHERE ) ) ; … … 140 168 } 141 169 142 datasize_ = sizeof( char ) * 8 // LOFIL143 + sizeof( char ) * 8 // VER144 + sizeof( char ) * 16 // GROUP145 + sizeof( char ) * 16 // PROJ146 + sizeof( char ) * 24 // SCHED147 + sizeof( char ) * 40 // OBSVR148 + sizeof( char ) * 16 // LOSTM149 + sizeof( char ) * 16 // LOETM150 + sizeof( int ) * 2 // ARYNM, NSCAN151 + sizeof( char ) * 120 // TITLE152 + sizeof( char ) * 16 // OBJ153 + sizeof( char ) * 8 // EPOCH154 + sizeof( double ) * 4 // RA0, DEC0, GLNG0, GLAT0155 + sizeof( int ) * 2 // NCALB, SCNCD156 + sizeof( char ) * 120 // SCMOD157 + sizeof( double ) // URVEL158 + sizeof( char ) * 4 // VREF159 + sizeof( char ) * 4 // VDEF160 + sizeof( char ) * 8 // SWMOD161 + sizeof( double ) * 8 // FRQSW, DBEAM, MLTOF, CMTQ, CMTE, CMTSOM, CMTNODE, CMTI162 + sizeof( char ) * 24 // CMTTM163 + sizeof( double ) * 6 // SBDX, SBDY, SBDZ1, SBDZ2, DAZP, DELP164 + sizeof( int ) * 4 // CHBIND, NUMCH, CHMIN, CHMAX165 + sizeof( double ) * 3 // ALCTM, IPTIM, PA166 + sizeof( int ) * 3 // SCNLEN, SBIND, IBIT167 + sizeof( char ) * 8 ; // SITE168 169 170 // NRODataRecord 170 171 record_ = new NRODataRecord() ; … … 193 194 return status ; 194 195 } 196 197 // //scanNum_ = NSCAN + 1 ; // includes ZERO scan 198 // scanLen_ = SCNLEN ; 199 // dataLen_ = scanLen_ - SCAN_HEADER_SIZE ; 200 // scanNum_ = getScanNum(); 201 // rowNum_ = scanNum_ * ARYNM ; 202 // chmax_ = (int) ( dataLen_ * 8 / IBIT ) ; 203 // record_->LDATA = new char[dataLen_] ; 204 205 initArray(); 206 207 show() ; 208 209 return status ; 210 } 211 212 int NRODataset::fillHeaderCommon( int sameEndian ) 213 { 214 LogIO os( LogOrigin( "NRODataset", "fillHeader()", WHERE ) ) ; 215 216 int arymax = arrayMax() ; 217 218 string str4( 4, ' ' ) ; 219 string str8( 8, ' ' ) ; 220 string str16( 16, ' ' ) ; 221 string str18( 18, ' ' ) ; 222 string str24( 24, ' ' ) ; 223 string str40( 40, ' ' ) ; 224 string str120( 120, ' ' ) ; 225 char c4[4] ; 226 char c8[8] ; 227 char c16[16] ; 228 char c18[18] ; 229 char c24[24] ; 230 char c40[40] ; 231 char c120[120] ; 232 233 // make sure file pointer points a beginning of the file 234 fseek( fp_, 0, SEEK_SET ) ; 235 236 // read data header 237 strcpy( c8, str8.c_str() ) ; 238 if ( readHeader( c8, 8 ) == -1 ) { 239 os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ; 240 return -1 ; 241 } 242 LOFIL = string( c8 ) ; 243 // DEBUG 244 //cout << "LOFIL = " << LOFIL << endl ; 245 // 246 strcpy( c8, str8.c_str() ) ; 247 if ( readHeader( c8, 8 ) == -1 ) { 248 os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ; 249 return -1 ; 250 } 251 VER = string( c8 ) ; 252 // DEBUG 253 //cout << "VER = " << VER << endl ; 254 // 255 strcpy( c16, str16.c_str() ) ; 256 if ( readHeader( c16, 16 ) == -1 ) { 257 os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ; 258 return -1 ; 259 } 260 GROUP = string( c16 ) ; 261 // DEBUG 262 //cout << "GROUP = " << GROUP << endl ; 263 // 264 strcpy( c16, str16.c_str() ) ; 265 if ( readHeader( c16, 16 ) == -1 ) { 266 os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ; 267 return -1 ; 268 } 269 PROJ = string( c16 ) ; 270 // DEBUG 271 //cout << "PROJ = " << PROJ << endl ; 272 // 273 strcpy( c24, str24.c_str() ) ; 274 if ( readHeader( c24, 24 ) == -1 ) { 275 os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ; 276 return -1 ; 277 } 278 SCHED = string( c24 ) ; 279 // DEBUG 280 //cout << "SCHED = " << SCHED << endl ; 281 // 282 strcpy( c40, str40.c_str() ) ; 283 if ( readHeader( c40, 40 ) == -1 ) { 284 os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ; 285 return -1 ; 286 } 287 OBSVR = string( c40 ) ; 288 // DEBUG 289 //cout << "OBSVR = " << OBSVR << endl ; 290 // 291 strcpy( c16, str16.c_str() ) ; 292 if ( readHeader( c16, 16 ) == -1 ) { 293 os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ; 294 return -1 ; 295 } 296 LOSTM = string( c16 ) ; 297 // DEBUG 298 //cout << "LOSTM = " << LOSTM << endl ; 299 // 300 strcpy( c16, str16.c_str() ) ; 301 if ( readHeader( c16, 16 ) == -1 ) { 302 os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ; 303 return -1 ; 304 } 305 LOETM = string( c16 ) ; 306 // DEBUG 307 //cout << "LOETM = " << LOETM << endl ; 308 // 309 if ( readHeader( ARYNM, sameEndian ) == -1 ) { 310 os << LogIO::WARN << "Error while reading data ARYNM." << LogIO::POST ; 311 return -1 ; 312 } 313 // DEBUG 314 //cout << "ARYNM = " << ARYNM << endl ; 315 // 316 if ( readHeader( NSCAN, sameEndian ) == -1 ) { 317 os << LogIO::WARN << "Error while reading data NSCAN." << LogIO::POST ; 318 return -1 ; 319 } 320 // DEBUG 321 //cout << "NSCAN = " << NSCAN << endl ; 322 // 323 strcpy( c120, str120.c_str() ) ; 324 if ( readHeader( c120, 120 ) == -1 ) { 325 os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ; 326 return -1 ; 327 } 328 TITLE = string( c120 ) ; 329 // DEBUG 330 //cout << "TITLE = " << TITLE << endl ; 331 // 332 strcpy( c16, str16.c_str() ) ; 333 if ( readHeader( c16, 16 ) == -1 ) { 334 os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ; 335 return -1 ; 336 } 337 OBJ = string( c16 ) ; 338 // DEBUG 339 //cout << "OBJ = " << OBJ << endl ; 340 // 341 strcpy( c8, str8.c_str() ) ; 342 if ( readHeader( c8, 8 ) == -1 ) { 343 os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ; 344 return -1 ; 345 } 346 EPOCH = string( c8 ) ; 347 // DEBUG 348 //cout << "EPOCH = " << EPOCH << endl ; 349 // 350 if ( readHeader( RA0, sameEndian ) == -1 ) { 351 os << LogIO::WARN << "Error while reading data RA0." << LogIO::POST ; 352 return -1 ; 353 } 354 // DEBUG 355 //cout << "RA0 = " << RA0 << endl ; 356 // 357 if ( readHeader( DEC0, sameEndian ) == -1 ) { 358 os << LogIO::WARN << "Error while reading data DEC0." << LogIO::POST ; 359 return -1 ; 360 } 361 // DEBUG 362 //cout << "DEC0 = " << DEC0 << endl ; 363 // 364 if ( readHeader( GLNG0, sameEndian ) == -1 ) { 365 os << LogIO::WARN << "Error while reading data GLNG0." << LogIO::POST ; 366 return -1 ; 367 } 368 // DEBUG 369 //cout << "GLNG0 = " << GLNG0 << endl ; 370 // 371 if ( readHeader( GLAT0, sameEndian ) == -1 ) { 372 os << LogIO::WARN << "Error while reading data GLAT0." << LogIO::POST ; 373 return -1 ; 374 } 375 // DEBUG 376 //cout << "GLAT0 = " << GLAT0 << endl ; 377 // 378 if ( readHeader( NCALB, sameEndian ) == -1 ) { 379 os << LogIO::WARN << "Error while reading data NCALB." << LogIO::POST ; 380 return -1 ; 381 } 382 // DEBUG 383 //cout << "NCALB = " << NCALB << endl ; 384 // 385 if ( readHeader( SCNCD, sameEndian ) == -1 ) { 386 os << LogIO::WARN << "Error while reading data SCNCD." << LogIO::POST ; 387 return -1 ; 388 } 389 // DEBUG 390 //cout << "SCNCD = " << SCNCD << endl ; 391 // 392 strcpy( c120, str120.c_str() ) ; 393 if ( readHeader( c120, 120 ) == -1 ) { 394 os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ; 395 return -1 ; 396 } 397 SCMOD = string( c120 ) ; 398 // DEBUG 399 //cout << "SCMOD = " << SCMOD << endl ; 400 // 401 if ( readHeader( URVEL, sameEndian ) == -1 ) { 402 os << LogIO::WARN << "Error while reading data URVEL." << LogIO::POST ; 403 return -1 ; 404 } 405 // DEBUG 406 //cout << "URVEL = " << URVEL << endl ; 407 // 408 strcpy( c4, str4.c_str() ) ; 409 if ( readHeader( c4, 4 ) == -1 ) { 410 os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ; 411 return -1 ; 412 } 413 VREF = string( c4 ) ; 414 // DEBUG 415 //cout << "VREF = " << VREF << endl ; 416 // 417 strcpy( c4, str4.c_str() ) ; 418 if ( readHeader( c4, 4 ) == -1 ) { 419 os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ; 420 return -1 ; 421 } 422 VDEF = string( c4 ) ; 423 // DEBUG 424 //cout << "VDEF = " << VDEF << endl ; 425 // 426 strcpy( c8, str8.c_str() ) ; 427 if ( readHeader( c8, 8 ) == -1 ) { 428 os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ; 429 return -1 ; 430 } 431 SWMOD = string( c8 ) + "::OTF" ; 432 // DEBUG 433 //cout << "SWMOD = " << SWMOD << endl ; 434 // 435 if ( readHeader( FRQSW, sameEndian ) == -1 ) { 436 os << LogIO::WARN << "Error while reading data FRQSW." << LogIO::POST ; 437 return -1 ; 438 } 439 // DEBUG 440 //cout << "FRQSW = " << FRQSW << endl ; 441 // 442 if ( readHeader( DBEAM, sameEndian ) == -1 ) { 443 os << LogIO::WARN << "Error while reading data DBEAM." << LogIO::POST ; 444 return -1 ; 445 } 446 // DEBUG 447 //cout << "DBEAM = " << DBEAM << endl ; 448 // 449 if ( readHeader( MLTOF, sameEndian ) == -1 ) { 450 os << LogIO::WARN << "Error while reading data MLTOF." << LogIO::POST ; 451 return -1 ; 452 } 453 // DEBUG 454 //cout << "MLTOF = " << MLTOF << endl ; 455 // 456 if ( readHeader( CMTQ, sameEndian ) == -1 ) { 457 os << LogIO::WARN << "Error while reading data CMTQ." << LogIO::POST ; 458 return -1 ; 459 } 460 // DEBUG 461 //cout << "CMTQ = " << CMTQ << endl ; 462 // 463 if ( readHeader( CMTE, sameEndian ) == -1 ) { 464 os << LogIO::WARN << "Error while reading data CMTE." << LogIO::POST ; 465 return -1 ; 466 } 467 // DEBUG 468 //cout << "CMTE = " << CMTE << endl ; 469 // 470 if ( readHeader( CMTSOM, sameEndian ) == -1 ) { 471 os << LogIO::WARN << "Error while reading data CMTSOM." << LogIO::POST ; 472 return -1 ; 473 } 474 // DEBUG 475 //cout << "CMTSOM = " << CMTSOM << endl ; 476 // 477 if ( readHeader( CMTNODE, sameEndian ) == -1 ) { 478 os << LogIO::WARN << "Error while reading data CMTNODE." << LogIO::POST ; 479 return -1 ; 480 } 481 // DEBUG 482 //cout << "CMTNODE = " << CMTNODE << endl ; 483 // 484 if ( readHeader( CMTI, sameEndian ) == -1 ) { 485 os << LogIO::WARN << "Error while reading data CMTI." << LogIO::POST ; 486 return -1 ; 487 } 488 // DEBUG 489 //cout << "CMTI = " << CMTI << endl ; 490 // 491 strcpy( c24, str24.c_str() ) ; 492 if ( readHeader( c24, 24 ) == -1 ) { 493 os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ; 494 return -1 ; 495 } 496 CMTTM = string( c24 ) ; 497 // DEBUG 498 //cout << "CMTTM = " << CMTTM << endl ; 499 // 500 if ( readHeader( SBDX, sameEndian ) == -1 ) { 501 os << LogIO::WARN << "Error while reading data SBDX." << LogIO::POST ; 502 return -1 ; 503 } 504 // DEBUG 505 //cout << "SBDX = " << SBDX << endl ; 506 // 507 if ( readHeader( SBDY, sameEndian ) == -1 ) { 508 os << LogIO::WARN << "Error while reading data SBDY." << LogIO::POST ; 509 return -1 ; 510 } 511 // DEBUG 512 //cout << "SBDY = " << SBDY << endl ; 513 // 514 if ( readHeader( SBDZ1, sameEndian ) == -1 ) { 515 os << LogIO::WARN << "Error while reading data SBDZ1." << LogIO::POST ; 516 return -1 ; 517 } 518 // DEBUG 519 //cout << "SBDZ1 = " << SBDZ1 << endl ; 520 // 521 if ( readHeader( SBDZ2, sameEndian ) == -1 ) { 522 os << LogIO::WARN << "Error while reading data SBDZ2." << LogIO::POST ; 523 return -1 ; 524 } 525 // DEBUG 526 //cout << "SBDZ2 = " << SBDZ2 << endl ; 527 // 528 if ( readHeader( DAZP, sameEndian ) == -1 ) { 529 os << LogIO::WARN << "Error while reading data DAZP." << LogIO::POST ; 530 return -1 ; 531 } 532 // DEBUG 533 //cout << "DAZP = " << DAZP << endl ; 534 // 535 if ( readHeader( DELP, sameEndian ) == -1 ) { 536 os << LogIO::WARN << "Error while reading data DELP." << LogIO::POST ; 537 return -1 ; 538 } 539 // DEBUG 540 //cout << "DELP = " << DELP << endl ; 541 // 542 if ( readHeader( CHBIND, sameEndian ) == -1 ) { 543 os << LogIO::WARN << "Error while reading data CHBIND." << LogIO::POST ; 544 return -1 ; 545 } 546 // DEBUG 547 //cout << "CHBIND = " << CHBIND << endl ; 548 // 549 if ( readHeader( NUMCH, sameEndian ) == -1 ) { 550 os << LogIO::WARN << "Error while reading data NUMCH." << LogIO::POST ; 551 return -1 ; 552 } 553 // DEBUG 554 //cout << "NUMCH = " << NUMCH << endl ; 555 // 556 if ( readHeader( CHMIN, sameEndian ) == -1 ) { 557 os << LogIO::WARN << "Error while reading data CHMIN." << LogIO::POST ; 558 return -1 ; 559 } 560 // DEBUG 561 //cout << "CHMIN = " << CHMIN << endl ; 562 // 563 if ( readHeader( CHMAX, sameEndian ) == -1 ) { 564 os << LogIO::WARN << "Error while reading data CHMAX." << LogIO::POST ; 565 return -1 ; 566 } 567 // DEBUG 568 //cout << "CHMAX = " << CHMAX << endl ; 569 // 570 if ( readHeader( ALCTM, sameEndian ) == -1 ) { 571 os << LogIO::WARN << "Error while reading data ALCTM." << LogIO::POST ; 572 return -1 ; 573 } 574 // DEBUG 575 //cout << "ALCTM = " << ALCTM << endl ; 576 // 577 if ( readHeader( IPTIM, sameEndian ) == -1 ) { 578 os << LogIO::WARN << "Error while reading data IPTIM." << LogIO::POST ; 579 return -1 ; 580 } 581 // DEBUG 582 //cout << "IPTIM = " << IPTIM << endl ; 583 // 584 if ( readHeader( PA, sameEndian ) == -1 ) { 585 os << LogIO::WARN << "Error while reading data PA." << LogIO::POST ; 586 return -1 ; 587 } 588 // DEBUG 589 //cout << "PA = " << PA << endl ; 590 // 591 for ( int i = 0 ; i < arymax ; i++ ) { 592 strcpy( c18, str18.c_str() ) ; 593 if ( readHeader( c18, 16 ) == -1 ) { 594 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ; 595 return -1 ; 596 } 597 c18[16] = '\0' ; 598 RX[i] = string( c18 ) ; 599 } 600 // DEBUG 601 // nro_debug_output( "RX", arymax, RX ) ; 602 // 603 for ( int i = 0 ; i < arymax ; i++ ) { 604 if ( readHeader( HPBW[i], sameEndian ) == -1 ) { 605 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ; 606 return -1 ; 607 } 608 } 609 // DEBUG 610 // nro_debug_output( "HPBW", arymax, HPBW ) ; 611 // 612 for ( int i = 0 ; i < arymax ; i++ ) { 613 if ( readHeader( EFFA[i], sameEndian ) == -1 ) { 614 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ; 615 return -1 ; 616 } 617 } 618 // DEBUG 619 // nro_debug_output( "EFFA", arymax, EFFA ) ; 620 // 621 for ( int i = 0 ; i < arymax ; i++ ) { 622 if ( readHeader( EFFB[i], sameEndian ) == -1 ) { 623 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ; 624 return -1 ; 625 } 626 } 627 // DEBUG 628 // nro_debug_output( "EFFB", arymax, EFFB ) ; 629 // 630 for ( int i = 0 ; i < arymax ; i++ ) { 631 if ( readHeader( EFFL[i], sameEndian ) == -1 ) { 632 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ; 633 return -1 ; 634 } 635 } 636 // DEBUG 637 // nro_debug_output( "EFFL", arymax, EFFL ) ; 638 // 639 for ( int i = 0 ; i < arymax ; i++ ) { 640 if ( readHeader( EFSS[i], sameEndian ) == -1 ) { 641 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ; 642 return -1 ; 643 } 644 } 645 // DEBUG 646 // nro_debug_output( "EFSS", arymax, EFSS ) ; 647 // 648 for ( int i = 0 ; i < arymax ; i++) { 649 if ( readHeader( GAIN[i], sameEndian ) == -1 ) { 650 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ; 651 return -1 ; 652 } 653 } 654 // DEBUG 655 // nro_debug_output( "GAIN", arymax, GAIN ) ; 656 // 657 for ( int i = 0 ; i < arymax ; i++) { 658 strcpy( c4, str4.c_str() ) ; 659 if ( readHeader( c4, 4 ) == -1 ) { 660 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ; 661 return -1 ; 662 } 663 HORN[i] = string( c4 ) ; 664 } 665 // DEBUG 666 // nro_debug_output( "HORN", arymax, HORN ) ; 667 // 668 for ( int i = 0 ; i < arymax ; i++) { 669 strcpy( c4, str4.c_str() ) ; 670 if ( readHeader( c4, 4 ) == -1 ) { 671 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ; 672 return -1 ; 673 } 674 POLTP[i] = string( c4 ) ; 675 } 676 // DEBUG 677 // nro_debug_output( "POLTP", arymax, POLTP ) ; 678 // 679 for ( int i = 0 ; i < arymax ; i++) { 680 if ( readHeader( POLDR[i], sameEndian ) == -1 ) { 681 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ; 682 return -1 ; 683 } 684 } 685 // DEBUG 686 // nro_debug_output( "POLDR", arymax, POLDR ) ; 687 // 688 for ( int i = 0 ; i < arymax ; i++) { 689 if ( readHeader( POLAN[i], sameEndian ) == -1 ) { 690 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ; 691 return -1 ; 692 } 693 } 694 // DEBUG 695 // nro_debug_output( "POLAN", arymax, POLAN ) ; 696 // 697 for ( int i = 0 ; i < arymax ; i++) { 698 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) { 699 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ; 700 return -1 ; 701 } 702 } 703 // DEBUG 704 // nro_debug_output( "DFRQ", arymax, DFRQ ) ; 705 // 706 for ( int i = 0 ; i < arymax ; i++) { 707 strcpy( c4, str4.c_str() ) ; 708 if ( readHeader( c4, 4 ) == -1 ) { 709 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ; 710 return -1 ; 711 } 712 SIDBD[i] = string( c4 ) ; 713 } 714 // DEBUG 715 // nro_debug_output( "SIDBD", arymax, SIDBD ) ; 716 // 717 for ( int i = 0 ; i < arymax ; i++) { 718 if ( readHeader( REFN[i], sameEndian ) == -1 ) { 719 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ; 720 return -1 ; 721 } 722 } 723 // DEBUG 724 // nro_debug_output( "REFN", arymax, REFN ) ; 725 // 726 for ( int i = 0 ; i < arymax ; i++) { 727 if ( readHeader( IPINT[i], sameEndian ) == -1 ) { 728 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ; 729 return -1 ; 730 } 731 } 732 // DEBUG 733 // nro_debug_output( "IPINT", arymax, IPINT ) ; 734 // 735 for ( int i = 0 ; i < arymax ; i++) { 736 if ( readHeader( MULTN[i], sameEndian ) == -1 ) { 737 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ; 738 return -1 ; 739 } 740 } 741 // DEBUG 742 // nro_debug_output( "MULTN", arymax, MULTN ) ; 743 // 744 for ( int i = 0 ; i < arymax ; i++) { 745 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) { 746 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ; 747 return -1 ; 748 } 749 } 750 // DEBUG 751 // nro_debug_output( "MLTSCF", arymax, MLTSCF ) ; 752 // 753 for ( int i = 0 ; i < arymax ; i++) { 754 strcpy( c8, str8.c_str() ) ; 755 if ( readHeader( c8, 8 ) == -1 ) { 756 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ; 757 return -1 ; 758 } 759 LAGWIND[i] = string( c8 ) ; 760 } 761 // DEBUG 762 // nro_debug_output( "LAGWIND", arymax, LAGWIND ) ; 763 // 764 for ( int i = 0 ; i < arymax ; i++) { 765 if ( readHeader( BEBW[i], sameEndian ) == -1 ) { 766 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ; 767 return -1 ; 768 } 769 } 770 // DEBUG 771 // nro_debug_output( "BEBW", arymax, BEBW ) ; 772 // 773 for ( int i = 0 ; i < arymax ; i++) { 774 if ( readHeader( BERES[i], sameEndian ) == -1 ) { 775 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ; 776 return -1 ; 777 } 778 } 779 // DEBUG 780 // nro_debug_output( "BERES", arymax, BERES ) ; 781 // 782 for ( int i = 0 ; i < arymax ; i++) { 783 if ( readHeader( CHWID[i], sameEndian ) == -1 ) { 784 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ; 785 return -1 ; 786 } 787 } 788 // DEBUG 789 // nro_debug_output( "CHWID", arymax, CHWID ) ; 790 // 791 for ( int i = 0 ; i < arymax ; i++) { 792 if ( readHeader( ARRY[i], sameEndian ) == -1 ) { 793 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ; 794 return -1 ; 795 } 796 } 797 // DEBUG 798 // nro_debug_output( "ARRY", arymax, ARRY ) ; 799 // 800 for ( int i = 0 ; i < arymax ; i++) { 801 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) { 802 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ; 803 return -1 ; 804 } 805 } 806 // DEBUG 807 // nro_debug_output( "NFCAL", arymax, NFCAL ) ; 808 // 809 for ( int i = 0 ; i < arymax ; i++) { 810 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) { 811 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ; 812 return -1 ; 813 } 814 } 815 // DEBUG 816 // nro_debug_output( "F0CAL", arymax, F0CAL ) ; 817 // 818 for ( int i = 0 ; i < arymax ; i++) { 819 for ( int j = 0 ; j < 10 ; j++ ) { 820 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) { 821 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << LogIO::POST ; 822 return -1 ; 823 } 824 } 825 } 826 // DEBUG 827 // nro_debug_output( "FQCAL", arymax, 10, FQCAL ) ; 828 // 829 for ( int i = 0 ; i < arymax ; i++) { 830 for ( int j = 0 ; j < 10 ; j++ ) { 831 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) { 832 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << LogIO::POST ; 833 return -1 ; 834 } 835 } 836 } 837 // DEBUG 838 // nro_debug_output( "CHCAL", arymax, 10, CHCAL ) ; 839 // 840 for ( int i = 0 ; i < arymax ; i++) { 841 for ( int j = 0 ; j < 10 ; j++ ) { 842 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) { 843 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << LogIO::POST ; 844 return -1 ; 845 } 846 } 847 } 848 // DEBUG 849 // nro_debug_output( "CWCAL", arymax, 10, CWCAL ) ; 850 // 851 if ( readHeader( SCNLEN, sameEndian ) == -1 ) { 852 os << LogIO::WARN << "Error while reading data SCNLEN." << LogIO::POST ; 853 return -1 ; 854 } 855 // DEBUG 856 //cout << "SCNLEN = " << SCNLEN << endl ; 857 // 858 if ( readHeader( SBIND, sameEndian ) == -1 ) { 859 os << LogIO::WARN << "Error while reading data SBIND." << LogIO::POST ; 860 return -1 ; 861 } 862 // DEBUG 863 //cout << "SBIND = " << SBIND << endl ; 864 // 865 if ( readHeader( IBIT, sameEndian ) == -1 ) { 866 os << LogIO::WARN << "Error while reading data IBIT." << LogIO::POST ; 867 return -1 ; 868 } 869 // DEBUG 870 //cout << "IBIT = " << IBIT << endl ; 871 // 872 strcpy( c8, str8.c_str() ) ; 873 if ( readHeader( c8, 8 ) == -1 ) { 874 os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ; 875 return -1 ; 876 } 877 SITE = string( c8 ) ; 878 // DEBUG 879 //cout << "SITE = " << SITE << endl ; 880 // 195 881 196 882 //scanNum_ = NSCAN + 1 ; // includes ZERO scan … … 202 888 record_->LDATA = new char[dataLen_] ; 203 889 204 initArray(); 205 206 show() ; 207 208 return status ; 890 return 0 ; 209 891 } 210 892 -
trunk/external-alma/atnf/PKSIO/NRODataset.h
r2782 r2783 89 89 90 90 // Data initialization 91 virtual void initialize() ;91 virtual void initialize() = 0 ; 92 92 93 93 // open file … … 203 203 204 204 protected: 205 // initialize common part 206 void initializeCommon() ; 207 205 208 // fill header information 206 209 virtual int fillHeader( int sameEndian ) = 0 ; 210 int fillHeaderCommon( int sameEndian ) ; 207 211 208 212 // Endian conversion for int variable -
trunk/external-alma/atnf/PKSIO/NROFITSDataset.cc
r2768 r2783 47 47 NROFITSDataset::NROFITSDataset( string name ) 48 48 : NRODataset( name ) 49 { 50 LogIO os( LogOrigin( "NROFITSDataset", "NROFITSDataset()", WHERE ) ) ; 51 52 fp_ = NULL ; 53 dataid_ = -1 ; 54 record_ = new NRODataRecord() ; 55 record_->LDATA = NULL ; // never use LDATA 49 {} 50 51 // destructor 52 NROFITSDataset::~NROFITSDataset() 53 { 54 // close file 55 close() ; 56 } 57 58 // data initialization 59 void NROFITSDataset::initialize() 60 { 61 LogIO os( LogOrigin( "NROFITSDataset", "initialize()", WHERE ) ) ; 56 62 57 63 // open file 58 64 if ( open() ) 59 65 os << LogIO::SEVERE << "error while opening file " << filename_ << LogIO::EXCEPTION ; 60 61 // data initialization66 67 // field names, units, and sizes 62 68 readHeader( numField_, "TFIELDS", same_ ) ; 63 69 names_.resize( numField_ ) ; … … 88 94 } 89 95 90 // memory allocation 91 initialize() ; 92 } 93 94 // destructor 95 NROFITSDataset::~NROFITSDataset() 96 { 97 // close file 98 close() ; 99 } 100 101 // data initialization 102 void NROFITSDataset::initialize() 103 { 104 LogIO os( LogOrigin( "NROFITSDataset", "initialize()", WHERE ) ) ; 105 96 // initialization 106 97 int status = 0 ; 107 98 status = readHeader( ARYNM, "ARYNM", same_ ) ; … … 182 173 183 174 refFreq_.resize( ARYNM, 0.0 ) ; 184 } 185 186 // fill data header 187 int NROFITSDataset::fillHeader() 188 { 189 LogIO os( LogOrigin( "NROFITSDataset", "fillHeader()", WHERE ) ) ; 190 191 // open file 192 if ( open() ) { 193 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ; 194 return -1 ; 195 } 196 197 // fill 198 int status = fillHeader( same_ ) ; 199 200 return status ; 175 176 // NRODataRecord 177 record_ = new NRODataRecord() ; 178 record_->LDATA = NULL ; 201 179 } 202 180 … … 862 840 // nro_debug_output( "DSBFC", ARYNM, DSBFC ) ; 863 841 // 864 865 show() ;866 842 867 843 return 0 ; -
trunk/external-alma/atnf/PKSIO/NROFITSDataset.h
r2768 r2783 83 83 virtual void initialize() ; 84 84 85 // fill header from file86 virtual int fillHeader() ;85 // // fill header from file 86 // virtual int fillHeader() ; 87 87 88 88 // fill data record -
trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc
r2782 r2783 53 53 54 54 // it must be called 55 NRODataset::initialize() ;55 initializeCommon() ; 56 56 57 57 // additional initialization … … 82 82 int arymax = arrayMax() ; 83 83 84 string str4( 4, ' ' ) ;85 string str8( 8, ' ' ) ;86 string str16( 16, ' ' ) ;87 string str18( 18, ' ' ) ;88 string str24( 24, ' ' ) ;89 string str40( 40, ' ' ) ;90 string str120( 120, ' ' ) ;91 84 string str256( 256, ' ' ) ; 92 char c4[4] ;93 char c8[8] ;94 char c16[16] ;95 char c18[18] ;96 char c24[24] ;97 char c40[40] ;98 char c120[120] ;99 85 char c256[256] ; 100 86 // make sure file pointer points a beginning of the file 101 87 fseek( fp_, 0, SEEK_SET ) ; 102 88 103 // read data header 104 strcpy( c8, str8.c_str() ) ; 105 if ( readHeader( c8, 8 ) == -1 ) { 106 os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ; 107 return -1 ; 108 } 109 LOFIL = string( c8 ) ; 110 // DEBUG 111 //cout << "LOFIL = " << LOFIL << endl ; 112 // 113 strcpy( c8, str8.c_str() ) ; 114 if ( readHeader( c8, 8 ) == -1 ) { 115 os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ; 116 return -1 ; 117 } 118 VER = string( c8 ) ; 119 // DEBUG 120 //cout << "VER = " << VER << endl ; 121 // 122 strcpy( c16, str16.c_str() ) ; 123 if ( readHeader( c16, 16 ) == -1 ) { 124 os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ; 125 return -1 ; 126 } 127 GROUP = string( c16 ) ; 128 // DEBUG 129 //cout << "GROUP = " << GROUP << endl ; 130 // 131 strcpy( c16, str16.c_str() ) ; 132 if ( readHeader( c16, 16 ) == -1 ) { 133 os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ; 134 return -1 ; 135 } 136 PROJ = string( c16 ) ; 137 // DEBUG 138 //cout << "PROJ = " << PROJ << endl ; 139 // 140 strcpy( c24, str24.c_str() ) ; 141 if ( readHeader( c24, 24 ) == -1 ) { 142 os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ; 143 return -1 ; 144 } 145 SCHED = string( c24 ) ; 146 // DEBUG 147 //cout << "SCHED = " << SCHED << endl ; 148 // 149 strcpy( c40, str40.c_str() ) ; 150 if ( readHeader( c40, 40 ) == -1 ) { 151 os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ; 152 return -1 ; 153 } 154 OBSVR = string( c40 ) ; 155 // DEBUG 156 //cout << "OBSVR = " << OBSVR << endl ; 157 // 158 strcpy( c16, str16.c_str() ) ; 159 if ( readHeader( c16, 16 ) == -1 ) { 160 os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ; 161 return -1 ; 162 } 163 LOSTM = string( c16 ) ; 164 // DEBUG 165 //cout << "LOSTM = " << LOSTM << endl ; 166 // 167 strcpy( c16, str16.c_str() ) ; 168 if ( readHeader( c16, 16 ) == -1 ) { 169 os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ; 170 return -1 ; 171 } 172 LOETM = string( c16 ) ; 173 // DEBUG 174 //cout << "LOETM = " << LOETM << endl ; 175 // 176 if ( readHeader( ARYNM, sameEndian ) == -1 ) { 177 os << LogIO::WARN << "Error while reading data ARYNM." << LogIO::POST ; 178 return -1 ; 179 } 180 // DEBUG 181 //cout << "ARYNM = " << ARYNM << endl ; 182 // 183 if ( readHeader( NSCAN, sameEndian ) == -1 ) { 184 os << LogIO::WARN << "Error while reading data NSCAN." << LogIO::POST ; 185 return -1 ; 186 } 187 // DEBUG 188 //cout << "NSCAN = " << NSCAN << endl ; 189 // 190 strcpy( c120, str120.c_str() ) ; 191 if ( readHeader( c120, 120 ) == -1 ) { 192 os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ; 193 return -1 ; 194 } 195 TITLE = string( c120 ) ; 196 // DEBUG 197 //cout << "TITLE = " << TITLE << endl ; 198 // 199 strcpy( c16, str16.c_str() ) ; 200 if ( readHeader( c16, 16 ) == -1 ) { 201 os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ; 202 return -1 ; 203 } 204 OBJ = string( c16 ) ; 205 // DEBUG 206 //cout << "OBJ = " << OBJ << endl ; 207 // 208 strcpy( c8, str8.c_str() ) ; 209 if ( readHeader( c8, 8 ) == -1 ) { 210 os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ; 211 return -1 ; 212 } 213 EPOCH = string( c8 ) ; 214 // DEBUG 215 //cout << "EPOCH = " << EPOCH << endl ; 216 // 217 if ( readHeader( RA0, sameEndian ) == -1 ) { 218 os << LogIO::WARN << "Error while reading data RA0." << LogIO::POST ; 219 return -1 ; 220 } 221 // DEBUG 222 //cout << "RA0 = " << RA0 << endl ; 223 // 224 if ( readHeader( DEC0, sameEndian ) == -1 ) { 225 os << LogIO::WARN << "Error while reading data DEC0." << LogIO::POST ; 226 return -1 ; 227 } 228 // DEBUG 229 //cout << "DEC0 = " << DEC0 << endl ; 230 // 231 if ( readHeader( GLNG0, sameEndian ) == -1 ) { 232 os << LogIO::WARN << "Error while reading data GLNG0." << LogIO::POST ; 233 return -1 ; 234 } 235 // DEBUG 236 //cout << "GLNG0 = " << GLNG0 << endl ; 237 // 238 if ( readHeader( GLAT0, sameEndian ) == -1 ) { 239 os << LogIO::WARN << "Error while reading data GLAT0." << LogIO::POST ; 240 return -1 ; 241 } 242 // DEBUG 243 //cout << "GLAT0 = " << GLAT0 << endl ; 244 // 245 if ( readHeader( NCALB, sameEndian ) == -1 ) { 246 os << LogIO::WARN << "Error while reading data NCALB." << LogIO::POST ; 247 return -1 ; 248 } 249 // DEBUG 250 //cout << "NCALB = " << NCALB << endl ; 251 // 252 if ( readHeader( SCNCD, sameEndian ) == -1 ) { 253 os << LogIO::WARN << "Error while reading data SCNCD." << LogIO::POST ; 254 return -1 ; 255 } 256 // DEBUG 257 //cout << "SCNCD = " << SCNCD << endl ; 258 // 259 strcpy( c120, str120.c_str() ) ; 260 if ( readHeader( c120, 120 ) == -1 ) { 261 os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ; 262 return -1 ; 263 } 264 SCMOD = string( c120 ) ; 265 // DEBUG 266 //cout << "SCMOD = " << SCMOD << endl ; 267 // 268 if ( readHeader( URVEL, sameEndian ) == -1 ) { 269 os << LogIO::WARN << "Error while reading data URVEL." << LogIO::POST ; 270 return -1 ; 271 } 272 // DEBUG 273 //cout << "URVEL = " << URVEL << endl ; 274 // 275 strcpy( c4, str4.c_str() ) ; 276 if ( readHeader( c4, 4 ) == -1 ) { 277 os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ; 278 return -1 ; 279 } 280 VREF = string( c4 ) ; 281 // DEBUG 282 //cout << "VREF = " << VREF << endl ; 283 // 284 strcpy( c4, str4.c_str() ) ; 285 if ( readHeader( c4, 4 ) == -1 ) { 286 os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ; 287 return -1 ; 288 } 289 VDEF = string( c4 ) ; 290 // DEBUG 291 //cout << "VDEF = " << VDEF << endl ; 292 // 293 strcpy( c8, str8.c_str() ) ; 294 if ( readHeader( c8, 8 ) == -1 ) { 295 os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ; 296 return -1 ; 297 } 298 SWMOD = string( c8 ) + "::OTF" ; 299 // DEBUG 300 //cout << "SWMOD = " << SWMOD << endl ; 301 // 302 if ( readHeader( FRQSW, sameEndian ) == -1 ) { 303 os << LogIO::WARN << "Error while reading data FRQSW." << LogIO::POST ; 304 return -1 ; 305 } 306 // DEBUG 307 //cout << "FRQSW = " << FRQSW << endl ; 308 // 309 if ( readHeader( DBEAM, sameEndian ) == -1 ) { 310 os << LogIO::WARN << "Error while reading data DBEAM." << LogIO::POST ; 311 return -1 ; 312 } 313 // DEBUG 314 //cout << "DBEAM = " << DBEAM << endl ; 315 // 316 if ( readHeader( MLTOF, sameEndian ) == -1 ) { 317 os << LogIO::WARN << "Error while reading data MLTOF." << LogIO::POST ; 318 return -1 ; 319 } 320 // DEBUG 321 //cout << "MLTOF = " << MLTOF << endl ; 322 // 323 if ( readHeader( CMTQ, sameEndian ) == -1 ) { 324 os << LogIO::WARN << "Error while reading data CMTQ." << LogIO::POST ; 325 return -1 ; 326 } 327 // DEBUG 328 //cout << "CMTQ = " << CMTQ << endl ; 329 // 330 if ( readHeader( CMTE, sameEndian ) == -1 ) { 331 os << LogIO::WARN << "Error while reading data CMTE." << LogIO::POST ; 332 return -1 ; 333 } 334 // DEBUG 335 //cout << "CMTE = " << CMTE << endl ; 336 // 337 if ( readHeader( CMTSOM, sameEndian ) == -1 ) { 338 os << LogIO::WARN << "Error while reading data CMTSOM." << LogIO::POST ; 339 return -1 ; 340 } 341 // DEBUG 342 //cout << "CMTSOM = " << CMTSOM << endl ; 343 // 344 if ( readHeader( CMTNODE, sameEndian ) == -1 ) { 345 os << LogIO::WARN << "Error while reading data CMTNODE." << LogIO::POST ; 346 return -1 ; 347 } 348 // DEBUG 349 //cout << "CMTNODE = " << CMTNODE << endl ; 350 // 351 if ( readHeader( CMTI, sameEndian ) == -1 ) { 352 os << LogIO::WARN << "Error while reading data CMTI." << LogIO::POST ; 353 return -1 ; 354 } 355 // DEBUG 356 //cout << "CMTI = " << CMTI << endl ; 357 // 358 strcpy( c24, str24.c_str() ) ; 359 if ( readHeader( c24, 24 ) == -1 ) { 360 os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ; 361 return -1 ; 362 } 363 CMTTM = string( c24 ) ; 364 // DEBUG 365 //cout << "CMTTM = " << CMTTM << endl ; 366 // 367 if ( readHeader( SBDX, sameEndian ) == -1 ) { 368 os << LogIO::WARN << "Error while reading data SBDX." << LogIO::POST ; 369 return -1 ; 370 } 371 // DEBUG 372 //cout << "SBDX = " << SBDX << endl ; 373 // 374 if ( readHeader( SBDY, sameEndian ) == -1 ) { 375 os << LogIO::WARN << "Error while reading data SBDY." << LogIO::POST ; 376 return -1 ; 377 } 378 // DEBUG 379 //cout << "SBDY = " << SBDY << endl ; 380 // 381 if ( readHeader( SBDZ1, sameEndian ) == -1 ) { 382 os << LogIO::WARN << "Error while reading data SBDZ1." << LogIO::POST ; 383 return -1 ; 384 } 385 // DEBUG 386 //cout << "SBDZ1 = " << SBDZ1 << endl ; 387 // 388 if ( readHeader( SBDZ2, sameEndian ) == -1 ) { 389 os << LogIO::WARN << "Error while reading data SBDZ2." << LogIO::POST ; 390 return -1 ; 391 } 392 // DEBUG 393 //cout << "SBDZ2 = " << SBDZ2 << endl ; 394 // 395 if ( readHeader( DAZP, sameEndian ) == -1 ) { 396 os << LogIO::WARN << "Error while reading data DAZP." << LogIO::POST ; 397 return -1 ; 398 } 399 // DEBUG 400 //cout << "DAZP = " << DAZP << endl ; 401 // 402 if ( readHeader( DELP, sameEndian ) == -1 ) { 403 os << LogIO::WARN << "Error while reading data DELP." << LogIO::POST ; 404 return -1 ; 405 } 406 // DEBUG 407 //cout << "DELP = " << DELP << endl ; 408 // 409 if ( readHeader( CHBIND, sameEndian ) == -1 ) { 410 os << LogIO::WARN << "Error while reading data CHBIND." << LogIO::POST ; 411 return -1 ; 412 } 413 // DEBUG 414 //cout << "CHBIND = " << CHBIND << endl ; 415 // 416 if ( readHeader( NUMCH, sameEndian ) == -1 ) { 417 os << LogIO::WARN << "Error while reading data NUMCH." << LogIO::POST ; 418 return -1 ; 419 } 420 // DEBUG 421 //cout << "NUMCH = " << NUMCH << endl ; 422 // 423 if ( readHeader( CHMIN, sameEndian ) == -1 ) { 424 os << LogIO::WARN << "Error while reading data CHMIN." << LogIO::POST ; 425 return -1 ; 426 } 427 // DEBUG 428 //cout << "CHMIN = " << CHMIN << endl ; 429 // 430 if ( readHeader( CHMAX, sameEndian ) == -1 ) { 431 os << LogIO::WARN << "Error while reading data CHMAX." << LogIO::POST ; 432 return -1 ; 433 } 434 // DEBUG 435 //cout << "CHMAX = " << CHMAX << endl ; 436 // 437 if ( readHeader( ALCTM, sameEndian ) == -1 ) { 438 os << LogIO::WARN << "Error while reading data ALCTM." << LogIO::POST ; 439 return -1 ; 440 } 441 // DEBUG 442 //cout << "ALCTM = " << ALCTM << endl ; 443 // 444 if ( readHeader( IPTIM, sameEndian ) == -1 ) { 445 os << LogIO::WARN << "Error while reading data IPTIM." << LogIO::POST ; 446 return -1 ; 447 } 448 // DEBUG 449 //cout << "IPTIM = " << IPTIM << endl ; 450 // 451 if ( readHeader( PA, sameEndian ) == -1 ) { 452 os << LogIO::WARN << "Error while reading data PA." << LogIO::POST ; 453 return -1 ; 454 } 455 // DEBUG 456 //cout << "PA = " << PA << endl ; 457 // 458 for ( int i = 0 ; i < arymax ; i++ ) { 459 strcpy( c18, str18.c_str() ) ; 460 if ( readHeader( c18, 16 ) == -1 ) { 461 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ; 462 return -1 ; 463 } 464 c18[16] = '\0' ; 465 RX[i] = string( c18 ) ; 466 } 467 // DEBUG 468 // nro_debug_output( "RX", arymax, RX ) ; 469 // 470 for ( int i = 0 ; i < arymax ; i++ ) { 471 if ( readHeader( HPBW[i], sameEndian ) == -1 ) { 472 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ; 473 return -1 ; 474 } 475 } 476 // DEBUG 477 // nro_debug_output( "HPBW", arymax, HPBW ) ; 478 // 479 for ( int i = 0 ; i < arymax ; i++ ) { 480 if ( readHeader( EFFA[i], sameEndian ) == -1 ) { 481 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ; 482 return -1 ; 483 } 484 } 485 // DEBUG 486 // nro_debug_output( "EFFA", arymax, EFFA ) ; 487 // 488 for ( int i = 0 ; i < arymax ; i++ ) { 489 if ( readHeader( EFFB[i], sameEndian ) == -1 ) { 490 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ; 491 return -1 ; 492 } 493 } 494 // DEBUG 495 // nro_debug_output( "EFFB", arymax, EFFB ) ; 496 // 497 for ( int i = 0 ; i < arymax ; i++ ) { 498 if ( readHeader( EFFL[i], sameEndian ) == -1 ) { 499 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ; 500 return -1 ; 501 } 502 } 503 // DEBUG 504 // nro_debug_output( "EFFL", arymax, EFFL ) ; 505 // 506 for ( int i = 0 ; i < arymax ; i++ ) { 507 if ( readHeader( EFSS[i], sameEndian ) == -1 ) { 508 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ; 509 return -1 ; 510 } 511 } 512 // DEBUG 513 // nro_debug_output( "EFSS", arymax, EFSS ) ; 514 // 515 for ( int i = 0 ; i < arymax ; i++) { 516 if ( readHeader( GAIN[i], sameEndian ) == -1 ) { 517 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ; 518 return -1 ; 519 } 520 } 521 // DEBUG 522 // nro_debug_output( "GAIN", arymax, GAIN ) ; 523 // 524 for ( int i = 0 ; i < arymax ; i++) { 525 strcpy( c4, str4.c_str() ) ; 526 if ( readHeader( c4, 4 ) == -1 ) { 527 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ; 528 return -1 ; 529 } 530 HORN[i] = string( c4 ) ; 531 } 532 // DEBUG 533 // nro_debug_output( "HORN", arymax, HORN ) ; 534 // 535 for ( int i = 0 ; i < arymax ; i++) { 536 strcpy( c4, str4.c_str() ) ; 537 if ( readHeader( c4, 4 ) == -1 ) { 538 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ; 539 return -1 ; 540 } 541 POLTP[i] = string( c4 ) ; 542 } 543 // DEBUG 544 // nro_debug_output( "POLTP", arymax, POLTP ) ; 545 // 546 for ( int i = 0 ; i < arymax ; i++) { 547 if ( readHeader( POLDR[i], sameEndian ) == -1 ) { 548 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ; 549 return -1 ; 550 } 551 } 552 // DEBUG 553 // nro_debug_output( "POLDR", arymax, POLDR ) ; 554 // 555 for ( int i = 0 ; i < arymax ; i++) { 556 if ( readHeader( POLAN[i], sameEndian ) == -1 ) { 557 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ; 558 return -1 ; 559 } 560 } 561 // DEBUG 562 // nro_debug_output( "POLAN", arymax, POLAN ) ; 563 // 564 for ( int i = 0 ; i < arymax ; i++) { 565 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) { 566 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ; 567 return -1 ; 568 } 569 } 570 // DEBUG 571 // nro_debug_output( "DFRQ", arymax, DFRQ ) ; 572 // 573 for ( int i = 0 ; i < arymax ; i++) { 574 strcpy( c4, str4.c_str() ) ; 575 if ( readHeader( c4, 4 ) == -1 ) { 576 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ; 577 return -1 ; 578 } 579 SIDBD[i] = string( c4 ) ; 580 } 581 // DEBUG 582 // nro_debug_output( "SIDBD", arymax, SIDBD ) ; 583 // 584 for ( int i = 0 ; i < arymax ; i++) { 585 if ( readHeader( REFN[i], sameEndian ) == -1 ) { 586 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ; 587 return -1 ; 588 } 589 } 590 // DEBUG 591 // nro_debug_output( "REFN", arymax, REFN ) ; 592 // 593 for ( int i = 0 ; i < arymax ; i++) { 594 if ( readHeader( IPINT[i], sameEndian ) == -1 ) { 595 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ; 596 return -1 ; 597 } 598 } 599 // DEBUG 600 // nro_debug_output( "IPINT", arymax, IPINT ) ; 601 // 602 for ( int i = 0 ; i < arymax ; i++) { 603 if ( readHeader( MULTN[i], sameEndian ) == -1 ) { 604 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ; 605 return -1 ; 606 } 607 } 608 // DEBUG 609 // nro_debug_output( "MULTN", arymax, MULTN ) ; 610 // 611 for ( int i = 0 ; i < arymax ; i++) { 612 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) { 613 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ; 614 return -1 ; 615 } 616 } 617 // DEBUG 618 // nro_debug_output( "MLTSCF", arymax, MLTSCF ) ; 619 // 620 for ( int i = 0 ; i < arymax ; i++) { 621 strcpy( c8, str8.c_str() ) ; 622 if ( readHeader( c8, 8 ) == -1 ) { 623 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ; 624 return -1 ; 625 } 626 LAGWIND[i] = string( c8 ) ; 627 } 628 // DEBUG 629 // nro_debug_output( "LAGWIND", arymax, LAGWIND ) ; 630 // 631 for ( int i = 0 ; i < arymax ; i++) { 632 if ( readHeader( BEBW[i], sameEndian ) == -1 ) { 633 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ; 634 return -1 ; 635 } 636 } 637 // DEBUG 638 // nro_debug_output( "BEBW", arymax, BEBW ) ; 639 // 640 for ( int i = 0 ; i < arymax ; i++) { 641 if ( readHeader( BERES[i], sameEndian ) == -1 ) { 642 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ; 643 return -1 ; 644 } 645 } 646 // DEBUG 647 // nro_debug_output( "BERES", arymax, BERES ) ; 648 // 649 for ( int i = 0 ; i < arymax ; i++) { 650 if ( readHeader( CHWID[i], sameEndian ) == -1 ) { 651 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ; 652 return -1 ; 653 } 654 } 655 // DEBUG 656 // nro_debug_output( "CHWID", arymax, CHWID ) ; 657 // 658 for ( int i = 0 ; i < arymax ; i++) { 659 if ( readHeader( ARRY[i], sameEndian ) == -1 ) { 660 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ; 661 return -1 ; 662 } 663 } 664 // DEBUG 665 // nro_debug_output( "ARRY", arymax, ARRY ) ; 666 // 667 for ( int i = 0 ; i < arymax ; i++) { 668 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) { 669 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ; 670 return -1 ; 671 } 672 } 673 // DEBUG 674 // nro_debug_output( "NFCAL", arymax, NFCAL ) ; 675 // 676 for ( int i = 0 ; i < arymax ; i++) { 677 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) { 678 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ; 679 return -1 ; 680 } 681 } 682 // DEBUG 683 // nro_debug_output( "F0CAL", arymax, F0CAL ) ; 684 // 685 for ( int i = 0 ; i < arymax ; i++) { 686 for ( int j = 0 ; j < 10 ; j++ ) { 687 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) { 688 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << LogIO::POST ; 689 return -1 ; 690 } 691 } 692 } 693 // DEBUG 694 // nro_debug_output( "FQCAL", arymax, 10, FQCAL ) ; 695 // 696 for ( int i = 0 ; i < arymax ; i++) { 697 for ( int j = 0 ; j < 10 ; j++ ) { 698 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) { 699 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << LogIO::POST ; 700 return -1 ; 701 } 702 } 703 } 704 // DEBUG 705 // nro_debug_output( "CHCAL", arymax, 10, CHCAL ) ; 706 // 707 for ( int i = 0 ; i < arymax ; i++) { 708 for ( int j = 0 ; j < 10 ; j++ ) { 709 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) { 710 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << LogIO::POST ; 711 return -1 ; 712 } 713 } 714 } 715 // DEBUG 716 // nro_debug_output( "CWCAL", arymax, 10, CWCAL ) ; 717 // 718 if ( readHeader( SCNLEN, sameEndian ) == -1 ) { 719 os << LogIO::WARN << "Error while reading data SCNLEN." << LogIO::POST ; 720 return -1 ; 721 } 722 // DEBUG 723 //cout << "SCNLEN = " << SCNLEN << endl ; 724 // 725 if ( readHeader( SBIND, sameEndian ) == -1 ) { 726 os << LogIO::WARN << "Error while reading data SBIND." << LogIO::POST ; 727 return -1 ; 728 } 729 // DEBUG 730 //cout << "SBIND = " << SBIND << endl ; 731 // 732 if ( readHeader( IBIT, sameEndian ) == -1 ) { 733 os << LogIO::WARN << "Error while reading data IBIT." << LogIO::POST ; 734 return -1 ; 735 } 736 // DEBUG 737 //cout << "IBIT = " << IBIT << endl ; 738 // 739 strcpy( c8, str8.c_str() ) ; 740 if ( readHeader( c8, 8 ) == -1 ) { 741 os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ; 742 return -1 ; 743 } 744 SITE = string( c8 ) ; 745 // DEBUG 746 //cout << "SITE = " << SITE << endl ; 747 // 89 fillHeaderCommon( sameEndian ) ; 90 91 // specific part 748 92 strcpy( c256, str256.c_str() ) ; 749 93 if ( readHeader( c256, 180 ) == -1 ) { -
trunk/external-alma/atnf/PKSIO/NROReader.cc
r2782 r2783 629 629 restfreq.resize( oneByOne ) ; 630 630 restfreq[0] = record->FREQ0 ; 631 //cout << "restfreq = " << r f<< endl ;631 //cout << "restfreq = " << restfreq[0] << endl ; 632 632 633 633 // refbeamno … … 674 674 flagtra.set( 0 ) ; 675 675 } 676 //cout << "flag.size() = " << flag .size() << endl ;676 //cout << "flag.size() = " << flagtra.size() << endl ; 677 677 678 678 // tsys
Note:
See TracChangeset
for help on using the changeset viewer.