tWeatherStation.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
HTML git clone git://src.adamsgaard.dk/pism
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
tWeatherStation.hh (2448B)
---
1 /* Copyright (C) 2014, 2015, 2016, 2017, 2018 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef _PAWEATHERSTATION_H_
21 #define _PAWEATHERSTATION_H_
22
23 #include "pism/coupler/AtmosphereModel.hh"
24 #include "pism/util/Timeseries.hh"
25
26 namespace pism {
27 namespace atmosphere {
28
29 /** This class implements an atmosphere model corresponding to *one* weather station.
30 *
31 * It reads scalar (but time-dependent) near-surface air temperature
32 * and precipitation data from a provided file. Resulting climate
33 * fields are constant in time.
34 *
35 * This model should be used with a modifier such as `lapse_rate` to
36 * create spatial variability.
37 */
38 class WeatherStation : public AtmosphereModel {
39 public:
40 WeatherStation(IceGrid::ConstPtr g);
41 virtual ~WeatherStation();
42
43 protected:
44 virtual void init_impl(const Geometry &geometry);
45 virtual void update_impl(const Geometry &geometry, double t, double dt);
46
47 virtual const IceModelVec2S& mean_precipitation_impl() const;
48 virtual const IceModelVec2S& mean_annual_temp_impl() const;
49
50 virtual void begin_pointwise_access_impl() const;
51 virtual void end_pointwise_access_impl() const;
52 virtual void init_timeseries_impl(const std::vector<double> &ts) const;
53 virtual void precip_time_series_impl(int i, int j, std::vector<double> &values) const;
54 virtual void temp_time_series_impl(int i, int j, std::vector<double> &values) const;
55
56 virtual MaxTimestep max_timestep_impl(double t) const;
57 protected:
58 Timeseries m_precipitation_timeseries, m_air_temp_timeseries;
59 mutable std::vector<double> m_precip_values, m_air_temp_values;
60
61 IceModelVec2S::Ptr m_temperature;
62 IceModelVec2S::Ptr m_precipitation;
63 };
64
65 } // end of namespace atmosphere
66 } // end of namespace pism
67
68 #endif /* _PAWEATHERSTATION_H_ */