tprojection.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
(HTM) git clone git://src.adamsgaard.dk/pism
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
tprojection.hh (2239B)
---
1 /* Copyright (C) 2015, 2016, 2017, 2018, 2019 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 _PROJECTION_H_
21 #define _PROJECTION_H_
22
23 #include <string>
24
25 #include "Units.hh"
26 #include "VariableMetadata.hh"
27
28 namespace pism {
29
30 class File;
31 class IceModelVec2S;
32 class IceModelVec3D;
33
34 /*! @brief Convert a proj string with an EPSG code to a set of CF attributes. */
35 /*!
36 * Fails if `proj_string` does not contain an EPSG code.
37 */
38 VariableMetadata epsg_to_cf(units::System::Ptr system, const std::string &proj_string);
39
40 class MappingInfo {
41 public:
42 MappingInfo(const std::string &mapping_name, units::System::Ptr unit_system);
43 VariableMetadata mapping;
44 std::string proj;
45 };
46
47 /*! @brief Check consistency of the "mapping" variable with the EPSG code in the proj string. */
48 /*!
49 * If the consistency check fails, throws RuntimeError explaining the failure. Fails if `info.proj`
50 * does not use an EPSG code.
51 */
52 void check_consistency_epsg(const MappingInfo &info);
53
54 /*! @brief Get projection info from a file. */
55 MappingInfo get_projection_info(const File &input_file, const std::string &mapping_name,
56 units::System::Ptr unit_system);
57
58 void compute_longitude(const std::string &projection, IceModelVec2S &result);
59 void compute_latitude(const std::string &projection, IceModelVec2S &result);
60
61 void compute_lon_bounds(const std::string &projection, IceModelVec3D &result);
62 void compute_lat_bounds(const std::string &projection, IceModelVec3D &result);
63
64 } // end of namespace pism
65
66 #endif /* _PROJECTION_H_ */