GDAR - The Generic Data Raster
Project description
GDAR - The Generic Data Raster
What is GDAR?
GDAR — the Generic Data Raster — is a Python library for working
with gridded geospatial data. Its central abstraction is the DataRaster,
which combines a data source with metadata describing the grid the data
lives on (shape, origin, sample spacing, coordinate reference system) and
the meaning of its values (data type, nodata sentinel, units). The data
source can be a NumPy-like array already in memory, a file read on demand,
or a get_data() callable that computes the necessary subset of the data
when invoked. That last option gives DataRaster pull semantics: an
entire processing chain can be assembled in which intermediate steps are
neither written to disk nor ever materialised in their entirety — data is
produced only for the regions that downstream consumers actually request.
Once data is wrapped in a DataRaster, operations that would otherwise
require juggling separate geotransforms, masks, and projection strings —
indexing by physical coordinates, resampling onto another grid, cropping,
reading and writing native file formats — become straightforward method
calls that keep the spatial bookkeeping in sync with the pixel data.
A companion abstraction, the Collection, groups multiple related
DataRasters that belong together — for example time slices of a dataset,
bands from a multispectral instrument, or polarimetric channels from a SAR
acquisition.
gdar-base is the core of the library and has deliberately few
dependencies: NumPy, with optional extras for plotting (matplotlib) and
map-projection support. It forms the foundation for a family of companion
packages that build on the same DataRaster abstraction:
gdar-crs— coordinate reference systems and map projectionsgdar-orbit— satellite orbit propagation and geometrygdar-sar— synthetic-aperture radar processing primitivesgdar-optical— remotely-sensed optical datagafa— geometry- and frequency-agnostic SAR focusing and simulation
GDAR is developed at NORCE and used in production SAR/InSAR processing chains, including InSAR Norge, Norway's national ground-deformation monitoring service developed by NORCE based on GDAR and its precursor GSAR. The core raster machinery is domain-agnostic, however, and equally applicable to any gridded dataset — elevation models, classification maps, time-series stacks, and so on.
Installation
Install from PyPI:
pip install gdar-base
or with uv:
uv pip install gdar-base
Optional extras:
crs— map projections (requires GDAL, see below)plotting— matplotlibinteractive— IPython
pip install "gdar-base[crs,plotting]"
GDAL dependency
GDAL is not required by gdar-base itself, but several downstream
packages (notably gdar-crs) need it. Since geocoding depends on
gdar-crs, many SAR processing workflows will need GDAL.
Packages that depend on GDAL (including gdar-base[crs]) require the
system GDAL library to be installed separately.
Ubuntu
Make sure to install both gdal-bin and libgdal-dev packages.
MacOS
Install using Homebrew:
brew install gdal
Verifying the installation
After installing GDAL, you should be able to run ogrinfo --version
from your shell and see output like
GDAL 3.12.3 "Chicoutimi", released 2026/03/17 (debug build).
Installing the GDAL Python bindings
Pin the Python bindings to the matching system GDAL version:
uv pip install numpy setuptools
uv pip install --no-build-isolation "gdal==$(gdal-config --version)"
Both numpy and setuptools must be installed first because the GDAL
Python bindings build requires them. The --no-build-isolation flag
is needed because of
this issue.
Development
Installing from the NORCE GitLab registry
Internal users and contributors can install pre-release versions from the NORCE GitLab package registry. Two token types are supported:
opengdardeploy token: From theearth-observation/opengdargroup page in GitLab, go to Settings → Repository → Deploy Tokens and create a token with theread_package_registryscope. Note the auto-assigned username (e.g.gitlab+deploy-token-42).- Personal access token:
Create a new access token in GitLab with the
read_apiscope. The username for personal tokens is__token__.
Installing with pip
pip install gdar-base \
--index-url https://<username>:<token>@gitlab.norceresearch.no/api/v4/groups/523/-/packages/pypi/simple
Replace <username> and <token> with the credentials from the
previous step (e.g. gitlab+deploy-token-48 and the token value, or
__token__ and a personal access token).
Installing with uv
Add gdar-base to your project's dependency list and configure the
index in pyproject.toml:
[tool.uv]
no-build-isolation-package = ["gdal"]
[[tool.uv.index]]
name = "opengdar"
url = "https://gitlab.norceresearch.no/api/v4/groups/523/-/packages/pypi/simple"
explicit = true
[tool.uv.sources]
gdar-base = { index = "opengdar" }
The index section tells uv where to find gdar packages.
With explicit = true, only packages listed in [tool.uv.sources]
are fetched from that index; everything else comes from PyPI.
Set the following environment variables to authenticate:
# bash / zsh — for deploy tokens:
export UV_INDEX_OPENGDAR_USERNAME="gitlab+deploy-token-NN"
export UV_INDEX_OPENGDAR_PASSWORD="<deploy_token>"
# or for personal access tokens:
export UV_INDEX_OPENGDAR_USERNAME="__token__"
export UV_INDEX_OPENGDAR_PASSWORD="<personal_token>"
Then sync your environment:
uv sync --extra crs --extra plotting --extra interactive
A sample-pyproject.toml with the full
configuration is included in the repository.
Creating container images
The easiest way to build an image with gdar installed is to start
from one with a sufficiently recent Python preinstalled, along with
GDAL and its Python bindings.
One good source for base images is OSGeo/gdal on GitHub.
Dockerfile and pyproject.toml examples for building a custom image
with GDAR are provided in
this snippet.
Building behind the NORCE firewall (with NORCE SSL certs)
- Place the
Dockerfileandpyproject.tomlfiles in the project root. - Export the SSL certs:
security find-certificate -p -c 'Norwegian Research Centre Root CA' \ /Library/Keychains/System.keychain > ca-certificates.crt
- Build:
docker build \ --secret id=opengdar-token,env=UV_INDEX_OPENGDAR_PASSWORD \ --secret id=ca-certificates,src=ca-certificates.crt \ -t <tag> .
Building without extra certs
Remove lines 4-6 in Dockerfile to disable extra SSL certs, then:
docker build \
--secret id=opengdar-token,env=UV_INDEX_OPENGDAR_PASSWORD \
-t <tag> .
Internal links
- GDAR wiki — central documentation hub
- OpenGDAR API Reference — auto-generated from docstrings
- Release schedule
License
This project is licensed under the Apache License, Version 2.0. You may obtain a copy of the license at https://www.apache.org/licenses/LICENSE-2.0 or in the LICENSE file distributed with this source.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gdar_base-1.2.0.post2.tar.gz.
File metadata
- Download URL: gdar_base-1.2.0.post2.tar.gz
- Upload date:
- Size: 147.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a023a459ef8fb4ced038058921592c245e0dbef8c66f94ddb8bcfe6734d300f
|
|
| MD5 |
5b3f8b3ac6afc24cfa43256269d46d94
|
|
| BLAKE2b-256 |
179e0c6ea49ef5b03c0906efae07c4752573e7e537f6e24d10790e5077f3cac1
|
File details
Details for the file gdar_base-1.2.0.post2-py3-none-any.whl.
File metadata
- Download URL: gdar_base-1.2.0.post2-py3-none-any.whl
- Upload date:
- Size: 140.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f26a619cba0650066eabdf7428c99208a57420be5f45ce3a086a9b208e6545dc
|
|
| MD5 |
5271ee30c31feca71b0bede73ca17b67
|
|
| BLAKE2b-256 |
3c9427ef0a9c0a8ef320c8206f704fea2b05fe3d38d9b122a4df68971706d39a
|