Commits

add atmosphere cpp unit tests that do not require input files, CAS-13993, CAS-13857
No tags

casatools/src/code/atmosphere/ATM/test/APEX_SkyDipTest.cc

Added
1 +/*******************************************************************************
2 + * ALMA - Atacama Large Millimeter Array
3 + * (c) Instituto de Estructura de la Materia, 2011
4 + * (in the framework of the ALMA collaboration).
5 + * All rights reserved.
6 + *
7 + * This library is free software; you can redistribute it and/or
8 + * modify it under the terms of the GNU Lesser General Public
9 + * License as published by the Free Software Foundation; either
10 + * version 2.1 of the License, or (at your option) any later version.
11 + *
12 + * This library is distributed in the hope that it will be useful,
13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 + * Lesser General Public License for more details.
16 + *
17 + * You should have received a copy of the GNU Lesser General Public
18 + * License along with this library; if not, write to the Free Software
19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 + *******************************************************************************/
21 +
22 +#include <string>
23 +#include <vector>
24 +#include <iostream>
25 +#include <fstream>
26 +#include <math.h>
27 +
28 +using namespace std;
29 +
30 +
31 +
32 +#include <atmosphere/ATM/ATMPercent.h>
33 +#include <atmosphere/ATM/ATMPressure.h>
34 +#include <atmosphere/ATM/ATMNumberDensity.h>
35 +#include <atmosphere/ATM/ATMMassDensity.h>
36 +#include <atmosphere/ATM/ATMTemperature.h>
37 +#include <atmosphere/ATM/ATMLength.h>
38 +#include <atmosphere/ATM/ATMInverseLength.h>
39 +#include <atmosphere/ATM/ATMOpacity.h>
40 +#include <atmosphere/ATM/ATMAngle.h>
41 +#include <atmosphere/ATM/ATMHumidity.h>
42 +#include <atmosphere/ATM/ATMFrequency.h>
43 +#include <atmosphere/ATM/ATMWaterVaporRadiometer.h>
44 +#include <atmosphere/ATM/ATMWVRMeasurement.h>
45 +#include <atmosphere/ATM/ATMProfile.h>
46 +#include <atmosphere/ATM/ATMSpectralGrid.h>
47 +#include <atmosphere/ATM/ATMRefractiveIndex.h>
48 +#include <atmosphere/ATM/ATMRefractiveIndexProfile.h>
49 +#include <atmosphere/ATM/ATMSkyStatus.h>
50 +#define STRLEN 200 // Max length of a row in a tpoint file
51 +using namespace atm;
52 +
53 +int main()
54 +{
55 + cout << " ApexTest:" << endl;
56 + cout << " ApexTest: THIS PROPOSED TEST OF THE ATM INTERFACE SOFTWARE IS BASED ON APEX SKY DIP DATA PROVIDED BY HEIKO" << endl;
57 + cout << " " << endl;
58 +
59 + cout << " ApexTest: STEP 1: CREATES REFERENCE ATMOSPHERIC PROFILE CORRESTONDING TO THE FOLLOWING BASIC PARAMETERS:" << endl;
60 +
61 + unsigned int atmType = 1; // TROPICAL
62 + Temperature T( 270.114,"K"); // Ground temperature
63 + Pressure P( 553.8,"mb"); // Ground Pressure
64 + Humidity H( 9.06,"%" ); // Ground Relative Humidity (indication)
65 + Length Alt( 5105,"m" ); // Altitude of the site
66 + Length WVL( 2.0,"km"); // Water vapor scale height
67 + double TLR= -6.5 ; // Tropospheric lapse rate (must be in K/km)
68 + Length topAtm( 48.0,"km"); // Upper atm. boundary for calculations
69 + Pressure Pstep( 5.0,"mb"); // Primary pressure step (5.0 mb)
70 + double PstepFact= 1.1; // Pressure step ratio between two consecutive layers
71 +
72 + AtmProfile apex_AtmProfile( Alt, P, T, TLR, H, WVL, Pstep, PstepFact, topAtm, atmType );
73 +
74 + cout << " ApexTest: First guess precipitable water vapor content: " << apex_AtmProfile.getGroundWH2O().get("mm") << "mm" << endl;
75 + cout << " ApexTest: " << endl;
76 +
77 + cout << " ApexTest: STEP 2: CREATES SpectralGrid and RefractiveIndexProfile objects" << endl;
78 +
79 + unsigned int numchan=25; unsigned int refchan=13;
80 + Frequency astrofreq(691.51570990969995,"GHz"); Frequency chansep( 0.04,"GHz"); Frequency intfreq( 6.0,"GHz");
81 + SidebandSide sidebandside=LSB; SidebandType sidebandtype=DSB;
82 + SpectralGrid apex_SpectralGrid(numchan, refchan, astrofreq, chansep, intfreq, sidebandside, sidebandtype);
83 +
84 + // Creates RefractiveIndexProfile for the current atm profile (apex_AtmProfile) and spectral grid
85 + // (apex_SpectralGrid, so far with only the first WVR channel). Later on we will add new spectral
86 + // windows directly at the level of this RefractiveIndexProfile object.
87 + RefractiveIndexProfile apex_RefractiveIndexProfile(apex_SpectralGrid, apex_AtmProfile);
88 +
89 +
90 +
91 +return 0;
92 +
93 +}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut