Skip to main content

APbase

Version License: Apache 2.0 Python Kernel: Fortran Parallel: OpenMP CI

APbase Python

APbase is an intelligent mapping pipeline for irregular field data, including yield monitor, soil samples, and sensor grids. It automates the map workflow: filtering source data, handling geographic coordinates when needed, building the target grid, comparing interpolation methods, and selecting a ready-to-use map without requiring users to choose a mathematical model by hand.

Full documentation: https://apbase.io

Install

pip install apbase

PyPI has wheels for Linux (x86_64), macOS (arm64 and x86_64) and Windows (x86_64), for Python 3.12 to 3.14.

Development version, Linux x86_64 with Python 3.14 only (the repository carries the compiled native module for that platform alone):

pip install git+https://github.com/ap-base/apbase-python.git

Quick Use

import numpy as np

import apbase
from apbase import Map

apbase.config["n_threads"] = 4

x = np.ascontiguousarray(x_metric, dtype=np.float64)
y = np.ascontiguousarray(y_metric, dtype=np.float64)
z = np.ascontiguousarray(values, dtype=np.float64)

result = Map(resolution=10.0)(x, y, z)

result.method                # "idw" or "kriging"
result.x, result.y, result.z # compact output points

X, Y, Z = result.to_raster() # dense raster, NaN outside the boundary

Functional shortcut:

result = apbase.create_map(x, y, z, resolution=10.0)

Cokriging

When secondary variables correlated with the target one are available, such as elevation, distance to a river or a sensor reading at the soil samples, apbase.cokriging uses them in the estimate. Three methods are available: collocated (Markov-1, the default), ICM (intrinsic coregionalization model) and LMC (linear model of coregionalization). apbase.cross_variogram screens the candidates first: a Fisher z-test for the correlation and a Cauchy-Schwarz check that the cross-variogram is admissible.

from apbase.cokriging import co_kriging
from apbase.cross_variogram import screen_secondary_variables

# candidates: {"name": (x, y, values), ...} of possible secondary variables.
screening = screen_secondary_variables(x, y, z, candidates)

estimates = co_kriging(x, y, z, screening.selected, targets, method="collocated")

A secondary that does not share the primary's sample locations, such as a raster (NDVI, elevation, apparent electrical conductivity), needs max_colocation_dist: each primary sample is paired with its nearest secondary point within that distance (half the cell diagonal for a grid) to estimate the cross-covariances. For dense secondaries, max_secondary_neighbors (ICM and LMC) keeps only the nearest ones; 8 to 16 is usually enough. Cokriging assumes a roughly linear relation between the variables, so transform a secondary that does not have one (for example, the square root of a distance).

estimates = co_kriging(
    x, y, z, {"ndvi": (raster_x, raster_y, ndvi)}, targets,
    method="icm", max_colocation_dist=28.3, max_secondary_neighbors=8,  # 40 m raster
)

Map chooses between IDW and ordinary kriging only; cokriging is called directly. The test suite runs it on three published geostatistics datasets, Jura, Meuse and Walker Lake, including the Meuse 40 m grid as a raster secondary (see tests/data/README.md).

Main API

  • apbase.Map: automated map pipeline.
  • apbase.create_map: one-shot map creation.
  • apbase.config: runtime configuration, including OpenMP thread count.

Advanced modules are available under apbase.filtering, apbase.grid, apbase.variogram, apbase.idw, apbase.kriging, apbase.cokriging, apbase.cross_variogram, and apbase.cross_validate.

Data Requirements

  • x, y, and z must be one-dimensional arrays.
  • Projected metric coordinates, such as UTM, are used directly.
  • Geographic lon/lat input is converted internally before distance operations; distance settings such as resolution are meters.
  • For best performance, use contiguous float64 arrays.

Performance

  • Native Fortran kernels exposed through F2PY/NumPy.
  • OpenMP parallelism for critical numerical work.
  • Local neighborhoods and neighbor limits instead of full distance matrices.
  • Compact output by default; dense rasters are materialized only with result.to_raster().

Set threads before creating maps:

import apbase

apbase.config["n_threads"] = 4

Contributing

See CONTRIBUTING.md. Questions and ideas go to Discussions; security problems follow SECURITY.md.

Citation

If you use APbase in your work, please cite it with the metadata in CITATION.cff (the "Cite this repository" button on GitHub).

License

Apache License 2.0. See LICENSE.

Metadata

Release files for apbase 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for apbase 0.2.0
File
apbase-0.2.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
apbase-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
apbase-0.2.0-cp314-cp314-macosx_15_0_x86_64.whl CPython 3.14 CPython 3.14 macOS 15.0+ x86-64 Details
apbase-0.2.0-cp314-cp314-macosx_14_0_arm64.whl CPython 3.14 CPython 3.14 macOS 14.0+ ARM64 Details
apbase-0.2.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
apbase-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
apbase-0.2.0-cp313-cp313-macosx_15_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 15.0+ x86-64 Details
apbase-0.2.0-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
apbase-0.2.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
apbase-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
apbase-0.2.0-cp312-cp312-macosx_15_0_x86_64.whl CPython 3.12 CPython 3.12 macOS 15.0+ x86-64 Details
apbase-0.2.0-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details

