23 #include <gsl/gsl_math.h>
25 #include "pism/coupler/atmosphere/YearlyCycle.hh"
26 #include "pism/util/Time.hh"
27 #include "pism/util/Grid.hh"
28 #include "pism/util/ConfigInterface.hh"
29 #include "pism/util/io/io_helpers.hh"
30 #include "pism/util/pism_utilities.hh"
31 #include "pism/util/Context.hh"
34 namespace atmosphere {
38 m_air_temp_mean_annual(m_grid,
"air_temp_mean_annual"),
39 m_air_temp_mean_summer(m_grid,
"air_temp_mean_summer"),
40 m_precipitation(m_grid,
"precipitation") {
46 "mean annual near-surface air temperature (without sub-year time-dependence or forcing)")
52 "mean summer (NH: July/ SH: January) near-surface air temperature (without sub-year time-dependence or forcing)")
58 .
units(
"kg m-2 second-1")
77 " reading mean annual ice-equivalent precipitation rate 'precipitation'\n"
79 input_filename.c_str());
80 if (do_regrid ==
true) {
115 size_t N = ts.size();
153 namespace diagnostics {
162 .long_name(
"mean summer near-surface air temperature used in the cosine yearly cycle")
168 auto result = allocate<array::Scalar>(
"air_temp_mean_summer");
170 result->copy_from(
model->mean_summer_temp());
const Time & time() const
const Config::ConstPtr m_config
configuration database used by this component
const Logger::ConstPtr m_log
logger (for easy access)
const std::shared_ptr< const Grid > m_grid
grid used by this component
const YearlyCycle * model
A template derived from Diagnostic, adding a "Model".
const units::System::Ptr m_sys
the unit system
std::vector< SpatialVariableMetadata > m_vars
metadata corresponding to NetCDF variables
std::shared_ptr< Diagnostic > Ptr
High-level PISM I/O class.
double year_fraction(double T) const
Returns the fraction of a year that passed since the last beginning of a year. Only useful in codes w...
double day_of_the_year_to_year_fraction(unsigned int day) const
Convert the day number to the year fraction.
void read(const std::string &filename, unsigned int time)
virtual void end_access() const
Checks if an Array is allocated and calls DAVecRestoreArray.
void define(const File &file, io::Type default_type) const
Define variables corresponding to an Array in a file opened using file.
virtual void begin_access() const
Checks if an Array is allocated and calls DAVecGetArray.
void write(const std::string &filename) const
void regrid(const std::string &filename, io::Default default_value)
SpatialVariableMetadata & metadata(unsigned int N=0)
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N.
virtual DiagnosticList diagnostics_impl() const
std::vector< double > m_ts_times
A purely virtual class defining the interface of a PISM Atmosphere Model.
array::Scalar m_air_temp_mean_summer
virtual void define_model_state_impl(const File &output) const
The default (empty implementation).
void init_internal(const std::string &input_filename, bool regrid, unsigned int start)
Read precipitation data from a given file.
YearlyCycle(std::shared_ptr< const Grid > g)
virtual const array::Scalar & mean_summer_temp() const
Copies the stored mean summer near-surface air temperature field into result.
array::Scalar m_precipitation
virtual void init_impl(const Geometry &geometry)
Reads in the precipitation data from the input file.
double m_snow_temp_summer_day
std::vector< double > m_cosine_cycle
virtual void init_timeseries_impl(const std::vector< double > &ts) const
virtual void end_pointwise_access_impl() const
virtual void write_model_state_impl(const File &output) const
The default (empty implementation).
virtual void begin_pointwise_access_impl() const
virtual DiagnosticList diagnostics_impl() const
array::Scalar m_air_temp_mean_annual
virtual void temp_time_series_impl(int i, int j, std::vector< double > &result) const
virtual const array::Scalar & air_temperature_impl() const
Copies the stored mean annual near-surface air temperature field into result.
virtual void precip_time_series_impl(int i, int j, std::vector< double > &result) const
virtual const array::Scalar & precipitation_impl() const
Copies the stored precipitation field into result.
std::shared_ptr< array::Array > compute_impl() const
MeanSummerTemperature(const YearlyCycle *m)
Mean summer near-surface air temperature.
InputOptions process_input_options(MPI_Comm com, Config::ConstPtr config)
std::map< std::string, Diagnostic::Ptr > DiagnosticList