[1757] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# ASTEReader.cc: Class to read ASTE data. |
---|
| 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/11/07, Takeshi Nakazato, NAOJ |
---|
| 31 | //#--------------------------------------------------------------------------- |
---|
| 32 | |
---|
| 33 | #include <atnf/PKSIO/ASTEReader.h> |
---|
| 34 | #include <atnf/PKSIO/ASTEDataset.h> |
---|
| 35 | |
---|
| 36 | #include <string> |
---|
| 37 | #include <stdio.h> |
---|
| 38 | |
---|
| 39 | using namespace std ; |
---|
| 40 | |
---|
| 41 | // Constructor |
---|
| 42 | ASTEReader::ASTEReader( string name ) |
---|
| 43 | : NROReader( name ) |
---|
| 44 | { |
---|
| 45 | // DEBUG |
---|
| 46 | //cout << "ASTEReader::ASTEReader()" << endl ; |
---|
| 47 | // |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | // Destructor. |
---|
| 51 | ASTEReader::~ASTEReader() |
---|
| 52 | { |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | // Read data header |
---|
| 56 | Int ASTEReader::read() |
---|
| 57 | { |
---|
| 58 | LogIO os( LogOrigin( "ASTEReader", "read()", WHERE ) ) ; |
---|
| 59 | |
---|
| 60 | int status = 0 ; |
---|
| 61 | |
---|
| 62 | // create ASTEDataset |
---|
| 63 | dataset_ = new ASTEDataset( filename_ ) ; |
---|
| 64 | |
---|
| 65 | // fill ASTEDataset |
---|
| 66 | status = dataset_->fillHeader() ; |
---|
| 67 | |
---|
| 68 | if ( status != 0 ) { |
---|
| 69 | os << LogIO::SEVERE << "Failed to fill data header." << LogIO::EXCEPTION ; |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | return status ; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | vector<double> ASTEReader::getAntennaPosition() |
---|
| 76 | { |
---|
| 77 | // ASTE in ITRF2005 |
---|
| 78 | // tentative |
---|
| 79 | //vector<double> pos( 3 ) ; |
---|
| 80 | //pos[0] = 2412830.391 ; |
---|
| 81 | //pos[1] = -5271936.712 ; |
---|
| 82 | //pos[2] = -2652209.088 ; |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | // ASTE in World Geodetic System |
---|
| 86 | // |
---|
| 87 | // W67d42m11s S22d58m18s 4800m |
---|
| 88 | // Ref.: Ezawa, H. et al. 2004, Proc. SPIE, 5489, 763 |
---|
| 89 | // |
---|
[1868] | 90 | // double elon = -67. - 42. / 60. - 11. / 3600. ; |
---|
| 91 | // double nlat = -22. - 58. / 60. - 18. / 3600. ; |
---|
| 92 | // double alti = 2400. ; |
---|
| 93 | double elon = -67.7031 ; |
---|
| 94 | double nlat = -22.9717 ; |
---|
| 95 | double alti = 4800.0 ; |
---|
[1757] | 96 | |
---|
| 97 | // APEX value |
---|
| 98 | //double elon = -67.7592 ; |
---|
| 99 | //double nlat = -23.0057 ; |
---|
| 100 | //double alti = 5105. ; |
---|
| 101 | |
---|
| 102 | MPosition p( MVPosition( Quantity( alti, "m" ), |
---|
| 103 | Quantity( elon, "deg" ), |
---|
| 104 | Quantity( nlat, "deg" ) ), |
---|
| 105 | MPosition::Ref( MPosition::WGS84 ) ) ; |
---|
[1868] | 106 | |
---|
[1757] | 107 | MeasFrame frame( p ) ; |
---|
| 108 | MVPosition mvp ; |
---|
| 109 | frame.getITRF( mvp ) ; |
---|
| 110 | Vector<Double> pp = mvp.getValue() ; |
---|
| 111 | vector<double> pos ; |
---|
| 112 | pp.tovector( pos ) ; |
---|
| 113 | //cout << "ASTEReader::getAntennaPosition() pp[0] = " << pp[0] |
---|
| 114 | // << " pp[1] = " << pp[1] << " pp[2] = " << pp[2] << endl ; |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | return pos ; |
---|
| 118 | } |
---|
| 119 | |
---|
[2154] | 120 | Int ASTEReader::getNumIF() |
---|
| 121 | { |
---|
| 122 | vector<Bool> v ; |
---|
| 123 | vector<int> arry = dataset_->getARRY() ; |
---|
| 124 | for ( uInt i = 0 ; i < arry.size() ; i++ ) { |
---|
| 125 | if ( arry[i] != 0 ) { |
---|
| 126 | v.push_back( True ) ; |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | Int nif = v.size() ; |
---|
| 130 | return nif ; |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | Int ASTEReader::getNumBeam() |
---|
| 134 | { |
---|
| 135 | // ASTE doesn't have array receiver so far |
---|
| 136 | return 1 ; |
---|
| 137 | } |
---|