forked from Unidata/MetPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalcmod.cpp
More file actions
25 lines (19 loc) · 757 Bytes
/
calcmod.cpp
File metadata and controls
25 lines (19 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "virtual_temperature.hpp"
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <pybind11/stl.h>
namespace py = pybind11;
int add(int i, int j) {
return i + j;
}
PYBIND11_MODULE(_calc_mod, m) {
m.doc() = "accelerator module docstring";
m.def("add", &add, "Add two numbers");
// Unified binding with default epsilon
m.def("dewpoint", py::vectorize(DewPoint),
"Calculate dew point from water vapor partial pressure.",
py::arg("vapor_pressure"));
m.def("virtual_temperature", py::vectorize(VirtualTemperature),
"Calculate virtual temperature from temperature and mixing ratio.",
py::arg("temperature"), py::arg("mixing_ratio"), py::arg("epsilon") = 0.622);
}