source: branches/hpc34/external-alma/atnf/PKSIO/NROOTFDataset.cc@ 2825

Last change on this file since 2825 was 2436, checked in by Takeshi Nakazato, 13 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): Module Names change impacts.

Description: Describe your changes here...

Defined template function for debug output.


File size: 24.5 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 refFreq_.resize( NRO_ARYMAX, 0.0 ) ;
132}
133
134// fill data header
135int NROOTFDataset::fillHeader()
136{
137 LogIO os( LogOrigin( "NROOTFDataset", "fillHeader()", WHERE ) ) ;
138
139 // open file
140 if ( open() ) {
141 os << LogIO::SEVERE << "Error opening file " << filename_ << "." << LogIO::EXCEPTION ;
142 return -1 ;
143 }
144
145 // fill
146 int status = fillHeader( same_ ) ;
147
148 return status ;
149}
150
151int NROOTFDataset::fillHeader( int sameEndian )
152{
153 LogIO os( LogOrigin( "NROOTFDataset", "fillHeader()", WHERE ) ) ;
154
155 string str4( 4, ' ' ) ;
156 string str8( 8, ' ' ) ;
157 string str16( 16, ' ' ) ;
158 string str18( 18, ' ' ) ;
159 string str24( 24, ' ' ) ;
160 string str40( 40, ' ' ) ;
161 string str120( 120, ' ' ) ;
162 string str256( 256, ' ' ) ;
163 char c4[4] ;
164 char c8[8] ;
165 char c16[16] ;
166 char c18[18] ;
167 char c24[24] ;
168 char c40[40] ;
169 char c120[120] ;
170 char c256[256] ;
171 // make sure file pointer points a beginning of the file
172 fseek( fp_, 0, SEEK_SET ) ;
173
174 // read data header
175 strcpy( c8, str8.c_str() ) ;
176 if ( readHeader( c8, 8 ) == -1 ) {
177 os << LogIO::WARN << "Error while reading data LOFIL." << LogIO::POST ;
178 return -1 ;
179 }
180 LOFIL = string( c8 ) ;
181 // DEBUG
182 //cout << "LOFIL = " << LOFIL << endl ;
183 //
184 strcpy( c8, str8.c_str() ) ;
185 if ( readHeader( c8, 8 ) == -1 ) {
186 os << LogIO::WARN << "Error while reading data VER." << LogIO::POST ;
187 return -1 ;
188 }
189 VER = string( c8 ) ;
190 // DEBUG
191 //cout << "VER = " << VER << endl ;
192 //
193 strcpy( c16, str16.c_str() ) ;
194 if ( readHeader( c16, 16 ) == -1 ) {
195 os << LogIO::WARN << "Error while reading data GROUP." << LogIO::POST ;
196 return -1 ;
197 }
198 GROUP = string( c16 ) ;
199 // DEBUG
200 //cout << "GROUP = " << GROUP << endl ;
201 //
202 strcpy( c16, str16.c_str() ) ;
203 if ( readHeader( c16, 16 ) == -1 ) {
204 os << LogIO::WARN << "Error while reading data PROJ." << LogIO::POST ;
205 return -1 ;
206 }
207 PROJ = string( c16 ) ;
208 // DEBUG
209 //cout << "PROJ = " << PROJ << endl ;
210 //
211 strcpy( c24, str24.c_str() ) ;
212 if ( readHeader( c24, 24 ) == -1 ) {
213 os << LogIO::WARN << "Error while reading data SCHED." << LogIO::POST ;
214 return -1 ;
215 }
216 SCHED = string( c24 ) ;
217 // DEBUG
218 //cout << "SCHED = " << SCHED << endl ;
219 //
220 strcpy( c40, str40.c_str() ) ;
221 if ( readHeader( c40, 40 ) == -1 ) {
222 os << LogIO::WARN << "Error while reading data OBSVR." << LogIO::POST ;
223 return -1 ;
224 }
225 OBSVR = string( c40 ) ;
226 // DEBUG
227 //cout << "OBSVR = " << OBSVR << endl ;
228 //
229 strcpy( c16, str16.c_str() ) ;
230 if ( readHeader( c16, 16 ) == -1 ) {
231 os << LogIO::WARN << "Error while reading data LOSTM." << LogIO::POST ;
232 return -1 ;
233 }
234 LOSTM = string( c16 ) ;
235 // DEBUG
236 //cout << "LOSTM = " << LOSTM << endl ;
237 //
238 strcpy( c16, str16.c_str() ) ;
239 if ( readHeader( c16, 16 ) == -1 ) {
240 os << LogIO::WARN << "Error while reading data LOETM." << LogIO::POST ;
241 return -1 ;
242 }
243 LOETM = string( c16 ) ;
244 // DEBUG
245 //cout << "LOETM = " << LOETM << endl ;
246 //
247 if ( readHeader( ARYNM, sameEndian ) == -1 ) {
248 os << LogIO::WARN << "Error while reading data ARYNM." << LogIO::POST ;
249 return -1 ;
250 }
251 // DEBUG
252 //cout << "ARYNM = " << ARYNM << endl ;
253 //
254 if ( readHeader( NSCAN, sameEndian ) == -1 ) {
255 os << LogIO::WARN << "Error while reading data NSCAN." << LogIO::POST ;
256 return -1 ;
257 }
258 // DEBUG
259 //cout << "NSCAN = " << NSCAN << endl ;
260 //
261 strcpy( c120, str120.c_str() ) ;
262 if ( readHeader( c120, 120 ) == -1 ) {
263 os << LogIO::WARN << "Error while reading data TITLE." << LogIO::POST ;
264 return -1 ;
265 }
266 TITLE = string( c120 ) ;
267 // DEBUG
268 //cout << "TITLE = " << TITLE << endl ;
269 //
270 strcpy( c16, str16.c_str() ) ;
271 if ( readHeader( c16, 16 ) == -1 ) {
272 os << LogIO::WARN << "Error while reading data OBJ." << LogIO::POST ;
273 return -1 ;
274 }
275 OBJ = string( c16 ) ;
276 // DEBUG
277 //cout << "OBJ = " << OBJ << endl ;
278 //
279 strcpy( c8, str8.c_str() ) ;
280 if ( readHeader( c8, 8 ) == -1 ) {
281 os << LogIO::WARN << "Error while reading data EPOCH." << LogIO::POST ;
282 return -1 ;
283 }
284 EPOCH = string( c8 ) ;
285 // DEBUG
286 //cout << "EPOCH = " << EPOCH << endl ;
287 //
288 if ( readHeader( RA0, sameEndian ) == -1 ) {
289 os << LogIO::WARN << "Error while reading data RA0." << LogIO::POST ;
290 return -1 ;
291 }
292 // DEBUG
293 //cout << "RA0 = " << RA0 << endl ;
294 //
295 if ( readHeader( DEC0, sameEndian ) == -1 ) {
296 os << LogIO::WARN << "Error while reading data DEC0." << LogIO::POST ;
297 return -1 ;
298 }
299 // DEBUG
300 //cout << "DEC0 = " << DEC0 << endl ;
301 //
302 if ( readHeader( GLNG0, sameEndian ) == -1 ) {
303 os << LogIO::WARN << "Error while reading data GLNG0." << LogIO::POST ;
304 return -1 ;
305 }
306 // DEBUG
307 //cout << "GLNG0 = " << GLNG0 << endl ;
308 //
309 if ( readHeader( GLAT0, sameEndian ) == -1 ) {
310 os << LogIO::WARN << "Error while reading data GLAT0." << LogIO::POST ;
311 return -1 ;
312 }
313 // DEBUG
314 //cout << "GLAT0 = " << GLAT0 << endl ;
315 //
316 if ( readHeader( NCALB, sameEndian ) == -1 ) {
317 os << LogIO::WARN << "Error while reading data NCALB." << LogIO::POST ;
318 return -1 ;
319 }
320 // DEBUG
321 //cout << "NCALB = " << NCALB << endl ;
322 //
323 if ( readHeader( SCNCD, sameEndian ) == -1 ) {
324 os << LogIO::WARN << "Error while reading data SCNCD." << LogIO::POST ;
325 return -1 ;
326 }
327 // DEBUG
328 //cout << "SCNCD = " << SCNCD << endl ;
329 //
330 strcpy( c120, str120.c_str() ) ;
331 if ( readHeader( c120, 120 ) == -1 ) {
332 os << LogIO::WARN << "Error while reading data SCMOD." << LogIO::POST ;
333 return -1 ;
334 }
335 SCMOD = string( c120 ) ;
336 // DEBUG
337 //cout << "SCMOD = " << SCMOD << endl ;
338 //
339 if ( readHeader( URVEL, sameEndian ) == -1 ) {
340 os << LogIO::WARN << "Error while reading data URVEL." << LogIO::POST ;
341 return -1 ;
342 }
343 // DEBUG
344 //cout << "URVEL = " << URVEL << endl ;
345 //
346 strcpy( c4, str4.c_str() ) ;
347 if ( readHeader( c4, 4 ) == -1 ) {
348 os << LogIO::WARN << "Error while reading data VREF." << LogIO::POST ;
349 return -1 ;
350 }
351 VREF = string( c4 ) ;
352 // DEBUG
353 //cout << "VREF = " << VREF << endl ;
354 //
355 strcpy( c4, str4.c_str() ) ;
356 if ( readHeader( c4, 4 ) == -1 ) {
357 os << LogIO::WARN << "Error while reading data VDEF." << LogIO::POST ;
358 return -1 ;
359 }
360 VDEF = string( c4 ) ;
361 // DEBUG
362 //cout << "VDEF = " << VDEF << endl ;
363 //
364 strcpy( c8, str8.c_str() ) ;
365 if ( readHeader( c8, 8 ) == -1 ) {
366 os << LogIO::WARN << "Error while reading data SWMOD." << LogIO::POST ;
367 return -1 ;
368 }
369 SWMOD = string( c8 ) + "::OTF" ;
370 // DEBUG
371 //cout << "SWMOD = " << SWMOD << endl ;
372 //
373 if ( readHeader( FRQSW, sameEndian ) == -1 ) {
374 os << LogIO::WARN << "Error while reading data FRQSW." << LogIO::POST ;
375 return -1 ;
376 }
377 // DEBUG
378 //cout << "FRQSW = " << FRQSW << endl ;
379 //
380 if ( readHeader( DBEAM, sameEndian ) == -1 ) {
381 os << LogIO::WARN << "Error while reading data DBEAM." << LogIO::POST ;
382 return -1 ;
383 }
384 // DEBUG
385 //cout << "DBEAM = " << DBEAM << endl ;
386 //
387 if ( readHeader( MLTOF, sameEndian ) == -1 ) {
388 os << LogIO::WARN << "Error while reading data MLTOF." << LogIO::POST ;
389 return -1 ;
390 }
391 // DEBUG
392 //cout << "MLTOF = " << MLTOF << endl ;
393 //
394 if ( readHeader( CMTQ, sameEndian ) == -1 ) {
395 os << LogIO::WARN << "Error while reading data CMTQ." << LogIO::POST ;
396 return -1 ;
397 }
398 // DEBUG
399 //cout << "CMTQ = " << CMTQ << endl ;
400 //
401 if ( readHeader( CMTE, sameEndian ) == -1 ) {
402 os << LogIO::WARN << "Error while reading data CMTE." << LogIO::POST ;
403 return -1 ;
404 }
405 // DEBUG
406 //cout << "CMTE = " << CMTE << endl ;
407 //
408 if ( readHeader( CMTSOM, sameEndian ) == -1 ) {
409 os << LogIO::WARN << "Error while reading data CMTSOM." << LogIO::POST ;
410 return -1 ;
411 }
412 // DEBUG
413 //cout << "CMTSOM = " << CMTSOM << endl ;
414 //
415 if ( readHeader( CMTNODE, sameEndian ) == -1 ) {
416 os << LogIO::WARN << "Error while reading data CMTNODE." << LogIO::POST ;
417 return -1 ;
418 }
419 // DEBUG
420 //cout << "CMTNODE = " << CMTNODE << endl ;
421 //
422 if ( readHeader( CMTI, sameEndian ) == -1 ) {
423 os << LogIO::WARN << "Error while reading data CMTI." << LogIO::POST ;
424 return -1 ;
425 }
426 // DEBUG
427 //cout << "CMTI = " << CMTI << endl ;
428 //
429 strcpy( c24, str24.c_str() ) ;
430 if ( readHeader( c24, 24 ) == -1 ) {
431 os << LogIO::WARN << "Error while reading data CMTTM." << LogIO::POST ;
432 return -1 ;
433 }
434 CMTTM = string( c24 ) ;
435 // DEBUG
436 //cout << "CMTTM = " << CMTTM << endl ;
437 //
438 if ( readHeader( SBDX, sameEndian ) == -1 ) {
439 os << LogIO::WARN << "Error while reading data SBDX." << LogIO::POST ;
440 return -1 ;
441 }
442 // DEBUG
443 //cout << "SBDX = " << SBDX << endl ;
444 //
445 if ( readHeader( SBDY, sameEndian ) == -1 ) {
446 os << LogIO::WARN << "Error while reading data SBDY." << LogIO::POST ;
447 return -1 ;
448 }
449 // DEBUG
450 //cout << "SBDY = " << SBDY << endl ;
451 //
452 if ( readHeader( SBDZ1, sameEndian ) == -1 ) {
453 os << LogIO::WARN << "Error while reading data SBDZ1." << LogIO::POST ;
454 return -1 ;
455 }
456 // DEBUG
457 //cout << "SBDZ1 = " << SBDZ1 << endl ;
458 //
459 if ( readHeader( SBDZ2, sameEndian ) == -1 ) {
460 os << LogIO::WARN << "Error while reading data SBDZ2." << LogIO::POST ;
461 return -1 ;
462 }
463 // DEBUG
464 //cout << "SBDZ2 = " << SBDZ2 << endl ;
465 //
466 if ( readHeader( DAZP, sameEndian ) == -1 ) {
467 os << LogIO::WARN << "Error while reading data DAZP." << LogIO::POST ;
468 return -1 ;
469 }
470 // DEBUG
471 //cout << "DAZP = " << DAZP << endl ;
472 //
473 if ( readHeader( DELP, sameEndian ) == -1 ) {
474 os << LogIO::WARN << "Error while reading data DELP." << LogIO::POST ;
475 return -1 ;
476 }
477 // DEBUG
478 //cout << "DELP = " << DELP << endl ;
479 //
480 if ( readHeader( CHBIND, sameEndian ) == -1 ) {
481 os << LogIO::WARN << "Error while reading data CHBIND." << LogIO::POST ;
482 return -1 ;
483 }
484 // DEBUG
485 //cout << "CHBIND = " << CHBIND << endl ;
486 //
487 if ( readHeader( NUMCH, sameEndian ) == -1 ) {
488 os << LogIO::WARN << "Error while reading data NUMCH." << LogIO::POST ;
489 return -1 ;
490 }
491 // DEBUG
492 //cout << "NUMCH = " << NUMCH << endl ;
493 //
494 if ( readHeader( CHMIN, sameEndian ) == -1 ) {
495 os << LogIO::WARN << "Error while reading data CHMIN." << LogIO::POST ;
496 return -1 ;
497 }
498 // DEBUG
499 //cout << "CHMIN = " << CHMIN << endl ;
500 //
501 if ( readHeader( CHMAX, sameEndian ) == -1 ) {
502 os << LogIO::WARN << "Error while reading data CHMAX." << LogIO::POST ;
503 return -1 ;
504 }
505 // DEBUG
506 //cout << "CHMAX = " << CHMAX << endl ;
507 //
508 if ( readHeader( ALCTM, sameEndian ) == -1 ) {
509 os << LogIO::WARN << "Error while reading data ALCTM." << LogIO::POST ;
510 return -1 ;
511 }
512 // DEBUG
513 //cout << "ALCTM = " << ALCTM << endl ;
514 //
515 if ( readHeader( IPTIM, sameEndian ) == -1 ) {
516 os << LogIO::WARN << "Error while reading data IPTIM." << LogIO::POST ;
517 return -1 ;
518 }
519 // DEBUG
520 //cout << "IPTIM = " << IPTIM << endl ;
521 //
522 if ( readHeader( PA, sameEndian ) == -1 ) {
523 os << LogIO::WARN << "Error while reading data PA." << LogIO::POST ;
524 return -1 ;
525 }
526 // DEBUG
527 //cout << "PA = " << PA << endl ;
528 //
529 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
530 strcpy( c18, str18.c_str() ) ;
531 if ( readHeader( c18, 16 ) == -1 ) {
532 os << LogIO::WARN << "Error while reading data RX[" << i << "]." << LogIO::POST ;
533 return -1 ;
534 }
535 c18[16] = '\0' ;
536 RX[i] = string( c18 ) ;
537 }
538 // DEBUG
539// nro_debug_output( "RX", NRO_ARYMAX, RX ) ;
540 //
541 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
542 if ( readHeader( HPBW[i], sameEndian ) == -1 ) {
543 os << LogIO::WARN << "Error while reading data HPBW[" << i << "]." << LogIO::POST ;
544 return -1 ;
545 }
546 }
547 // DEBUG
548// nro_debug_output( "HPBW", NRO_ARYMAX, HPBW ) ;
549 //
550 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
551 if ( readHeader( EFFA[i], sameEndian ) == -1 ) {
552 os << LogIO::WARN << "Error while reading data EFFA[" << i << "]." << LogIO::POST ;
553 return -1 ;
554 }
555 }
556 // DEBUG
557// nro_debug_output( "EFFA", NRO_ARYMAX, EFFA ) ;
558 //
559 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
560 if ( readHeader( EFFB[i], sameEndian ) == -1 ) {
561 os << LogIO::WARN << "Error while reading data EFFB[" << i << "]." << LogIO::POST ;
562 return -1 ;
563 }
564 }
565 // DEBUG
566// nro_debug_output( "EFFB", NRO_ARYMAX, EFFB ) ;
567 //
568 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
569 if ( readHeader( EFFL[i], sameEndian ) == -1 ) {
570 os << LogIO::WARN << "Error while reading data EFFL[" << i << "]." << LogIO::POST ;
571 return -1 ;
572 }
573 }
574 // DEBUG
575// nro_debug_output( "EFFL", NRO_ARYMAX, EFFL ) ;
576 //
577 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
578 if ( readHeader( EFSS[i], sameEndian ) == -1 ) {
579 os << LogIO::WARN << "Error while reading data EFSS[" << i << "]." << LogIO::POST ;
580 return -1 ;
581 }
582 }
583 // DEBUG
584// nro_debug_output( "EFSS", NRO_ARYMAX, EFSS ) ;
585 //
586 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
587 if ( readHeader( GAIN[i], sameEndian ) == -1 ) {
588 os << LogIO::WARN << "Error while reading data GAIN[" << i << "]." << LogIO::POST ;
589 return -1 ;
590 }
591 }
592 // DEBUG
593// nro_debug_output( "GAIN", NRO_ARYMAX, GAIN ) ;
594 //
595 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
596 strcpy( c4, str4.c_str() ) ;
597 if ( readHeader( c4, 4 ) == -1 ) {
598 os << LogIO::WARN << "Error while reading data HORN[" << i << "]." << LogIO::POST ;
599 return -1 ;
600 }
601 HORN[i] = string( c4 ) ;
602 }
603 // DEBUG
604// nro_debug_output( "HORN", NRO_ARYMAX, HORN ) ;
605 //
606 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
607 strcpy( c4, str4.c_str() ) ;
608 if ( readHeader( c4, 4 ) == -1 ) {
609 os << LogIO::WARN << "Error while reading data POLTP[" << i << "]." << LogIO::POST ;
610 return -1 ;
611 }
612 POLTP[i] = string( c4 ) ;
613 }
614 // DEBUG
615// nro_debug_output( "POLTP", NRO_ARYMAX, POLTP ) ;
616 //
617 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
618 if ( readHeader( POLDR[i], sameEndian ) == -1 ) {
619 os << LogIO::WARN << "Error while reading data POLDR[" << i << "]." << LogIO::POST ;
620 return -1 ;
621 }
622 }
623 // DEBUG
624// nro_debug_output( "POLDR", NRO_ARYMAX, POLDR ) ;
625 //
626 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
627 if ( readHeader( POLAN[i], sameEndian ) == -1 ) {
628 os << LogIO::WARN << "Error while reading data POLAN[" << i << "]." << LogIO::POST ;
629 return -1 ;
630 }
631 }
632 // DEBUG
633// nro_debug_output( "POLAN", NRO_ARYMAX, POLAN ) ;
634 //
635 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
636 if ( readHeader( DFRQ[i], sameEndian ) == -1 ) {
637 os << LogIO::WARN << "Error while reading data DFRQ[" << i << "]." << LogIO::POST ;
638 return -1 ;
639 }
640 }
641 // DEBUG
642// nro_debug_output( "DFRQ", NRO_ARYMAX, DFRQ ) ;
643 //
644 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
645 strcpy( c4, str4.c_str() ) ;
646 if ( readHeader( c4, 4 ) == -1 ) {
647 os << LogIO::WARN << "Error while reading data SIDBD[" << i << "]." << LogIO::POST ;
648 return -1 ;
649 }
650 SIDBD[i] = string( c4 ) ;
651 }
652 // DEBUG
653// nro_debug_output( "SIDBD", NRO_ARYMAX, SIDBD ) ;
654 //
655 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
656 if ( readHeader( REFN[i], sameEndian ) == -1 ) {
657 os << LogIO::WARN << "Error while reading data REFN[" << i << "]." << LogIO::POST ;
658 return -1 ;
659 }
660 }
661 // DEBUG
662// nro_debug_output( "REFN", NRO_ARYMAX, REFN ) ;
663 //
664 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
665 if ( readHeader( IPINT[i], sameEndian ) == -1 ) {
666 os << LogIO::WARN << "Error while reading data IPINT[" << i << "]." << LogIO::POST ;
667 return -1 ;
668 }
669 }
670 // DEBUG
671// nro_debug_output( "IPINT", NRO_ARYMAX, IPINT ) ;
672 //
673 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
674 if ( readHeader( MULTN[i], sameEndian ) == -1 ) {
675 os << LogIO::WARN << "Error while reading data MULTN[" << i << "]." << LogIO::POST ;
676 return -1 ;
677 }
678 }
679 // DEBUG
680// nro_debug_output( "MULTN", NRO_ARYMAX, MULTN ) ;
681 //
682 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
683 if ( readHeader( MLTSCF[i], sameEndian ) == -1 ) {
684 os << LogIO::WARN << "Error while reading data MLTSCF[" << i << "]." << LogIO::POST ;
685 return -1 ;
686 }
687 }
688 // DEBUG
689// nro_debug_output( "MLTSCF", NRO_ARYMAX, MLTSCF ) ;
690 //
691 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
692 strcpy( c8, str8.c_str() ) ;
693 if ( readHeader( c8, 8 ) == -1 ) {
694 os << LogIO::WARN << "Error while reading data LAGWIND[" << i << "]." << LogIO::POST ;
695 return -1 ;
696 }
697 LAGWIND[i] = string( c8 ) ;
698 }
699 // DEBUG
700// nro_debug_output( "LAGWIND", NRO_ARYMAX, LAGWIND ) ;
701 //
702 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
703 if ( readHeader( BEBW[i], sameEndian ) == -1 ) {
704 os << LogIO::WARN << "Error while reading data BEBW[" << i << "]." << LogIO::POST ;
705 return -1 ;
706 }
707 }
708 // DEBUG
709// nro_debug_output( "BEBW", NRO_ARYMAX, BEBW ) ;
710 //
711 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
712 if ( readHeader( BERES[i], sameEndian ) == -1 ) {
713 os << LogIO::WARN << "Error while reading data BERES[" << i << "]." << LogIO::POST ;
714 return -1 ;
715 }
716 }
717 // DEBUG
718// nro_debug_output( "BERES", NRO_ARYMAX, BERES ) ;
719 //
720 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
721 if ( readHeader( CHWID[i], sameEndian ) == -1 ) {
722 os << LogIO::WARN << "Error while reading data CHWID[" << i << "]." << LogIO::POST ;
723 return -1 ;
724 }
725 }
726 // DEBUG
727// nro_debug_output( "CHWID", NRO_ARYMAX, CHWID ) ;
728 //
729 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
730 if ( readHeader( ARRY[i], sameEndian ) == -1 ) {
731 os << LogIO::WARN << "Error while reading data ARRY[" << i << "]." << LogIO::POST ;
732 return -1 ;
733 }
734 }
735 // DEBUG
736// nro_debug_output( "ARRY", NRO_ARYMAX, ARRY ) ;
737 //
738 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
739 if ( readHeader( NFCAL[i], sameEndian ) == -1 ) {
740 os << LogIO::WARN << "Error while reading data NFCAL[" << i << "]." << LogIO::POST ;
741 return -1 ;
742 }
743 }
744 // DEBUG
745// nro_debug_output( "NFCAL", NRO_ARYMAX, NFCAL ) ;
746 //
747 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
748 if ( readHeader( F0CAL[i], sameEndian ) == -1 ) {
749 os << LogIO::WARN << "Error while reading data F0CAL[" << i << "]." << LogIO::POST ;
750 return -1 ;
751 }
752 }
753 // DEBUG
754// nro_debug_output( "F0CAL", NRO_ARYMAX, F0CAL ) ;
755 //
756 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
757 for ( int j = 0 ; j < 10 ; j++ ) {
758 if ( readHeader( FQCAL[i][j], sameEndian ) == -1 ) {
759 os << LogIO::WARN << "Error while reading data FQCAL[" << i << "][" << j << "]." << LogIO::POST ;
760 return -1 ;
761 }
762 }
763 }
764 // DEBUG
765// nro_debug_output( "FQCAL", NRO_ARYMAX, 10, FQCAL ) ;
766 //
767 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
768 for ( int j = 0 ; j < 10 ; j++ ) {
769 if ( readHeader( CHCAL[i][j], sameEndian ) == -1 ) {
770 os << LogIO::WARN << "Error while reading data CHCAL[" << i << "][" << j << "]." << LogIO::POST ;
771 return -1 ;
772 }
773 }
774 }
775 // DEBUG
776// nro_debug_output( "CHCAL", NRO_ARYMAX, 10, CHCAL ) ;
777 //
778 for ( int i = 0 ; i < NRO_ARYMAX ; i++) {
779 for ( int j = 0 ; j < 10 ; j++ ) {
780 if ( readHeader( CWCAL[i][j], sameEndian ) == -1 ) {
781 os << LogIO::WARN << "Error while reading data CWCAL[" << i << "][" << j << "]." << LogIO::POST ;
782 return -1 ;
783 }
784 }
785 }
786 // DEBUG
787// nro_debug_output( "CWCAL", NRO_ARYMAX, 10, CWCAL ) ;
788 //
789 if ( readHeader( SCNLEN, sameEndian ) == -1 ) {
790 os << LogIO::WARN << "Error while reading data SCNLEN." << LogIO::POST ;
791 return -1 ;
792 }
793 // DEBUG
794 //cout << "SCNLEN = " << SCNLEN << endl ;
795 //
796 if ( readHeader( SBIND, sameEndian ) == -1 ) {
797 os << LogIO::WARN << "Error while reading data SBIND." << LogIO::POST ;
798 return -1 ;
799 }
800 // DEBUG
801 //cout << "SBIND = " << SBIND << endl ;
802 //
803 if ( readHeader( IBIT, sameEndian ) == -1 ) {
804 os << LogIO::WARN << "Error while reading data IBIT." << LogIO::POST ;
805 return -1 ;
806 }
807 // DEBUG
808 //cout << "IBIT = " << IBIT << endl ;
809 //
810 strcpy( c8, str8.c_str() ) ;
811 if ( readHeader( c8, 8 ) == -1 ) {
812 os << LogIO::WARN << "Error while reading data SITE." << LogIO::POST ;
813 return -1 ;
814 }
815 SITE = string( c8 ) ;
816 // DEBUG
817 //cout << "SITE = " << SITE << endl ;
818 //
819 strcpy( c256, str256.c_str() ) ;
820 if ( readHeader( c256, 180 ) == -1 ) {
821 os << LogIO::WARN << "Error while reading data CDMY1." << LogIO::POST ;
822 return -1 ;
823 }
824 c256[180] = '\0' ;
825 CDMY1 = string( c256 ) ;
826 // DEBUG
827 //cout << "CDMY1 = " << CDMY1 << endl ;
828 //
829
830 scanNum_ = NSCAN + 1 ; // includes ZERO scan
831 rowNum_ = scanNum_ * ARYNM ;
832 scanLen_ = SCNLEN ;
833 dataLen_ = scanLen_ - SCAN_HEADER_SIZE ;
834 chmax_ = (int) ( dataLen_ * 8 / IBIT ) ;
835 record_->LDATA = new char[dataLen_] ;
836
837 show() ;
838
839 return 0 ;
840}
841
Note: See TracBrowser for help on using the repository browser.