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

Last change on this file since 2489 was 2489, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: lease list interface changes

Test Programs: sdsave unit test

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

minor speed up


File size: 21.5 KB
Line 
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
41#include <measures/Measures/MEpoch.h>
42#include <measures/Measures/MPosition.h>
43#include <measures/Measures/MDirection.h>
44#include <measures/Measures/MCDirection.h>
45#include <measures/Measures/MeasFrame.h>
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
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 ) ;
372    MDirection result =
373      MDirection::Convert( MDirection( Quantity( dirx, "rad" ),
374                                       Quantity( diry, "rad" ),
375                                       MDirection::Ref( MDirection::AZEL ) ),
376                           MDirection::Ref( MDirection::J2000, mf ) ) () ;
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() ;
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 ;
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  }
470  //freqref = vref ;
471  //freqref = "LSRK" ;
472  freqref = "REST" ;
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
499  //vector<Bool> ifs = getIFs() ;
500  //nif = ifs.size() ;
501  nif = getNumIF() ;
502  //cout << "nif = " << nif << endl ;
503
504  //vector<Bool> beams = getBeams() ;
505  //nbeam = beams.size() ;
506  nbeam = getNumBeam() ;
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,
523                            uInt &ifno,
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                            Vector<Float> &spectra,
534                            Vector<uChar> &flagtra,
535                            Vector<Float> &tsys,
536                            Vector<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                            Vector<Double> &propermotion,
551                            Vector<Double> &srcdir,
552                            Vector<Double> &scanrate )
553{
554  static const IPosition oneByOne( 1, 1 );
555
556  // DEBUG
557  //cout << "NROReader::getScanInfo()  irow = " << irow << endl ;
558  //
559  NRODataRecord *record = dataset_->getRecord( irow ) ;
560
561  // scanno
562  scanno = (uInt)(record->ISCAN) ;
563  //cout << "scanno = " << scanno << endl ;
564
565  // cycleno
566  cycleno = 0 ;
567  //cout << "cycleno = " << cycleno << endl ;
568
569  // beamno and ifno
570  string rxname = dataset_->getRX()[0] ;
571  if ( rxname.find("MULT2") != string::npos ) {
572    string arryt = string( record->ARRYT ) ;
573    beamno = dataset_->getArrayId( arryt ) ;
574    ifno = 0 ;
575  }
576  else {
577    beamno = 0 ;
578    string arryt = string( record->ARRYT ) ;
579    ifno = dataset_->getArrayId( arryt ) ;
580  }
581  //cout << "beamno = " << beamno << endl ;
582
583  // polno
584  polno = dataset_->getPolNo( irow ) ;
585  //cout << "polno = " << polno << endl ;
586
587  // freqs (for IFNO and FREQ_ID)
588  //freqs = getFrequencies( irow ) ;
589  freqs = dataset_->getFrequencies( irow ) ;
590  //cout << "freqs = [" << freqs[0] << ", " << freqs[1] << ", " << freqs[2] << "]" << endl ;
591
592  // restfreq (for MOLECULE_ID)
593  restfreq.resize( oneByOne ) ;
594  restfreq[0] = record->FREQ0 ;
595  //cout << "restfreq = " << rf << endl ;
596
597  // refbeamno
598  refbeamno = 0 ;
599  //cout << "refbeamno = " << refbeamno << endl ;
600
601  // scantime
602  //scantime = Double( dataset_->getStartIntTime( irow ) ) ;
603  scantime = Double( dataset_->getScanTime( irow ) ) ;
604  //cout << "scantime = " << scantime << endl ;
605
606  // interval
607  interval = Double( dataset_->getIPTIM() ) ;
608  //cout << "interval = " << interval << endl ;
609
610  // srcname
611  srcname = String( dataset_->getOBJ() ) ;
612  //cout << "srcname = " << srcname << endl ;
613
614  // fieldname
615  fieldname = String( dataset_->getOBJ() ) ;
616  //cout << "fieldname = " << fieldname << endl ;
617
618  // spectra
619  vector<double> spec = dataset_->getSpectrum( irow ) ;
620  spectra.resize( spec.size() ) ;
621  int index = 0 ;
622  for ( Vector<Float>::iterator itr = spectra.begin() ; itr != spectra.end() ; itr++ ) {
623    *itr = spec[index++] ;
624  }
625  //cout << "spec.size() = " << spec.size() << endl ;
626 
627  // flagtra
628  bool setValue = !( flagtra.nelements() == spectra.nelements() ) ;
629  flagtra.resize( spectra.nelements() ) ;
630  if ( setValue ) {
631    //cout << "flagtra resized. reset values..." << endl ;
632    flagtra.set( 0 ) ;
633  }
634  //cout << "flag.size() = " << flag.size() << endl ;
635
636  // tsys
637  tsys.resize( oneByOne ) ;
638  tsys[0] = record->TSYS ;
639  //cout << "tsys[0] = " << tsys[0] << endl ;
640
641  // direction
642  direction = getDirection( irow ) ;
643  //cout << "direction = [" << direction[0] << ", " << direction[1] << "]" << endl ;
644
645  // azimuth
646  azimuth = record->RAZ ;
647  //cout << "azimuth = " << azimuth << endl ;
648
649  // elevation
650  elevation = record->REL ;
651  //cout << "elevation = " << elevation << endl ;
652
653  // parangle
654  parangle = 0.0 ;
655  //cout << "parangle = " << parangle << endl ;
656
657  // opacity
658  opacity = 0.0 ;
659  //cout << "opacity = " << opacity << endl ;
660
661  // tcalid
662  tcalid = 0 ;
663  //cout << "tcalid = " << tcalid << endl ;
664
665  // fitid
666  fitid = -1 ;
667  //cout << "fitid = " << fitid << endl ;
668
669  // focusid
670  focusid = 0 ;
671  //cout << "focusid = " << focusid << endl ;
672
673  // temperature (for WEATHER_ID)
674  temperature = Float( record->TEMP ) ;
675  //cout << "temperature = " << temperature << endl ;
676
677  // pressure (for WEATHER_ID)
678  pressure = Float( record->PATM ) ;
679  //cout << "pressure = " << pressure << endl ;
680
681  // humidity (for WEATHER_ID)
682  humidity = Float( record->PH2O ) ;
683  //cout << "humidity = " << humidity << endl ;
684
685  // windvel (for WEATHER_ID)
686  windvel = Float( record->VWIND ) ;
687  //cout << "windvel = " << windvel << endl ;
688
689  // winddir (for WEATHER_ID)
690  winddir = Float( record->DWIND ) ;
691  //cout << "winddir = " << winddir << endl ;
692 
693  // srcvel
694  srcvel = dataset_->getURVEL() ;
695  //cout << "srcvel = " << srcvel << endl ;
696
697  // propermotion
698  // do nothing
699
700  // srcdir
701  srcdir = getSourceDirection() ;
702  //cout << "srcdir = [" << srcdir[0] << ", " << srcdir[1] << endl ;
703
704  // scanrate
705  // do nothing
706
707  return 0 ;
708}
709
710Int NROReader::getRowNum()
711{
712  return dataset_->getRowNum() ;
713}
Note: See TracBrowser for help on using the repository browser.