source: branches/polybatch/external-alma/atnf/PKSIO/ASTEDataset.cc@ 2048

Last change on this file since 2048 was 1868, checked in by Takeshi Nakazato, 14 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): atnf

Description: Describe your changes here...

Sync with code/atnf/implement/PKSIO


File size: 29.1 KB
Line 
1//#---------------------------------------------------------------------------
2//# ASTEDataset.cc: Class for ASTE dataset.
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2000-2006
5//# Associated Universities, Inc. Washington DC, USA.
6//#
7//# This library is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU Library General Public License as published by
9//# the Free Software Foundation; either version 2 of the License, or (at your
10//# option) any later version.
11//#
12//# This library is distributed in the hope that it will be useful, but WITHOUT
13//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15//# License for more details.
16//#
17//# You should have received a copy of the GNU Library General Public License
18//# along with this library; if not, write to the Free Software Foundation,
19//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning AIPS++ should be addressed as follows:
22//# Internet email: aips2-request@nrao.edu.
23//# Postal address: AIPS++ Project Office
24//# National Radio Astronomy Observatory
25//# 520 Edgemont Road
26//# Charlottesville, VA 22903-2475 USA
27//#
28//# $Id$
29//#---------------------------------------------------------------------------
30//# Original: 2008/10/30, Takeshi Nakazato, NAOJ
31//#---------------------------------------------------------------------------
32
33#include <atnf/PKSIO/ASTEDataset.h>
34
35#include <iostream>
36#include <cstring>
37
38using namespace std ;
39
40// constructor
41ASTEDataset::ASTEDataset( string name )
42 : NRODataset( name )
43{
44 LogIO os( LogOrigin( "ASTEDataset", "ASTEDataset()", WHERE ) ) ;
45
46 // check endian
47 open() ;
48 fseek( fp_, 144, SEEK_SET ) ;
49 int tmp ;
50 if( fread( &tmp, 1, sizeof(int), fp_ ) != sizeof(int) ) {
51 os << LogIO::SEVERE << "Error while checking endian of the file. " << LogIO::POST ;
52 return ;
53 }
54 if ( ( 0 < tmp ) && ( tmp <= ASTE_ARYMAX ) ) {
55 same_ = true ;
56 os << LogIO::NORMAL << "same endian " << LogIO::POST ;
57 }
58 else {
59 same_ = false ;
60 os << LogIO::NORMAL << "different endian " << LogIO::POST ;
61 }
62 fseek( fp_, 0, SEEK_SET ) ;
63
64 // memory allocation
65 initialize() ;
66}
67
68// destructor
69ASTEDataset::~ASTEDataset()
70{
71}
72
73// data initialization
74void ASTEDataset::initialize()
75{
76 RX.resize( ASTE_ARYMAX ) ;
77 HPBW.resize( ASTE_ARYMAX ) ;
78 EFFA.resize( ASTE_ARYMAX ) ;
79 EFFB.resize( ASTE_ARYMAX ) ;
80 EFFL.resize( ASTE_ARYMAX ) ;
81 EFSS.resize( ASTE_ARYMAX ) ;
82 GAIN.resize( ASTE_ARYMAX ) ;
83 HORN.resize( ASTE_ARYMAX ) ;
84 POLTP.resize( ASTE_ARYMAX ) ;
85 POLDR.resize( ASTE_ARYMAX ) ;
86 POLAN.resize( ASTE_ARYMAX ) ;
87 DFRQ.resize( ASTE_ARYMAX ) ;
88 SIDBD.resize( ASTE_ARYMAX ) ;
89 REFN.resize( ASTE_ARYMAX ) ;
90 IPINT.resize( ASTE_ARYMAX ) ;
91 MULTN.resize( ASTE_ARYMAX ) ;
92 MLTSCF.resize( ASTE_ARYMAX ) ;
93 LAGWIND.resize( ASTE_ARYMAX ) ;
94 BEBW.resize( ASTE_ARYMAX ) ;
95 BERES.resize( ASTE_ARYMAX ) ;
96 CHWID.resize( ASTE_ARYMAX ) ;
97 ARRY.resize( ASTE_ARYMAX ) ;
98 NFCAL.resize( ASTE_ARYMAX ) ;
99 F0CAL.resize( ASTE_ARYMAX ) ;
100 FQCAL.resize( ASTE_ARYMAX ) ;
101 CHCAL.resize( ASTE_ARYMAX ) ;
102 CWCAL.resize( ASTE_ARYMAX ) ;
103 DSBFC.resize( ASTE_ARYMAX ) ;
104
105 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
106 FQCAL[i].resize( 10 ) ;
107 CHCAL[i].resize( 10 ) ;
108 CWCAL[i].resize( 10 ) ;
109 }
110
111 datasize_ += sizeof( char ) * ASTE_ARYMAX * 16 // RX
112 + sizeof( double ) * ASTE_ARYMAX * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN
113 + sizeof( char ) * ASTE_ARYMAX * 4 // HORN
114 + sizeof( char ) * ASTE_ARYMAX * 4 // POLTP
115 + sizeof( double ) * ASTE_ARYMAX * 3 // POLDR, POLAN, DFRQ
116 + sizeof( char ) * ASTE_ARYMAX * 4 // SIDBID
117 + sizeof( int ) * ASTE_ARYMAX * 3 // REFN, IPINT, MULTN
118 + sizeof( double ) * ASTE_ARYMAX // MLTSCF
119 + sizeof( char ) * ASTE_ARYMAX * 8 // LAGWIND
120 + sizeof( double ) * ASTE_ARYMAX * 3 // BEBW, BERES, CHWID
121 + sizeof( int ) * ASTE_ARYMAX * 2 // ARRY, NFCAL
122 + sizeof( double ) * ASTE_ARYMAX // F0CAL
123 + sizeof( double ) * ASTE_ARYMAX * 10 * 3 // FQCAL, CHCAL, CWCAL
124 + sizeof( char ) * 116 // CDMY1
125 + sizeof( double ) * ASTE_ARYMAX ; // DSBFC
126
127 refFreq_.resize( ASTE_ARYMAX, 0.0 ) ;
128}
129
130// fill data header
131int ASTEDataset::fillHeader()
132{
133 LogIO os( LogOrigin( "ASTEDataset", "fillHeader()", WHERE ) ) ;
134
135 // open file
136 if ( open() ) {
137 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ;
138 return -1 ;
139 }
140
141 // fill
142 int status = fillHeader( same_ ) ;
143
144 return status ;
145}
146
147int ASTEDataset::fillHeader( int sameEndian )
148{
149 LogIO os( LogOrigin( "ASTEDataset", "fillHeader()", WHERE ) ) ;
150
151 string str4( 4, ' ' ) ;
152 string str8( 8, ' ' ) ;
153 string str16( 16, ' ' ) ;
154 string str18( 18, ' ' ) ;
155 string str24( 24, ' ' ) ;
156 string str40( 40, ' ' ) ;
157 string str120( 120, ' ' ) ;
158 char c4[4] ;
159 char c8[8] ;
160 char c16[16] ;
161 char c18[18] ;
162 char c24[24] ;
163 char c40[40] ;
164 char c120[120] ;
165 // make sure file pointer points a beginning of the file
166 fseek( fp_, 0, SEEK_SET ) ;
167
168 // read data header
169 strcpy( c8, str8.c_str() ) ;
170 if ( readHeader( c8, 8 ) == -1 ) {
171 os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ;
172 return -1 ;
173 }
174 LOFIL = string( c8 ) ;
175 // DEBUG
176 //cout << "LOFIL = " << LOFIL << endl ;
177 //
178 strcpy( c8, str8.c_str() ) ;
179 if ( readHeader( c8, 8 ) == -1 ) {
180 os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ;
181 return -1 ;
182 }
183 VER = string( c8 ) ;
184 // DEBUG
185 //cout << "VER = " << VER << endl ;
186 //
187 strcpy( c16, str16.c_str() ) ;
188 if ( readHeader( c16, 16 ) == -1 ) {
189 os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ;
190 return -1 ;
191 }
192 GROUP = string( c16 ) ;
193 // DEBUG
194 //cout << "GROUP = " << GROUP << endl ;
195 //
196 strcpy( c16, str16.c_str() ) ;
197 if ( readHeader( c16, 16 ) == -1 ) {
198 os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ;
199 return -1 ;
200 }
201 PROJ = string( c16 ) ;
202 // DEBUG
203 //cout << "PROJ = " << PROJ << endl ;
204 //
205 strcpy( c24, str24.c_str() ) ;
206 if ( readHeader( c24, 24 ) == -1 ) {
207 os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ;
208 return -1 ;
209 }
210 SCHED = string( c24 ) ;
211 // DEBUG
212 //cout << "SCHED = " << SCHED << endl ;
213 //
214 strcpy( c40, str40.c_str() ) ;
215 if ( readHeader( c40, 40 ) == -1 ) {
216 os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ;
217 return -1 ;
218 }
219 OBSVR = string( c40 ) ;
220 // DEBUG
221 //cout << "OBSVR = " << OBSVR << endl ;
222 //
223 strcpy( c16, str16.c_str() ) ;
224 if ( readHeader( c16, 16 ) == -1 ) {
225 os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ;
226 return -1 ;
227 }
228 LOSTM = string( c16 ) ;
229 // DEBUG
230 //cout << "LOSTM = " << LOSTM << endl ;
231 //
232 strcpy( c16, str16.c_str() ) ;
233 if ( readHeader( c16, 16 ) == -1 ) {
234 os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ;
235 return -1 ;
236 }
237 LOETM = string( c16 ) ;
238 // DEBUG
239 //cout << "LOETM = " << LOETM << endl ;
240 //
241 if ( readHeader( ARYNM, sameEndian ) == -1 ) {
242 os << LogIO::WARN << "Error while reading data ARYNM." << LogIO::POST ;
243 return -1 ;
244 }
245 // DEBUG
246 //cout << "ARYNM = " << ARYNM << endl ;
247 //
248 if ( readHeader( NSCAN, sameEndian ) == -1 ) {
249 os << LogIO::WARN << "Error while reading data NSCAN." << LogIO::POST ;
250 return -1 ;
251 }
252 // DEBUG
253 //cout << "NSCAN = " << NSCAN << endl ;
254 //
255 strcpy( c120, str120.c_str() ) ;
256 if ( readHeader( c120, 120 ) == -1 ) {
257 os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ;
258 return -1 ;
259 }
260 TITLE = string( c120 ) ;
261 // DEBUG
262 //cout << "TITLE = " << TITLE << endl ;
263 //
264 strcpy( c16, str16.c_str() ) ;
265 if ( readHeader( c16, 16 ) == -1 ) {
266 os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ;
267 return -1 ;
268 }
269 OBJ = string( c16 ) ;
270 // DEBUG
271 //cout << "OBJ = " << OBJ << endl ;
272 //
273 strcpy( c8, str8.c_str() ) ;
274 if ( readHeader( c8, 8 ) == -1 ) {
275 os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ;
276 return -1 ;
277 }
278 EPOCH = string( c8 ) ;
279 // DEBUG
280 //cout << "EPOCH = " << EPOCH << endl ;
281 //
282 if ( readHeader( RA0, sameEndian ) == -1 ) {
283 os << LogIO::WARN << "Error while reading data RA0." << LogIO::POST ;
284 return -1 ;
285 }
286 // DEBUG
287 //cout << "RA0 = " << RA0 << endl ;
288 //
289 if ( readHeader( DEC0, sameEndian ) == -1 ) {
290 os << LogIO::WARN << "Error while reading data DEC0." << LogIO::POST ;
291 return -1 ;
292 }
293 // DEBUG
294 //cout << "DEC0 = " << DEC0 << endl ;
295 //
296 if ( readHeader( GLNG0, sameEndian ) == -1 ) {
297 os << LogIO::WARN << "Error while reading data GLNG0." << LogIO::POST ;
298 return -1 ;
299 }
300 // DEBUG
301 //cout << "GLNG0 = " << GLNG0 << endl ;
302 //
303 if ( readHeader( GLAT0, sameEndian ) == -1 ) {
304 os << LogIO::WARN << "Error while reading data GLAT0." << LogIO::POST ;
305 return -1 ;
306 }
307 // DEBUG
308 //cout << "GLAT0 = " << GLAT0 << endl ;
309 //
310 if ( readHeader( NCALB, sameEndian ) == -1 ) {
311 os << LogIO::WARN << "Error while reading data NCALB." << LogIO::POST ;
312 return -1 ;
313 }
314 // DEBUG
315 //cout << "NCALB = " << NCALB << endl ;
316 //
317 if ( readHeader( SCNCD, sameEndian ) == -1 ) {
318 os << LogIO::WARN << "Error while reading data SCNCD." << LogIO::POST ;
319 return -1 ;
320 }
321 // DEBUG
322 //cout << "SCNCD = " << SCNCD << endl ;
323 //
324 strcpy( c120, str120.c_str() ) ;
325 if ( readHeader( c120, 120 ) == -1 ) {
326 os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ;
327 return -1 ;
328 }
329 SCMOD = string( c120 ) ;
330 // DEBUG
331 //cout << "SCMOD = " << SCMOD << endl ;
332 //
333 if ( readHeader( URVEL, sameEndian ) == -1 ) {
334 os << LogIO::WARN << "Error while reading data URVEL." << LogIO::POST ;
335 return -1 ;
336 }
337 // DEBUG
338 //cout << "URVEL = " << URVEL << endl ;
339 //
340 strcpy( c4, str4.c_str() ) ;
341 if ( readHeader( c4, 4 ) == -1 ) {
342 os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ;
343 return -1 ;
344 }
345 VREF = string( c4 ) ;
346 // DEBUG
347 //cout << "VREF = " << VREF << endl ;
348 //
349 strcpy( c4, str4.c_str() ) ;
350 if ( readHeader( c4, 4 ) == -1 ) {
351 os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ;
352 return -1 ;
353 }
354 VDEF = string( c4 ) ;
355 // DEBUG
356 //cout << "VDEF = " << VDEF << endl ;
357 //
358 strcpy( c8, str8.c_str() ) ;
359 if ( readHeader( c8, 8 ) == -1 ) {
360 os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ;
361 return -1 ;
362 }
363 SWMOD = string( c8 ) + "::OTF" ;
364 // DEBUG
365 //cout << "SWMOD = " << SWMOD << endl ;
366 //
367 if ( readHeader( FRQSW, sameEndian ) == -1 ) {
368 os << LogIO::WARN << "Error while reading data FRQSW." << LogIO::POST ;
369 return -1 ;
370 }
371 // DEBUG
372 //cout << "FRQSW = " << FRQSW << endl ;
373 //
374 if ( readHeader( DBEAM, sameEndian ) == -1 ) {
375 os << LogIO::WARN << "Error while reading data DBEAM." << LogIO::POST ;
376 return -1 ;
377 }
378 // DEBUG
379 //cout << "DBEAM = " << DBEAM << endl ;
380 //
381 if ( readHeader( MLTOF, sameEndian ) == -1 ) {
382 os << LogIO::WARN << "Error while reading data MLTOF." << LogIO::POST ;
383 return -1 ;
384 }
385 // DEBUG
386 //cout << "MLTOF = " << MLTOF << endl ;
387 //
388 if ( readHeader( CMTQ, sameEndian ) == -1 ) {
389 os << LogIO::WARN << "Error while reading data CMTQ." << LogIO::POST ;
390 return -1 ;
391 }
392 // DEBUG
393 //cout << "CMTQ = " << CMTQ << endl ;
394 //
395 if ( readHeader( CMTE, sameEndian ) == -1 ) {
396 os << LogIO::WARN << "Error while reading data CMTE." << LogIO::POST ;
397 return -1 ;
398 }
399 // DEBUG
400 //cout << "CMTE = " << CMTE << endl ;
401 //
402 if ( readHeader( CMTSOM, sameEndian ) == -1 ) {
403 os << LogIO::WARN << "Error while reading data CMTSOM." << LogIO::POST ;
404 return -1 ;
405 }
406 // DEBUG
407 //cout << "CMTSOM = " << CMTSOM << endl ;
408 //
409 if ( readHeader( CMTNODE, sameEndian ) == -1 ) {
410 os << LogIO::WARN << "Error while reading data CMTNODE." << LogIO::POST ;
411 return -1 ;
412 }
413 // DEBUG
414 //cout << "CMTNODE = " << CMTNODE << endl ;
415 //
416 if ( readHeader( CMTI, sameEndian ) == -1 ) {
417 os << LogIO::WARN << "Error while reading data CMTI." << LogIO::POST ;
418 return -1 ;
419 }
420 // DEBUG
421 //cout << "CMTI = " << CMTI << endl ;
422 //
423 strcpy( c24, str24.c_str() ) ;
424 if ( readHeader( c24, 24 ) == -1 ) {
425 os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ;
426 return -1 ;
427 }
428 CMTTM = string( c24 ) ;
429 // DEBUG
430 //cout << "CMTTM = " << CMTTM << endl ;
431 //
432 if ( readHeader( SBDX, sameEndian ) == -1 ) {
433 os << LogIO::WARN << "Error while reading data SBDX." << LogIO::POST ;
434 return -1 ;
435 }
436 // DEBUG
437 //cout << "SBDX = " << SBDX << endl ;
438 //
439 if ( readHeader( SBDY, sameEndian ) == -1 ) {
440 os << LogIO::WARN << "Error while reading data SBDY." << LogIO::POST ;
441 return -1 ;
442 }
443 // DEBUG
444 //cout << "SBDY = " << SBDY << endl ;
445 //
446 if ( readHeader( SBDZ1, sameEndian ) == -1 ) {
447 os << LogIO::WARN << "Error while reading data SBDZ1." << LogIO::POST ;
448 return -1 ;
449 }
450 // DEBUG
451 //cout << "SBDZ1 = " << SBDZ1 << endl ;
452 //
453 if ( readHeader( SBDZ2, sameEndian ) == -1 ) {
454 os << LogIO::WARN << "Error while reading data SBDZ2." << LogIO::POST ;
455 return -1 ;
456 }
457 // DEBUG
458 //cout << "SBDZ2 = " << SBDZ2 << endl ;
459 //
460 if ( readHeader( DAZP, sameEndian ) == -1 ) {
461 os << LogIO::WARN << "Error while reading data DAZP." << LogIO::POST ;
462 return -1 ;
463 }
464 // DEBUG
465 //cout << "DAZP = " << DAZP << endl ;
466 //
467 if ( readHeader( DELP, sameEndian ) == -1 ) {
468 os << LogIO::WARN << "Error while reading data DELP." << LogIO::POST ;
469 return -1 ;
470 }
471 // DEBUG
472 //cout << "DELP = " << DELP << endl ;
473 //
474 if ( readHeader( CHBIND, sameEndian ) == -1 ) {
475 os << LogIO::WARN << "Error while reading data CHBIND." << LogIO::POST ;
476 return -1 ;
477 }
478 // DEBUG
479 //cout << "CHBIND = " << CHBIND << endl ;
480 //
481 if ( readHeader( NUMCH, sameEndian ) == -1 ) {
482 os << LogIO::WARN << "Error while reading data NUMCH." << LogIO::POST ;
483 return -1 ;
484 }
485 // DEBUG
486 //cout << "NUMCH = " << NUMCH << endl ;
487 //
488 if ( readHeader( CHMIN, sameEndian ) == -1 ) {
489 os << LogIO::WARN << "Error while reading data CHMIN." << LogIO::POST ;
490 return -1 ;
491 }
492 // DEBUG
493 //cout << "CHMIN = " << CHMIN << endl ;
494 //
495 if ( readHeader( CHMAX, sameEndian ) == -1 ) {
496 os << LogIO::WARN << "Error while reading data CHMAX." << LogIO::POST ;
497 return -1 ;
498 }
499 // DEBUG
500 //cout << "CHMAX = " << CHMAX << endl ;
501 //
502 if ( readHeader( ALCTM, sameEndian ) == -1 ) {
503 os << LogIO::WARN << "Error while reading data ALCTM." << LogIO::POST ;
504 return -1 ;
505 }
506 // DEBUG
507 //cout << "ALCTM = " << ALCTM << endl ;
508 //
509 if ( readHeader( IPTIM, sameEndian ) == -1 ) {
510 os << LogIO::WARN << "Error while reading data IPTIM." << LogIO::POST ;
511 return -1 ;
512 }
513 // DEBUG
514 //cout << "IPTIM = " << IPTIM << endl ;
515 //
516 if ( readHeader( PA, sameEndian ) == -1 ) {
517 os << LogIO::WARN << "Error while reading data PA." << LogIO::POST ;
518 return -1 ;
519 }
520 // DEBUG
521 //cout << "PA = " << PA << endl ;
522 //
523 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
524 strcpy( c18, str18.c_str() ) ;
525 if ( readHeader( c18, 16 ) == -1 ) {
526 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ;
527 return -1 ;
528 }
529 c18[16] = '\0' ;
530 RX[i] = string( c18 ) ;
531 // DEBUG
532// if ( i == 0 ) {
533// cout << "RX " ;
534// }
535// else if ( ( i % 5 ) == 0 ) {
536// cout << endl << " " ;
537// }
538// cout << RX[i] << " " ;
539 //
540 }
541 //cout << endl ;
542 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
543 if ( readHeader( HPBW[i], sameEndian ) == -1 ) {
544 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ;
545 return -1 ;
546 }
547 // DEBUG
548// if ( i == 0 ) {
549// cout << "HPBW " ;
550// }
551// else if ( ( i % 5 ) == 0 ) {
552// cout << endl << " " ;
553// }
554// cout << HPBW[i] << " " ;
555 //
556 }
557 //cout << endl ;
558 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
559 if ( readHeader( EFFA[i], sameEndian ) == -1 ) {
560 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ;
561 return -1 ;
562 }
563 // DEBUG
564// if ( i == 0 ) {
565// cout << "EFFA " ;
566// }
567// else if ( ( i % 5 ) == 0 ) {
568// cout << endl << " " ;
569// }
570// cout << EFFA[i] << " " ;
571 //
572 }
573 //cout << endl ;
574 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
575 if ( readHeader( EFFB[i], sameEndian ) == -1 ) {
576 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ;
577 return -1 ;
578 }
579 // DEBUG
580// if ( i == 0 ) {
581// cout << "EFFB " ;
582// }
583// else if ( ( i % 5 ) == 0 ) {
584// cout << endl << " " ;
585// }
586// cout << EFFB[i] << " " ;
587 //
588 }
589 //cout << endl ;
590 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
591 if ( readHeader( EFFL[i], sameEndian ) == -1 ) {
592 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ;
593 return -1 ;
594 }
595 // DEBUG
596// if ( i == 0 ) {
597// cout << "EFFL " ;
598// }
599// else if ( ( i % 5 ) == 0 ) {
600// cout << endl << " " ;
601// }
602// cout << EFFL[i] << " " ;
603 //
604 }
605 //cout << endl ;
606 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
607 if ( readHeader( EFSS[i], sameEndian ) == -1 ) {
608 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ;
609 return -1 ;
610 }
611 // DEBUG
612// if ( i == 0 ) {
613// cout << "EFSS " ;
614// }
615// else if ( ( i % 5 ) == 0 ) {
616// cout << endl << " " ;
617// }
618// cout << EFSS[i] << " " ;
619 //
620 }
621 //cout << endl ;
622 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
623 if ( readHeader( GAIN[i], sameEndian ) == -1 ) {
624 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ;
625 return -1 ;
626 }
627 // DEBUG
628// if ( i == 0 ) {
629// cout << "GAIN " ;
630// }
631// else if ( ( i % 5 ) == 0 ) {
632// cout << endl << " " ;
633// }
634// cout << GAIN[i] << " " ;
635 //
636 }
637 //cout << endl ;
638 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
639 strcpy( c4, str4.c_str() ) ;
640 if ( readHeader( c4, 4 ) == -1 ) {
641 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ;
642 return -1 ;
643 }
644 HORN[i] = string( c4 ) ;
645 // DEBUG
646// if ( i == 0 ) {
647// cout << "HORN " ;
648// }
649// else if ( ( i % 5 ) == 0 ) {
650// cout << endl << " " ;
651// }
652// cout << HORN[i] << " " ;
653 //
654 }
655 //cout << endl ;
656 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
657 strcpy( c4, str4.c_str() ) ;
658 if ( readHeader( c4, 4 ) == -1 ) {
659 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ;
660 return -1 ;
661 }
662 POLTP[i] = string( c4 ) ;
663 // DEBUG
664// if ( i == 0 ) {
665// cout << "POLTP " ;
666// }
667// else if ( ( i % 5 ) == 0 ) {
668// cout << endl << " " ;
669// }
670// cout << POLTP[i] << " " ;
671 //
672 }
673 //cout << endl ;
674 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
675 if ( readHeader( POLDR[i], sameEndian ) == -1 ) {
676 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ;
677 return -1 ;
678 }
679 // DEBUG
680// if ( i == 0 ) {
681// cout << "POLDR " ;
682// }
683// else if ( ( i % 5 ) == 0 ) {
684// cout << endl << " " ;
685// }
686// cout << POLDR[i] << " " ;
687 //
688 }
689 //cout << endl ;
690 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
691 if ( readHeader( POLAN[i], sameEndian ) == -1 ) {
692 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ;
693 return -1 ;
694 }
695 // DEBUG
696// if ( i == 0 ) {
697// cout << "POLAN " ;
698// }
699// else if ( ( i % 5 ) == 0 ) {
700// cout << endl << " " ;
701// }
702// cout << POLAN[i] << " " ;
703 //
704 }
705 //cout << endl ;
706 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
707 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) {
708 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ;
709 return -1 ;
710 }
711 // DEBUG
712// if ( i == 0 ) {
713// cout << "DFRQ " ;
714// }
715// else if ( ( i % 5 ) == 0 ) {
716// cout << endl << " " ;
717// }
718// cout << DFRQ[i] << " " ;
719 //
720 }
721 //cout << endl ;
722 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
723 strcpy( c4, str4.c_str() ) ;
724 if ( readHeader( c4, 4 ) == -1 ) {
725 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ;
726 return -1 ;
727 }
728 SIDBD[i] = string( c4 ) ;
729 // DEBUG
730// if ( i == 0 ) {
731// cout << "SIDBD " ;
732// }
733// else if ( ( i % 5 ) == 0 ) {
734// cout << endl << " " ;
735// }
736// cout << SIDBD[i] << " " ;
737 //
738 }
739 //cout << endl ;
740 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
741 if ( readHeader( REFN[i], sameEndian ) == -1 ) {
742 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ;
743 return -1 ;
744 }
745 // DEBUG
746// if ( i == 0 ) {
747// cout << "REFN " ;
748// }
749// else if ( ( i % 5 ) == 0 ) {
750// cout << endl << " " ;
751// }
752// cout << REFN[i] << " " ;
753 //
754 }
755 //cout << endl ;
756 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
757 if ( readHeader( IPINT[i], sameEndian ) == -1 ) {
758 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ;
759 return -1 ;
760 }
761 // DEBUG
762// if ( i == 0 ) {
763// cout << "IPINT " ;
764// }
765// else if ( ( i % 5 ) == 0 ) {
766// cout << endl << " " ;
767// }
768// cout << IPINT[i] << " " ;
769 //
770 }
771 //cout << endl ;
772 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
773 if ( readHeader( MULTN[i], sameEndian ) == -1 ) {
774 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ;
775 return -1 ;
776 }
777 // DEBUG
778// if ( i == 0 ) {
779// cout << "MULTN " ;
780// }
781// else if ( ( i % 5 ) == 0 ) {
782// cout << endl << " " ;
783// }
784// cout << MULTN[i] << " " ;
785 //
786 }
787 //cout << endl ;
788 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
789 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) {
790 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ;
791 return -1 ;
792 }
793 // DEBUG
794// if ( i == 0 ) {
795// cout << "MLTSCF " ;
796// }
797// else if ( ( i % 5 ) == 0 ) {
798// cout << endl << " " ;
799// }
800// cout << MLTSCF[i] << " " ;
801 //
802 }
803 //cout << endl ;
804 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
805 strcpy( c8, str8.c_str() ) ;
806 if ( readHeader( c8, 8 ) == -1 ) {
807 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ;
808 return -1 ;
809 }
810 LAGWIND[i] = string( c8 ) ;
811 // DEBUG
812// if ( i == 0 ) {
813// cout << "LAGWIND " ;
814// }
815// else if ( ( i % 5 ) == 0 ) {
816// cout << endl << " " ;
817// }
818// cout << LAGWIND[i] << " " ;
819 //
820 }
821 //cout << endl ;
822 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
823 if ( readHeader( BEBW[i], sameEndian ) == -1 ) {
824 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ;
825 return -1 ;
826 }
827 // DEBUG
828// if ( i == 0 ) {
829// cout << "BEBW " ;
830// }
831// else if ( ( i % 5 ) == 0 ) {
832// cout << endl << " " ;
833// }
834// cout << BEBW[i] << " " ;
835 //
836 }
837 //cout << endl ;
838 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
839 if ( readHeader( BERES[i], sameEndian ) == -1 ) {
840 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ;
841 return -1 ;
842 }
843 // DEBUG
844// if ( i == 0 ) {
845// cout << "BERES " ;
846// }
847// else if ( ( i % 5 ) == 0 ) {
848// cout << endl << " " ;
849// }
850// cout << BERES[i] << " " ;
851 //
852 }
853 //cout << endl ;
854 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
855 if ( readHeader( CHWID[i], sameEndian ) == -1 ) {
856 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ;
857 return -1 ;
858 }
859 // DEBUG
860// if ( i == 0 ) {
861// cout << "CHWID " ;
862// }
863// else if ( ( i % 5 ) == 0 ) {
864// cout << endl << " " ;
865// }
866// cout << CHWID[i] << " " ;
867 //
868 }
869 //cout << endl ;
870 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
871 if ( readHeader( ARRY[i], sameEndian ) == -1 ) {
872 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ;
873 return -1 ;
874 }
875 // DEBUG
876// if ( i == 0 ) {
877// cout << "ARRY " ;
878// }
879// else if ( ( i % 5 ) == 0 ) {
880// cout << endl << " " ;
881// }
882// cout << ARRY[i] << " " ;
883 //
884 }
885 //cout << endl ;
886 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
887 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) {
888 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ;
889 return -1 ;
890 }
891 // DEBUG
892// if ( i == 0 ) {
893// cout << "NFCAL " ;
894// }
895// else if ( ( i % 5 ) == 0 ) {
896// cout << endl << " " ;
897// }
898// cout << NFCAL[i] << " " ;
899 //
900 }
901 //cout << endl ;
902 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
903 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) {
904 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ;
905 return -1 ;
906 }
907 // DEBUG
908// if ( i == 0 ) {
909// cout << "F0CAL " ;
910// }
911// else if ( ( i % 5 ) == 0 ) {
912// cout << endl << " " ;
913// }
914// cout << F0CAL[i] << " " ;
915 //
916 }
917 //cout << endl ;
918 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
919 for ( int j = 0 ; j < 10 ; j++ ) {
920 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) {
921 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << LogIO::POST ;
922 return -1 ;
923 }
924 // DEBUG
925// if ( j == 0 ) {
926// if ( i < 10 )
927// cout << "FQCAL0" << i << " " ;
928// else
929// cout << "FQCAL" << i << " " ;
930// }
931// else if ( ( j % 5 ) == 0 ) {
932// cout << endl << " " ;
933// }
934// cout << FQCAL[i][j] << " " ;
935 //
936 }
937 //cout << endl ;
938 }
939 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
940 for ( int j = 0 ; j < 10 ; j++ ) {
941 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) {
942 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << LogIO::POST ;
943 return -1 ;
944 }
945 // DEBUG
946// if ( j == 0 ) {
947// if ( i < 10 )
948// cout << "CHCAL0" << i << " " ;
949// else
950// cout << "CHCAL" << i << " " ;
951// }
952// else if ( ( j % 5 ) == 0 ) {
953// cout << endl << " " ;
954// }
955// cout << CHCAL[i][j] << " " ;
956 //
957 }
958 //cout << endl ;
959 }
960 for ( int i= 0 ; i < ASTE_ARYMAX ; i++) {
961 for ( int j = 0 ; j < 10 ; j++ ) {
962 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) {
963 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << LogIO::POST ;
964 return -1 ;
965 }
966 // DEBUG
967// if ( j == 0 ) {
968// if ( i < 10 )
969// cout << "CWCAL0" << i << " " ;
970// else
971// cout << "CWCAL" << i << " " ;
972// }
973// else if ( ( j % 5 ) == 0 ) {
974// cout << endl << " " ;
975// }
976// cout << CWCAL[i][j] << " " ;
977 //
978 }
979 //cout << endl ;
980 }
981 if ( readHeader( SCNLEN, sameEndian ) == -1 ) {
982 os << LogIO::WARN << "Error while reading data SCNLEN." << LogIO::POST ;
983 return -1 ;
984 }
985 // DEBUG
986 //cout << "SCNLEN = " << SCNLEN << endl ;
987 //
988 if ( readHeader( SBIND, sameEndian ) == -1 ) {
989 os << LogIO::WARN << "Error while reading data SBIND." << LogIO::POST ;
990 return -1 ;
991 }
992 // DEBUG
993 //cout << "SBIND = " << SBIND << endl ;
994 //
995 if ( readHeader( IBIT, sameEndian ) == -1 ) {
996 os << LogIO::WARN << "Error while reading data IBIT." << LogIO::POST ;
997 return -1 ;
998 }
999 // DEBUG
1000 //cout << "IBIT = " << IBIT << endl ;
1001 //
1002 strcpy( c8, str8.c_str() ) ;
1003 if ( readHeader( c8, 8 ) == -1 ) {
1004 os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ;
1005 return -1 ;
1006 }
1007 SITE = string( c8 ) ;
1008 // DEBUG
1009 //cout << "SITE = " << SITE << endl ;
1010 //
1011 strcpy( c120, str120.c_str() ) ;
1012 if ( readHeader( c120, 116 ) == -1 ) {
1013 os << LogIO::WARN << "Error while reading data CDMY1." << LogIO::POST ;
1014 return -1 ;
1015 }
1016 c120[116] = '\0' ;
1017 CDMY1 = string( c120 ) ;
1018 // DEBUG
1019 //cout << "CDMY1 = " << CDMY1 << endl ;
1020 //
1021 for ( int i = 0 ; i < ASTE_ARYMAX ; i++ ) {
1022 if ( readHeader( DSBFC[i], sameEndian ) == -1 ) {
1023 os << LogIO::WARN << "Error while reading data DSBFC[" << i << "]." << LogIO::POST ;
1024 return -1 ;
1025 }
1026 // DEBUG
1027// if ( i == 0 ) {
1028// cout << "DSBFC " ;
1029// }
1030// else if ( ( i % 5 ) == 0 ) {
1031// cout << endl << " " ;
1032// }
1033// cout << DSBFC[i] << " " ;
1034 //
1035 }
1036 //cout << endl ;
1037
1038 scanNum_ = NSCAN + 1 ; // includes ZERO scan
1039 rowNum_ = scanNum_ * ARYNM ;
1040 scanLen_ = SCNLEN ;
1041 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;
1042 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;
1043 record_->LDATA = new char[dataLen_] ;
1044
1045 show() ;
1046
1047 return 0 ;
1048}
Note: See TracBrowser for help on using the repository browser.