Skip to content

Commit

Permalink
put back acq
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Jan 4, 2024
1 parent 86ee4e2 commit d37647b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pdal/libpdalpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace pdal {
};

std::vector<py::dict> getDrivers() {
py::gil_scoped_acquire acquire;
std::vector<py::dict> drivers;

pdal::StageFactory f(false);
Expand Down Expand Up @@ -58,6 +59,7 @@ namespace pdal {
};

py::object getOptions() {
py::gil_scoped_acquire acquire;
py::object json = py::module_::import("json");
py::dict stageOptions;

Expand Down Expand Up @@ -92,6 +94,7 @@ namespace pdal {
};

std::vector<py::dict> getDimensions() {
py::gil_scoped_acquire acquire;
py::object np = py::module_::import("numpy");
py::object dtype = np.attr("dtype");
std::vector<py::dict> dims;
Expand All @@ -109,11 +112,13 @@ namespace pdal {

std::string getReaderDriver(std::filesystem::path const& p)
{
py::gil_scoped_acquire acquire;
return StageFactory::inferReaderDriver(p.string());
}

std::string getWriterDriver(std::filesystem::path const& p)
{
py::gil_scoped_acquire acquire;
return StageFactory::inferWriterDriver(p.string());
}

Expand All @@ -137,6 +142,7 @@ namespace pdal {
}

py::object getMetadata() {
py::gil_scoped_acquire acquire;
py::object json = py::module_::import("json");

std::stringstream strm;
Expand Down Expand Up @@ -184,6 +190,7 @@ namespace pdal {
}

void setInputs(std::vector<py::array> ndarrays) {
py::gil_scoped_acquire acquire;
_inputs.clear();
for (const auto& ndarray: ndarrays) {
PyArrayObject* ndarray_ptr = (PyArrayObject*)ndarray.ptr();
Expand All @@ -202,6 +209,7 @@ namespace pdal {
std::string getSrsWKT2() { return getExecutor()->getSrsWKT2(); }

py::object getQuickInfo() {
py::gil_scoped_acquire acquire;
py::object json = py::module_::import("json");

std::string response;
Expand Down Expand Up @@ -267,6 +275,7 @@ namespace pdal {
void delExecutor() { _executor.reset(); }

PipelineExecutor* getExecutor() {
py::gil_scoped_acquire acquire;
if (!_executor)
_executor.reset(new PipelineExecutor(getJson(), _inputs, _loglevel));
return _executor.get();
Expand Down

0 comments on commit d37647b

Please sign in to comment.