MetReader.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #include <iostream>
40 #include <iomanip>
41 #include <string>
42 #include <map>
43 
44 #include "MetReader.hpp"
45 #include "RinexMetStream.hpp"
46 #include "RinexMetData.hpp"
47 
48 using namespace std;
49 
50 namespace gnsstk
51 {
52  MetReader ::
53  MetReader()
54  : verboseLevel(0)
55  {
56  }
57 
58 
60  MetReader(const std::string& fn)
61  : verboseLevel(0)
62  {
63  if (!read(fn))
64  {
65  FileMissingException exc("Unable to read from "+fn);
66  GNSSTK_THROW(exc);
67  }
68  }
69 
70 
71  bool MetReader ::
72  read(const std::string& fn)
73  {
74  RinexMetStream rms;
75  rms.open(fn.c_str(), ios::in);
76  if (!rms)
77  {
78  return false;
79  }
80 
81  RinexMetData rmd;
82  while (rms >> rmd)
83  {
84  WxObservation wob(
85  rmd.time,
89  wx.insertObservation(wob);
90  }
91  return true;
92  } // end of read()
93 
94 }
gnsstk::RinexMetHeader::PR
@ PR
Pressure (mbar)
Definition: RinexMetHeader.hpp:83
gnsstk::MetReader::wx
gnsstk::WxObsData wx
The storage for all weather data read.
Definition: MetReader.hpp:73
gnsstk::RinexMetData
Definition: RinexMetData.hpp:71
gnsstk::RinexMetStream
Definition: RinexMetStream.hpp:70
gnsstk::RinexMetHeader::HR
@ HR
Relative humidity (percent)
Definition: RinexMetHeader.hpp:85
gnsstk::MetReader::MetReader
MetReader()
Initialize internal data structures.
Definition: MetReader.cpp:53
MetReader.hpp
gnsstk::WxObservation
A Single Weather Observation.
Definition: WxObsMap.hpp:55
gnsstk::RinexMetStream::open
virtual void open(const char *fn, std::ios::openmode mode)
overrides open to reset the header
Definition: RinexMetStream.cpp:70
gnsstk::MetReader::read
bool read(const std::string &fn)
Definition: MetReader.cpp:72
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::RinexMetHeader::TD
@ TD
Dry temperature (deg C)
Definition: RinexMetHeader.hpp:84
gnsstk::RinexMetData::time
CommonTime time
The time this data was recorded, in GPS time system.
Definition: RinexMetData.hpp:103
RinexMetStream.hpp
RinexMetData.hpp
std
Definition: Angle.hpp:142
gnsstk::WxObsData::insertObservation
void insertObservation(const WxObservation &obs) noexcept
Definition: WxObsMap.cpp:67
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition: Exception.hpp:366
example5.fn
string fn
Definition: example5.py:10
gnsstk::RinexMetData::data
RinexMetMap data
The data itself in map form.
Definition: RinexMetData.hpp:104


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:40