source: trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc@ 1842

Last change on this file since 1842 was 1757, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


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