Total release size: 153.7 MB

Release files / apbase-0.2.0-cp314-cp314-win_amd64.whl

Download URL apbase-0.2.0-cp314-cp314-win_amd64.whl
Size 17.3 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
8a834d88f1ac76d33a07a0dfb2682e83031df60855a8bc5446e28f71b215e988
BLAKE2b-256 checksum
How to use checksums
2704cdd1d69c6c50bfb3e67faf9d83c34d624c19bae726ef93e5961424cb6275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL apbase-0.2.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.5 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
89fc248612b88883f5f986959bb416ab242ec058db9a2bfe4b2d1b94e02143f2
BLAKE2b-256 checksum
How to use checksums
671b2aca0578651f768b01c84dd2eb229f54c860831c046e4e8a7b6146a9473e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp314-cp314-macosx_15_0_x86_64.whl

Download URL apbase-0.2.0-cp314-cp314-macosx_15_0_x86_64.whl
Size 12.8 MB
Tags CPython 3.14 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
40eec12cc99be8875e74fe64475cec1cf8058e487f27e1a393a04934b33a8c92
BLAKE2b-256 checksum
How to use checksums
73a52eb95377dfb91d0aac1ab310bfc5cf8b8000a3bca4d817b2f7d4ffd7e589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp314-cp314-macosx_14_0_arm64.whl

Download URL apbase-0.2.0-cp314-cp314-macosx_14_0_arm64.whl
Size 8.8 MB
Tags CPython 3.14 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
0f7cda22983b144f63d98063010dc63d48ab60525dd6502bb04485b2f54d49aa
BLAKE2b-256 checksum
How to use checksums
b1aa0d77ae82ea72a74c1d92c3865536246ec05db6b40ffebb10ac01ffeaef84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp313-cp313-win_amd64.whl

Download URL apbase-0.2.0-cp313-cp313-win_amd64.whl
Size 17.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
3ac045c1375c55286c4bdf71de3b52d8a74666a32ee4790060baa98a83b5b1b3
BLAKE2b-256 checksum
How to use checksums
eb2dec7aaa74373d0df654db6b58b8174784cd17ecafe187a8ff95422a36d782
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL apbase-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.5 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6c031f4f4008e6519cbe9a3c34b8900a8e6bb5a0733eb4dfaa756b9af591a08a
BLAKE2b-256 checksum
How to use checksums
fabffc235411dc0a44173193583deba93133bd03c5286020adf4888f79e79cb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp313-cp313-macosx_15_0_x86_64.whl

Download URL apbase-0.2.0-cp313-cp313-macosx_15_0_x86_64.whl
Size 12.8 MB
Tags CPython 3.13 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
94f1a72e4a11367a3bc61157d4e5427faeb8c8cfb495e8ffefa627dc2e8f647f
BLAKE2b-256 checksum
How to use checksums
2219270a432b36bec315dc75eb5ee42874e8fbe42388872d90222d9a3155af74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp313-cp313-macosx_14_0_arm64.whl

Download URL apbase-0.2.0-cp313-cp313-macosx_14_0_arm64.whl
Size 8.8 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
f6d5818689d4a7b762ffb95f8721a41cb2e556a6686a61a0bc4b248b7f306e6a
BLAKE2b-256 checksum
How to use checksums
71d068966de61a711f613129ab05570402a19bbb8f5ab8e89027ed3acbbd80f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp312-cp312-win_amd64.whl

Download URL apbase-0.2.0-cp312-cp312-win_amd64.whl
Size 17.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e38ce661419da87cb4061226a4189c50fa1fb9f3b54d8902848c78877e709b63
BLAKE2b-256 checksum
How to use checksums
bb82c4522047da731672519c07fab1b57b29105cb7664391b7413d1f3f0d9382
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL apbase-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 12.5 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
720424b88a9df77a2f63b021ee92628f5a8396e5163d15cf76dfb136396e022b
BLAKE2b-256 checksum
How to use checksums
629f5cc741314066f59c31bea732a94f06cac93b7cba0ba57182f5acd6c4a2dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp312-cp312-macosx_15_0_x86_64.whl

Download URL apbase-0.2.0-cp312-cp312-macosx_15_0_x86_64.whl
Size 12.8 MB
Tags CPython 3.12 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
a755d08b90d5410d78ad96b3ecd288c6e9eaaa9abaab47e30e6872e3d6ff758c
BLAKE2b-256 checksum
How to use checksums
28f3277367e85dc147fa8915269c90297b0279a9fc7f05af612c23f49473aeb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / apbase-0.2.0-cp312-cp312-macosx_14_0_arm64.whl

Download URL apbase-0.2.0-cp312-cp312-macosx_14_0_arm64.whl
Size 8.8 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
a116a6a99c8ca03bf648c66314de1e980bfa3ce2eeeb357398a6ca1a72c6b948
BLAKE2b-256 checksum
How to use checksums
cb573f018d350c1523e25d7b6447c2b678303beb473e0739491932a2c4f56afa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for apbase 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 12 files in this release have been uploaded with provenance metadata.

Select from 12 files

Attestation for apbase-0.2.0-cp314-cp314-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page