Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions builder/build_pymeos_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
"textset_make": textset_make_modifier,
"geoset_make": array_length_remover_modifier("values", "count"),
"tsequenceset_make_gaps": array_length_remover_modifier("instants", "count"),
"tpointseq_make_coords": tpointseq_make_coords_modifier
"mi_span_span": mi_span_span_modifier,

Check failure on line 88 in builder/build_pymeos_functions.py

View workflow job for this annotation

GitHub Actions / Lint code with Ruff

Ruff (invalid-syntax)

builder/build_pymeos_functions.py:88:5: invalid-syntax: Expected ',', found string
}

# List of result function parameters in tuples of (function, parameter)
Expand Down
19 changes: 19 additions & 0 deletions builder/build_pymeos_functions_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ def spanset_make_modifier(function: str) -> str:
.replace(", count", ", len(spans)")
)

def tpointseq_make_coords_modifier(function: str) -> str:
return (
"import numpy as np\n" +
function.replace("interp: 'interpType'", "linear: bool")
.replace("(\"const double", "(\"double")
.replace("xcoords)", "np.ascontiguousarray(xcoords, dtype=np.float64).ctypes.data)")
.replace("ycoords)", "np.ascontiguousarray(ycoords, dtype=np.float64).ctypes.data)")
.replace("zcoords_converted = _ffi.cast('const double *', zcoords)", "if zcoords is not None:\n"
" zcoords = np.ascontiguousarray(zcoords, dtype=np.float64)\n"
" zcoords_converted = _ffi.cast('double *', zcoords.ctypes.data)\n"
" else:\n"
" zcoords_converted = _ffi.NULL")
.replace("interp_converted = _ffi.cast('interpType', interp)", "")
.replace("interp_converted", "linear")
.replace("times_converted = _ffi.cast('const TimestampTz *', times)", "")
.replace("srid_converted = _ffi.cast('int32', srid)", "")
.replace("times_converted", "times")
.replace("srid_converted", "srid")
)

def mi_span_span_modifier(function: str) -> str:
return function.replace(
Expand Down
Loading