Skip to content

Commit

Permalink
Support compilation agains gdal 3.9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkvdb committed Aug 29, 2024
1 parent 7366eff commit 14ed836
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
2 changes: 2 additions & 0 deletions python/pythonalgoadapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ namespace pyalgo {
namespace py = pybind11;
using namespace inf;

namespace gdal = inf::gdal;

template <typename T>
using value_type = typename std::remove_cv_t<std::remove_reference_t<T>>::value_type;

Expand Down
40 changes: 21 additions & 19 deletions python/pythonioadapters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ namespace gdx {
namespace py = pybind11;
using namespace py::literals;

namespace gdal = inf::gdal;

template <typename T>
using EigenArray = Eigen::Array<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;

Expand Down Expand Up @@ -157,30 +159,30 @@ static void writeArray(py::array data, const RasterMetadata& meta, py::object pa
void initIoModule(py::GDX_PYBIND_MODULE& ioMod)
{
ioMod.def("read_metadata",
&read_metadata,
"raster_path"_a,
"Read the metadata from a raster on disk, returns the gdx.raster_metadata instance");
&read_metadata,
"raster_path"_a,
"Read the metadata from a raster on disk, returns the gdx.raster_metadata instance");

ioMod.def("read_array",
&readArray,
"raster_path"_a,
"dtype"_a = py::none(),
"extent"_a = py::none(),
"Read a raster from disk, returns a (gdx.raster_metadata, np.ndarray) tuple");
&readArray,
"raster_path"_a,
"dtype"_a = py::none(),
"extent"_a = py::none(),
"Read a raster from disk, returns a (gdx.raster_metadata, np.ndarray) tuple");

ioMod.def("read_maskedarray",
&readMaskedArray,
"raster_path"_a,
"dtype"_a = py::none(),
"extent"_a = py::none(),
"Read a raster from disk, returns a (gdx.raster_metadata, np.ma.MaskedArray) tuple");
&readMaskedArray,
"raster_path"_a,
"dtype"_a = py::none(),
"extent"_a = py::none(),
"Read a raster from disk, returns a (gdx.raster_metadata, np.ma.MaskedArray) tuple");

ioMod.def("write_array",
&writeArray,
"data"_a,
"metadata"_a,
"raster_path"_a,
"dtype"_a = py::none(),
"Write a numpy array to disk");
&writeArray,
"data"_a,
"metadata"_a,
"raster_path"_a,
"dtype"_a = py::none(),
"Write a numpy array to disk");
}
}

0 comments on commit 14ed836

Please sign in to comment.