"Fossies" - the Fresh Open Source Software Archive 
Member "fimex-1.4.1/modules/python/pyfimex0_CoordinateSystem.cc" (30 Oct 2019, 3121 Bytes) of package /linux/privat/fimex-1.4.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "pyfimex0_CoordinateSystem.cc" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
1.4.0_vs_1.4.1.
1 /*
2 * Fimex, pyfimex0_CoordinateSystem.cc
3 *
4 * (C) Copyright 2018-2019, met.no
5 *
6 * Project Info: https://wiki.met.no/fimex/start
7 *
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 * License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * USA.
22 *
23 * Created on: Aug 1, 2017
24 * Author: Alexander Bürger
25 */
26
27 #include "fimex/CDMReader.h"
28 #include "fimex/coordSys/CoordinateSystem.h"
29
30 #include <pybind11/pybind11.h>
31 #include <pybind11/stl.h>
32
33 using namespace MetNoFimex;
34 namespace py = pybind11;
35
36 namespace {
37
38 py::list listCoordinateSystems1(CDMReader_p reader)
39 {
40 const CoordinateSystem_cp_v cs = listCoordinateSystems(reader);
41 py::list py_cs;
42 for (size_t i=0; i<cs.size(); ++i)
43 py_cs.append(cs[i]);
44 return py_cs;
45 }
46
47 CoordinateSystem_cp findCompleteCoordinateSystemFor1(const std::vector<CoordinateSystem_cp>& cs, const std::string& varName)
48 {
49 return findCompleteCoordinateSystemFor(cs, varName);
50 }
51
52 CoordinateAxis_cp CoordinateSystem__findAxisOfType1(CoordinateSystem_cp cs, CoordinateAxis::AxisType type)
53 {
54 return cs->findAxisOfType(type);
55 }
56
57 CoordinateAxis_cp CoordinateSystem__findAxisOfType2(CoordinateSystem_cp cs, const std::vector<CoordinateAxis::AxisType>& types)
58 {
59 return cs->findAxisOfType(types);
60 }
61
62 } // namespace
63
64 void pyfimex0_CoordinateSystem(py::module m)
65 {
66 py::enum_<CoordinateAxis::AxisType>(m, "CoordinateAxisType")
67 .value("Undefined", CoordinateAxis::Undefined)
68 .value("GeoX", CoordinateAxis::GeoX)
69 .value("GeoY", CoordinateAxis::GeoY)
70 .value("GeoZ", CoordinateAxis::GeoZ)
71 .value("Time", CoordinateAxis::Time)
72 .value("Lon", CoordinateAxis::Lon)
73 .value("Lat", CoordinateAxis::Lat)
74 .value("Pressure", CoordinateAxis::Pressure)
75 .value("Height", CoordinateAxis::Height)
76 .value("Depth", CoordinateAxis::Depth)
77 .value("ReferenceTime", CoordinateAxis::ReferenceTime)
78 .value("Realization", CoordinateAxis::Realization);
79
80 py::class_<CoordinateAxis, CoordinateAxis_p>(m, "_CoordinateAxis").def("getName", &CoordinateAxis::getName);
81
82 py::class_<CoordinateSystem, CoordinateSystem_p>(m, "_CoordinateSystem")
83 .def("id", &CoordinateSystem::id)
84 .def("findAxisOfType", &CoordinateSystem__findAxisOfType1)
85 .def("findAxisOfType", &CoordinateSystem__findAxisOfType2);
86
87 m.def("listCoordinateSystems", listCoordinateSystems1);
88 m.def("findCompleteCoordinateSystemFor", findCompleteCoordinateSystemFor1);
89 }