Skip to main content

freezebase

PyPI Python versions License CI codecov pyrefly Ruff

MGRS grids, S3 paths and GDAL VRTs for raster I/O in Python.

  • MGRS grid: Build the 10 km MGRS squares over any area between 80°S and 84°N. Rasters resampled onto the same square line up pixel for pixel.
  • S3 paths: Read and write rasters on S3 as if they were local files, with credentials and endpoint set per path.
  • VRTs: Mosaic and reproject rasters as one lazy chain of GDAL virtual rasters, then write a Cloud Optimized GeoTIFF. No GDAL bindings or command-line tools needed.

Installation

Requires Python 3.12 or newer, and uv or pip.

freezebase is on PyPI:

# uv
uv add freezebase

# pip
pip install freezebase

S3 support needs the s3 extra, which adds s3fs, fsspec, boto3 and pydantic-settings:

uv add "freezebase[s3]"

MGRS quick start

Build the 10 km grid covering an area of interest:

from shapely import box

from freezebase.mgrs import MGRSGrid

grid = MGRSGrid(box(8.4, 47.3, 8.6, 47.5))  # Zurich, WGS84
gdf = grid.to_geodataframe()  # mgrs_code, zone, epsg, geometry, ...
square = grid[0]  # an odc.geo GeoBox per grid square

Each square is an MGRSGeoBox, a subclass of odc.geo.GeoBox with a fixed CRS, transform and shape, so rasters resampled onto the same square at the same resolution line up pixel for pixel. You can also rebuild a square from its code alone, without building a grid:

from freezebase.mgrs import MGRSGeoBox

square = MGRSGeoBox.from_mgrs("32TMT55", resolution=10.0)  # 1000 x 1000 px, EPSG:32632

See The MGRS grid for why freezebase uses a fixed grid.

Rasters on S3

freezebase connects Rasterio with Universal Pathlib: an S3 path carries its own credentials and endpoint, and both file operations and raster reads and writes use them.

Any S3-compatible bucket works. A named AWS profile selects the credentials without putting keys in your code:

from freezebase.s3 import make_s3_upath

s3_path = make_s3_upath(
    "s3://my-bucket/data",
    profile="example",
    endpoint_url="https://objects.example.org",
)
# No AWS credentials required
s3_anon_path = make_s3_upath("s3://copernicus-dem-30m/", anon=True)

The same path works with pathlib methods such as exists() and with Rasterio:

from freezebase.raster import rasterio_open

scene = s3_path / "scene.tif"
if scene.exists():
    with rasterio_open(scene) as src:
        data = src.read(1)

See Accessing S3 for authentication and custom endpoints, and Reading and writing rasters for COG writes and copies between buckets.

VRTs

freezebase.vrt builds GDAL VRTs in Python, without the GDAL command-line tools. A VRT describes a raster built from other rasters without copying their pixels, which makes it a cheap way to chain steps such as mosaicking, reprojecting and writing a Cloud Optimized GeoTIFF. This mosaics two Copernicus DEM tiles and reprojects them onto an MGRS square:

from rasterio.enums import Resampling

from freezebase import vrt
from freezebase.mgrs import MGRSGeoBox

square = MGRSGeoBox.from_mgrs("32TMS25", resolution=20.0)
names = [f"Copernicus_DSM_COG_10_N46_00_E{lon:03d}_00_DEM" for lon in (7, 8)]
tiles = [f"https://copernicus-dem-30m.s3.amazonaws.com/{n}/{n}.tif" for n in names]

dem = vrt.mosaic(tiles).reproject(
    crs=f"EPSG:{square.crs.epsg}",
    resolution=20.0,
    bounds=square.boundingbox,
    resampling=Resampling.bilinear,
)
dem.to_cog("32TMS25.tif")

GDAL reads pixels only when to_cog runs, and then only the blocks under the square: about 4 MB of the two 42 MB tiles. The tiles can be local, on S3 or over HTTPS, and the COG local or on S3. See VRTs for the other steps and VRT recipes for worked examples.

Documentation

Full documentation, including guides to the MGRS grid, rasters on S3 and VRTs, is at https://lqgentner.github.io/freezebase/.

Support

Please file bugs and questions on the issue tracker.

Contributing

git clone https://github.com/lqgentner/freezebase.git
cd freezebase
uv sync --all-extras
uv run pytest

See the contributing guide for the full checks, the S3 integration tests and how to build the docs.

Metadata

Release files for freezebase 0.13.0

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

Source distribution (sdist)

Source distribution for freezebase 0.13.0
File Size Uploaded Provenance Actions
freezebase-0.13.0.tar.gz 773.5 kB With provenance Details for freezebase-0.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for freezebase 0.13.0
File Interpreter ABI Platform Actions
freezebase-0.13.0-py3-none-any.whl Python 3 none any Details for freezebase-0.13.0-py3-none-any.whl

Total release size: 889.7 kB

Release files / freezebase-0.13.0.tar.gz

Download URL freezebase-0.13.0.tar.gz
Size 773.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b3ce1172a41ca258bb586ebdf73293261f60ea99af0b1f47555b3f14806f8436
BLAKE2b-256 checksum
How to use checksums
a014faf78d7c00d6b29e7b0c1a083735d3336504a6b4d091dae77a1863fe6c42
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 Nov 27, 2026.

Transparency log

Release files / freezebase-0.13.0-py3-none-any.whl

Download URL freezebase-0.13.0-py3-none-any.whl
Size 116.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9a68ac92810c6af904c82ecfb3f241888552607c3009d658031c5bc2b6c0553
BLAKE2b-256 checksum
How to use checksums
5b21c5abfeb7f91d4ac614b544c059fb0e3ff3483617a5ab312b4efeeec46aa5
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 Nov 27, 2026.

Transparency log

Security for freezebase 0.13.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for freezebase-0.13.0.tar.gz

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 Nov 27, 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