source: trunk/external-alma/atnf/PKSIO/NROReader.cc@ 2240

Last change on this file since 2240 was 2201, checked in by Takeshi Nakazato, 13 years ago

New Development: No

JIRA Issue: Yes CAS-2819

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...

IFNO is taken from ARRAY number.
Bug fix on checking if spectrometer is AOS or not.


File size: 21.6 KB
RevLine 
[1757]1//#---------------------------------------------------------------------------
2//# NROReader.cc: Base class for NRO headerdata.
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/NROReader.h>
34#include <atnf/PKSIO/NRO45Reader.h>
35#include <atnf/PKSIO/ASTEReader.h>
36#include <atnf/PKSIO/ASTEFXReader.h>
37#include <atnf/PKSIO/NRO45FITSReader.h>
38#include <atnf/PKSIO/NROOTFDataset.h>
39#include <atnf/PKSIO/ASTEDataset.h>
40
[2200]41#include <measures/Measures/MEpoch.h>
42#include <measures/Measures/MPosition.h>
[1757]43#include <measures/Measures/MDirection.h>
44#include <measures/Measures/MCDirection.h>
[2200]45#include <measures/Measures/MeasFrame.h>
[1757]46#include <measures/Measures/MeasConvert.h>
47
48#include <casa/IO/RegularFileIO.h>
49#include <casa/OS/File.h>
50#include <casa/OS/Time.h>
51
52#include <stdio.h>
53#include <string>
54#include <iomanip>
55
56using namespace std ;
57
58//
59// getNROReader
60//
61// Return an appropriate NROReader for a NRO 45m and ASTE dataset.
62//
63NROReader *getNROReader( const String filename,
64 String &datatype )
65{
66 LogIO os( LogOrigin( "", "getNROReader()", WHERE ) ) ;
67
68 // Check accessibility of the input.
69 File inFile( filename ) ;
70 if ( !inFile.exists() ) {
71 datatype = filename + " not found." ;
72 return 0 ;
73 }
74
75 if ( !inFile.isReadable() ) {
76 datatype = filename + " is not readable." ;
77 return 0 ;
78 }
79
80 // Determine the type of input.
81 NROReader *reader = 0;
82 if ( inFile.isRegular() ) {
83 FILE *file ;
84 file = fopen( filename.c_str(), "r" ) ;
85 // read LOFIL0
86 char buf[9];
87 fread( buf, 4, 1, file ) ;
88 buf[4] = '\0' ;
89 // DEBUG
90 //os << LogIO::NORMAL << "getNROReader:: buf = " << String(buf) << LogIO::POST ;
91 //
92 if ( string( buf ) == "XTEN" ) {
93 // FITS data
94 datatype = "NRO 45m FITS" ;
95 reader = new NRO45FITSReader( filename ) ;
96 }
97 else if ( string( buf ) == "RW-F") {
98 // ASTE-FX data
99 datatype = "ASTE-FX";
100 reader = new ASTEFXReader( filename );
101 } else {
102 // otherwise, read SITE0
103 NRODataset *d = new NROOTFDataset( filename ) ;
104 int size = d->getDataSize() - 188 ;
105 delete d ;
106 fseek( file, size, SEEK_SET ) ;
107 fread( buf, 8, 1, file ) ;
108 buf[8] = '\0' ;
109 // DEBUG
110 //cout << "getNROReader:: buf = " << buf << endl ;
111 //
112 if ( string( buf ) == "NRO" ) {
113 // NRO 45m data
114 datatype = "NRO 45m OTF" ;
115 reader = new NRO45Reader( filename );
116 }
117 else {
118 d = new ASTEDataset( filename ) ;
119 size = d->getDataSize() - 188 ;
120 delete d ;
121 fseek( file, size, SEEK_SET ) ;
122 fread( buf, 8, 1, file ) ;
123 buf[8] = '\0' ;
124 // DEBUG
125 //cout << "getNROReader:: buf = " << buf << endl ;
126 //
127 if ( string( buf ) == "ASTE" ) {
128 // ASTE data
129 datatype = "ASTE" ;
130 reader = new ASTEReader( filename ) ;
131 }
132 else {
133 datatype = "UNRECOGNIZED INPUT FORMAT";
134 }
135 }
136 }
137 fclose( file ) ;
138 } else {
139 datatype = "UNRECOGNIZED INPUT FORMAT";
140 }
141
142 // DEBUG
143 os << LogIO::NORMAL << "Data format of " << filename << ": " << datatype << LogIO::POST ;
144 //
145
146 // return reader if exists
147 if ( reader ) {
148 reader->read() ;
149 return reader ;
150 }
151
152 return 0 ;
153}
154
155
156//
157// getNROReader
158//
159// Search a list of directories for a NRO 45m and ASTE dataset and return an
160// appropriate NROReader for it.
161//
162NROReader* getNROReader( const String name,
163 const Vector<String> directories,
164 int &iDir,
165 String &datatype )
166{
167 int nDir = directories.size();
168 for ( iDir = 0; iDir < nDir; iDir++ ) {
169 string inName = directories[iDir] + "/" + name;
170 NROReader *reader = getNROReader( inName, datatype ) ;
171
172 if (reader != 0) {
173 return reader;
174 }
175 }
176
177 iDir = -1;
178 return 0;
179}
180
181
182//----------------------------------------------------------------------
183// constructor
184NROReader::NROReader( string name ) {
185 // initialization
186 filename_ = name ;
187 dataset_ = NULL ;
188}
189
190// destructor
191NROReader::~NROReader()
192{
193 if ( dataset_ != NULL ) {
194 delete dataset_ ;
195 dataset_ = NULL ;
196 }
197}
198
199// get spectrum
200vector< vector<double> > NROReader::getSpectrum()
201{
202 return dataset_->getSpectrum() ;
203}
204
205Int NROReader::getPolarizationNum()
206{
207 return dataset_->getPolarizationNum() ;
208}
209
210double NROReader::getStartTime()
211{
212 //char *startTime = dataset_->getLOSTM() ;
213 string startTime = dataset_->getLOSTM() ;
214 //cout << "getStartTime() startTime = " << startTime << endl ;
215 return getMJD( startTime ) ;
216}
217
218double NROReader::getEndTime()
219{
220 //char *endTime = dataset_->getLOETM() ;
221 string endTime = dataset_->getLOETM() ;
222 return getMJD( endTime ) ;
223}
224
225vector<double> NROReader::getStartIntTime()
226{
227 return dataset_->getStartIntTime() ;
228}
229
230double NROReader::getMJD( char *time )
231{
232 // TODO: should be checked which time zone the time depends on
233 // 2008/11/14 Takeshi Nakazato
234 string strStartTime = string( time ) ;
235 string strYear = strStartTime.substr( 0, 4 ) ;
236 string strMonth = strStartTime.substr( 4, 2 ) ;
237 string strDay = strStartTime.substr( 6, 2 ) ;
238 string strHour = strStartTime.substr( 8, 2 ) ;
239 string strMinute = strStartTime.substr( 10, 2 ) ;
240 string strSecond = strStartTime.substr( 12, strStartTime.size() - 12 ) ;
241 uInt year = atoi( strYear.c_str() ) ;
242 uInt month = atoi( strMonth.c_str() ) ;
243 uInt day = atoi( strDay.c_str() ) ;
244 uInt hour = atoi( strHour.c_str() ) ;
245 uInt minute = atoi( strMinute.c_str() ) ;
246 double second = atof( strSecond.c_str() ) ;
247 Time t( year, month, day, hour, minute, second ) ;
248
249 return t.modifiedJulianDay() ;
250}
251
252double NROReader::getMJD( string strStartTime )
253{
254 // TODO: should be checked which time zone the time depends on
255 // 2008/11/14 Takeshi Nakazato
256 string strYear = strStartTime.substr( 0, 4 ) ;
257 string strMonth = strStartTime.substr( 4, 2 ) ;
258 string strDay = strStartTime.substr( 6, 2 ) ;
259 string strHour = strStartTime.substr( 8, 2 ) ;
260 string strMinute = strStartTime.substr( 10, 2 ) ;
261 string strSecond = strStartTime.substr( 12, strStartTime.size() - 12 ) ;
262 uInt year = atoi( strYear.c_str() ) ;
263 uInt month = atoi( strMonth.c_str() ) ;
264 uInt day = atoi( strDay.c_str() ) ;
265 uInt hour = atoi( strHour.c_str() ) ;
266 uInt minute = atoi( strMinute.c_str() ) ;
267 double second = atof( strSecond.c_str() ) ;
268 Time t( year, month, day, hour, minute, second ) ;
269
270 return t.modifiedJulianDay() ;
271}
272
273vector<Bool> NROReader::getIFs()
274{
275 return dataset_->getIFs() ;
276}
277
278vector<Bool> NROReader::getBeams()
279{
280 vector<Bool> v ;
281 vector<int> arry = dataset_->getARRY() ;
282 for ( uInt i = 0 ; i < arry.size() ; i++ ) {
283 if ( arry[i] != 0 ) {
284 v.push_back( True ) ;
285 }
286 }
287
288 // DEBUG
289 //cout << "NROReader::getBeams() number of beam is " << v.size() << endl ;
290 //
291
292 return v ;
293}
294
295// Get SRCDIRECTION in RADEC(J2000)
296Vector<Double> NROReader::getSourceDirection()
297{
298 LogIO os( LogOrigin( "NROReader", "getSourceDirection()", WHERE ) ) ;
299
300 Vector<Double> v ;
301 Double srcra = Double( dataset_->getRA0() ) ;
302 Double srcdec = Double( dataset_->getDEC0() ) ;
303 char epoch[5] ;
304 strncpy( epoch, (dataset_->getEPOCH()).c_str(), 5 ) ;
305 if ( strncmp( epoch, "B1950", 5 ) == 0 ) {
306 // convert to J2000 value
307 MDirection result =
308 MDirection::Convert( MDirection( Quantity( srcra, "rad" ),
309 Quantity( srcdec, "rad" ),
310 MDirection::Ref( MDirection::B1950 ) ),
311 MDirection::Ref( MDirection::J2000 ) ) () ;
312 v = result.getAngle().getValue() ;
313 Double srcra2 = v( 0 ) ;
314 if ( srcra2 < 0.0 && srcra >= 0.0 )
315 v( 0 ) = 2.0 * M_PI + srcra2 ;
316 //cout << "NROReader::getSourceDirection() SRCDIRECTION convert from ("
317 //<< srcra << "," << srcdec << ") B1950 to ("
318 //<< v( 0 ) << ","<< v( 1 ) << ") J2000" << endl ;
319 os << LogIO::NORMAL << "SRCDIRECTION convert from ("
320 << srcra << "," << srcdec << ") B1950 to ("
321 << v( 0 ) << ","<< v( 1 ) << ") J2000" << LogIO::POST ;
322 }
323 else if ( strncmp( epoch, "J2000", 5 ) == 0 ) {
324 v.resize( 2 ) ;
325 v( 0 ) = srcra ;
326 v( 1 ) = srcdec ;
327 }
328
329 return v ;
330}
331
332// Get DIRECTION in RADEC(J2000)
333Vector<Double> NROReader::getDirection( int i )
334{
335 LogIO os( LogOrigin( "NROReader", "getDirection()", WHERE ) ) ;
336
337 Vector<Double> v ;
338 NRODataRecord *record = dataset_->getRecord( i ) ;
339 char epoch[5] ;
340 strncpy( epoch, (dataset_->getEPOCH()).c_str(), 5 ) ;
341 int icoord = dataset_->getSCNCD() ;
342 Double dirx = Double( record->SCX ) ;
343 Double diry = Double( record->SCY ) ;
344 if ( icoord == 1 ) {
345 // convert from LB to RADEC
346 MDirection result =
347 MDirection::Convert( MDirection( Quantity( dirx, "rad" ),
348 Quantity( diry, "rad" ),
349 MDirection::Ref( MDirection::GALACTIC ) ),
350 MDirection::Ref( MDirection::J2000 ) ) () ;
351 v = result.getAngle().getValue() ;
352 Double dirx2 = v( 0 ) ;
353 if ( dirx2 < 0.0 && dirx >= 0.0 )
354 v( 0 ) = 2.0 * M_PI + dirx2 ;
355 //cout << "NROReader::getDirection() DIRECTION convert from ("
356 //<< dirx << "," << diry << ") LB to ("
357 //<< v( 0 ) << ","<< v( 1 ) << ") RADEC" << endl ;
358 os << LogIO::NORMAL << "DIRECTION convert from ("
359 << dirx << "," << diry << ") LB to ("
360 << v( 0 ) << ","<< v( 1 ) << ") RADEC" << LogIO::POST ;
361 }
362 else if ( icoord == 2 ) {
363 // convert from AZEL to RADEC
[2200]364 vector<double> antpos = getAntennaPosition() ;
365 Vector<Quantity> qantpos( 3 ) ;
366 for ( int ip = 0 ; ip < 3 ; ip++ )
367 qantpos[ip] = Quantity( antpos[ip], "m" ) ;
368 Double scantime = Double( dataset_->getScanTime( i ) ) ;
369 MEpoch me( Quantity( scantime, "d" ), MEpoch::UTC ) ;
370 MPosition mp( MVPosition( qantpos ), MPosition::ITRF ) ;
371 MeasFrame mf( me, mp ) ;
[1757]372 MDirection result =
373 MDirection::Convert( MDirection( Quantity( dirx, "rad" ),
374 Quantity( diry, "rad" ),
375 MDirection::Ref( MDirection::AZEL ) ),
[2200]376 MDirection::Ref( MDirection::J2000, mf ) ) () ;
[1757]377 v = result.getAngle().getValue() ;
378 //cout << "NROReader::getDirection() DIRECTION convert from ("
379 //<< dirx << "," << diry << ") AZEL to ("
380 //<< v( 0 ) << ","<< v( 1 ) << ") RADEC" << endl ;
381 os << LogIO::NORMAL << "DIRECTION convert from ("
382 << dirx << "," << diry << ") AZEL to ("
383 << v( 0 ) << ","<< v( 1 ) << ") RADEC" << LogIO::POST ;
384 }
385 else if ( icoord == 0 ) {
386 if ( strncmp( epoch, "B1950", 5 ) == 0 ) {
387 // convert to J2000 value
388 MDirection result =
389 MDirection::Convert( MDirection( Quantity( dirx, "rad" ),
390 Quantity( diry, "rad" ),
391 MDirection::Ref( MDirection::B1950 ) ),
392 MDirection::Ref( MDirection::J2000 ) ) () ;
393 v = result.getAngle().getValue() ;
394 Double dirx2 = v( 0 ) ;
395 if ( dirx2 < 0.0 && dirx >= 0.0 )
396 v( 0 ) = 2.0 * M_PI + dirx2 ;
397 //cout << "STFiller::readNRO() DIRECTION convert from ("
398 //<< dirx << "," << diry << ") B1950 to ("
399 //<< v( 0 ) << ","<< v( 1 ) << ") J2000" << endl ;
400 os << LogIO::NORMAL << "DIRECTION convert from ("
401 << dirx << "," << diry << ") B1950 to ("
402 << v( 0 ) << ","<< v( 1 ) << ") J2000" << LogIO::POST ;
403 }
404 else if ( strncmp( epoch, "J2000", 5 ) == 0 ) {
405 v.resize( 2 ) ;
406 v( 0 ) = dirx ;
407 v( 1 ) = diry ;
408 }
409 }
410
411 return v ;
412}
413
414int NROReader::getHeaderInfo( Int &nchan,
415 Int &npol,
416 Int &nif,
417 Int &nbeam,
418 String &observer,
419 String &project,
420 String &obstype,
421 String &antname,
422 Vector<Double> &antpos,
423 Float &equinox,
424 String &freqref,
425 Double &reffreq,
426 Double &bw,
427 Double &utc,
428 String &fluxunit,
429 String &epoch,
430 String &poltype )
431{
432 nchan = dataset_->getNUMCH() ;
433 //cout << "nchan = " << nchan << endl ;
434 npol = getPolarizationNum() ;
435 //cout << "npol = " << npol << endl ;
436 observer = dataset_->getOBSVR() ;
437 //cout << "observer = " << observer << endl ;
438 project = dataset_->getPROJ() ;
439 //cout << "project = " << project << endl ;
440 obstype = dataset_->getSWMOD() ;
441 //cout << "obstype = " << obstype << endl ;
442 antname = dataset_->getSITE() ;
443 //cout << "antname = " << antname << endl ;
444 // TODO: should be investigated antenna position since there are
445 // no corresponding information in the header
446 // 2008/11/13 Takeshi Nakazato
447 //
448 // INFO: tentative antenna posiiton is obtained for NRO 45m from ITRF website
449 // 2008/11/26 Takeshi Nakazato
450 vector<double> pos = getAntennaPosition() ;
451 antpos = pos ;
452 //cout << "antpos = " << antpos << endl ;
453 string eq = dataset_->getEPOCH() ;
[2200]454// if ( eq.compare( 0, 5, "B1950" ) == 0 )
455// equinox = 1950.0 ;
456// else if ( eq.compare( 0, 5, "J2000" ) == 0 )
457// equinox = 2000.0 ;
458 // equinox is always 2000.0
459 equinox = 2000.0 ;
[1757]460 //cout << "equinox = " << equinox << endl ;
461 string vref = dataset_->getVREF() ;
462 if ( vref.compare( 0, 3, "LSR" ) == 0 ) {
463 if ( vref.size() == 3 ) {
464 vref.append( "K" ) ;
465 }
466 else {
467 vref[3] = 'K' ;
468 }
469 }
[1868]470 //freqref = vref ;
[2198]471 //freqref = "LSRK" ;
472 freqref = "REST" ;
[1757]473 //cout << "freqref = " << freqref << endl ;
474 NRODataRecord *record = dataset_->getRecord( 0 ) ;
475 reffreq = record->FREQ0 ;
476 //cout << "reffreq = " << reffreq << endl ;
477 bw = dataset_->getBEBW()[0] ;
478 //cout << "bw = " << bw << endl ;
479 utc = getStartTime() ;
480 //cout << "utc = " << utc << endl ;
481 fluxunit = "K" ;
482 //cout << "fluxunit = " << fluxunit << endl ;
483 epoch = "UTC" ;
484 //cout << "epoch = " << epoch << endl ;
485 string poltp = dataset_->getPOLTP()[0] ;
486 //cout << "poltp = '" << poltp << "'" << endl ;
487 if ( poltp == "" || poltp[0] == ' ' )
488 //poltp = "None" ;
489 poltp = "linear" ; // if no polarization type specified, set to "linear"
490 //else if ( strcmp( poltp, "LINR" ) == 0 )
491 else if ( poltp.compare( 0, 1, "LINR", 0, 1 ) == 0 )
492 poltp = "linear" ;
493 //else if ( strcmp( poltp, "CIRL" ) == 0 )
494 else if ( poltp.compare( 0, 1, "CIRL", 0, 1 ) == 0 )
495 poltp = "circular" ;
496 poltype = poltp ;
497 //cout << "poltype = " << poltype << endl ;
498
[2154]499 //vector<Bool> ifs = getIFs() ;
500 //nif = ifs.size() ;
501 nif = getNumIF() ;
[1757]502 //cout << "nif = " << nif << endl ;
503
[2154]504 //vector<Bool> beams = getBeams() ;
505 //nbeam = beams.size() ;
506 nbeam = getNumBeam() ;
[1757]507 //cout << "nbeam = " << nbeam << endl ;
508
509 return 0 ;
510}
511
512string NROReader::getScanType( int i )
513{
514 NRODataRecord *record = dataset_->getRecord( i ) ;
515 string s = record->SCANTP ;
516
517 return s ;
518}
519
520int NROReader::getScanInfo( int irow,
521 uInt &scanno,
522 uInt &cycleno,
[2201]523 uInt &ifno,
[1757]524 uInt &beamno,
525 uInt &polno,
526 vector<double> &freqs,
527 Vector<Double> &restfreq,
528 uInt &refbeamno,
529 Double &scantime,
530 Double &interval,
531 String &srcname,
532 String &fieldname,
533 Array<Float> &spectra,
534 Array<uChar> &flagtra,
535 Array<Float> &tsys,
536 Array<Double> &direction,
537 Float &azimuth,
538 Float &elevation,
539 Float &parangle,
540 Float &opacity,
541 uInt &tcalid,
542 Int &fitid,
543 uInt &focusid,
544 Float &temperature,
545 Float &pressure,
546 Float &humidity,
547 Float &windvel,
548 Float &winddir,
549 Double &srcvel,
550 Array<Double> &propermotion,
551 Vector<Double> &srcdir,
552 Array<Double> &scanrate )
553{
554 // DEBUG
555 //cout << "NROReader::getScanInfo() irow = " << irow << endl ;
556 //
557 NRODataRecord *record = dataset_->getRecord( irow ) ;
558
559 // scanno
560 scanno = (uInt)(record->ISCAN) ;
561 //cout << "scanno = " << scanno << endl ;
562
563 // cycleno
564 cycleno = 0 ;
565 //cout << "cycleno = " << cycleno << endl ;
566
[2201]567 // beamno and ifno
[2158]568 string rxname = dataset_->getRX()[0] ;
569 if ( rxname.find("MULT2") != string::npos ) {
570 string arryt = string( record->ARRYT ) ;
[2201]571 beamno = dataset_->getArrayId( arryt ) ;
572 ifno = 0 ;
[2158]573 }
574 else {
575 beamno = 0 ;
[2201]576 string arryt = string( record->ARRYT ) ;
577 ifno = dataset_->getArrayId( arryt ) ;
[2158]578 }
[1757]579 //cout << "beamno = " << beamno << endl ;
580
581 // polno
582 polno = 0 ;
583 //cout << "polno = " << polno << endl ;
584
585 // freqs (for IFNO and FREQ_ID)
586 //freqs = getFrequencies( irow ) ;
587 freqs = dataset_->getFrequencies( irow ) ;
588 //cout << "freqs = [" << freqs[0] << ", " << freqs[1] << ", " << freqs[2] << "]" << endl ;
589
590 // restfreq (for MOLECULE_ID)
591 Vector<Double> rf( IPosition( 1, 1 ) ) ;
592 rf( 0 ) = record->FREQ0 ;
593 restfreq = rf ;
594 //cout << "restfreq = " << rf << endl ;
595
596 // refbeamno
597 refbeamno = 0 ;
598 //cout << "refbeamno = " << refbeamno << endl ;
599
600 // scantime
[2156]601 //scantime = Double( dataset_->getStartIntTime( irow ) ) ;
602 scantime = Double( dataset_->getScanTime( irow ) ) ;
[1757]603 //cout << "scantime = " << scantime << endl ;
604
605 // interval
606 interval = Double( dataset_->getIPTIM() ) ;
607 //cout << "interval = " << interval << endl ;
608
609 // srcname
610 srcname = String( dataset_->getOBJ() ) ;
611 //cout << "srcname = " << srcname << endl ;
612
613 // fieldname
614 fieldname = String( dataset_->getOBJ() ) ;
615 //cout << "fieldname = " << fieldname << endl ;
616
617 // spectra
618 vector<double> spec = dataset_->getSpectrum( irow ) ;
619 Array<Float> sp( IPosition( 1, spec.size() ) ) ;
620 int index = 0 ;
621 for ( Array<Float>::iterator itr = sp.begin() ; itr != sp.end() ; itr++ ) {
622 *itr = spec[index++] ;
623 }
624 spectra = sp ;
625 //cout << "spec.size() = " << spec.size() << endl ;
626
627 // flagtra
628 Array<uChar> flag( spectra.shape() ) ;
629 flag.set( 0 ) ;
630 flagtra = flag ;
631 //cout << "flag.size() = " << flag.size() << endl ;
632
633 // tsys
634 Array<Float> tmp( IPosition( 1, 1 ), record->TSYS ) ;
635 tsys = tmp ;
636 //cout << "tsys[0] = " << tsys[0] << endl ;
637
638 // direction
639 direction = getDirection( irow ) ;
640 //cout << "direction = [" << direction[0] << ", " << direction[1] << "]" << endl ;
641
642 // azimuth
643 azimuth = record->RAZ ;
644 //cout << "azimuth = " << azimuth << endl ;
645
646 // elevation
647 elevation = record->REL ;
648 //cout << "elevation = " << elevation << endl ;
649
650 // parangle
651 parangle = 0.0 ;
652 //cout << "parangle = " << parangle << endl ;
653
654 // opacity
655 opacity = 0.0 ;
656 //cout << "opacity = " << opacity << endl ;
657
658 // tcalid
659 tcalid = 0 ;
660 //cout << "tcalid = " << tcalid << endl ;
661
662 // fitid
663 fitid = -1 ;
664 //cout << "fitid = " << fitid << endl ;
665
666 // focusid
667 focusid = 0 ;
668 //cout << "focusid = " << focusid << endl ;
669
670 // temperature (for WEATHER_ID)
671 temperature = Float( record->TEMP ) ;
672 //cout << "temperature = " << temperature << endl ;
673
674 // pressure (for WEATHER_ID)
675 pressure = Float( record->PATM ) ;
676 //cout << "pressure = " << pressure << endl ;
677
678 // humidity (for WEATHER_ID)
679 humidity = Float( record->PH2O ) ;
680 //cout << "humidity = " << humidity << endl ;
681
682 // windvel (for WEATHER_ID)
683 windvel = Float( record->VWIND ) ;
684 //cout << "windvel = " << windvel << endl ;
685
686 // winddir (for WEATHER_ID)
687 winddir = Float( record->DWIND ) ;
688 //cout << "winddir = " << winddir << endl ;
689
690 // srcvel
691 srcvel = dataset_->getURVEL() ;
692 //cout << "srcvel = " << srcvel << endl ;
693
694 // propermotion
695 Array<Double> srcarr( IPosition( 1, 2 ) ) ;
696 srcarr = 0.0 ;
697 propermotion = srcarr ;
698 //cout << "propermotion = [" << propermotion[0] << ", " << propermotion[1] << "]" << endl ;
699
700 // srcdir
701 srcdir = getSourceDirection() ;
702 //cout << "srcdir = [" << srcdir[0] << ", " << srcdir[1] << endl ;
703
704 // scanrate
705 Array<Double> sr( IPosition( 1, 1 ) ) ;
706 sr = 0.0 ;
707 scanrate = sr ;
708 //cout << "scanrate = " << scanrate[0] << endl ;
709
710 return 0 ;
711}
712
713Int NROReader::getRowNum()
714{
715 return dataset_->getRowNum() ;
716}
Note: See TracBrowser for help on using the repository browser.