Skip to main content

API Reference

Every public symbol in freezebase, grouped by the module that defines it.

MGRS grid

10 km MGRS grid squares to align raster data onto one common grid.

mgrs.MGRSGrid

The 10 km MGRS squares intersecting an area of interest.

mgrs.MGRSGeoBox

A 10 x 10 km MGRS square backed by odc.geo.GeoBox.

mgrs.UTMZones

All UTM zones in WGS84, including Norway and Svalbard exceptions.

mgrs.mgrs_to_crs()

Return the UTM CRS for an MGRS reference.

mgrs.utm_to_crs()

Return the CRS for a UTM zone and hemisphere.

mgrs.utms_to_epsgs()

Convert UTM zones and hemispheres to EPSG codes.

mgrs.transform_shapely()

Transform Shapely geometries between CRSs.

Raster I/O

rasterio helpers that accept local paths and s3:// URIs via UPath.

raster.rasterio_open()

Open a local, S3-backed or public HTTP(S) rasterio dataset.

raster.rewrite_tiff()

Rewrite a raster file or VRT locally or on S3 while preserving metadata.

raster.write_cog()

Write an array, a VRT or a raster file as a Cloud Optimized GeoTIFF.

raster.build_rasterio_profile()

Merge profiles over RASTERIO_PROFILE_DEFAULTS in order.

raster.group_tiffs_by_crs()

Group GeoTIFFs by CRS.

raster.get_utm_zone_string()

Return a zero-padded UTM zone identifier.

raster.get_epsg_string()

Return an EPSG:<code> identifier.

raster.utm_zone_to_crs()

Create a CRS from a UTM zone.

raster.http_env()

Return a rasterio environment for public HTTP(S) sources, without credentials.

raster.COG_PROFILE

Default GDAL COG creation profile.

raster.GDAL_HTTP_OPTIONS

GDAL configuration for reading public http(s) rasters through /vsicurl/.

raster.RASTERIO_PROFILE_DEFAULTS

Suitable defaults for a Cloud-optimized GeoTIFF (COG).

raster.AnyPath

VRT generation

Inspectable VRTs: build, edit, read and write without the GDAL Python bindings

vrt.VRT

A GDAL Virtual Dataset.

vrt.Band

One VRT band.

vrt.Source

One band of a file or nested VRT drawn into a VRT band.

vrt.PixelFunction

A GDAL built-in pixel function applied by a derived band.

vrt.SourceProperties

Header of a source raster, as gdalbuildvrt records it.

vrt.Warp

The warp of a warped VRT.

vrt.mosaic()

Mosaic tiles of any band count on one grid; later sources draw over earlier ones.

vrt.reproject()

Reproject a raster or VRT onto another grid.

vrt.stack()

Stack the bands of sources on one grid as successive bands.

vrt.derive()

Derive bands from rasters or VRTs with a GDAL pixel function.

vrt.from_raster()

Build a 1:1 VRT over one raster file.

vrt.read()

Read a VRT file into the model.

Downloads

HTTP downloads with UPath destinations

download.HTTPDownloader

Stream HTTP downloads through a reusable session.

download.retry_request()

Create a tenacity retry decorator for HTTP requests using the requests library.

Errors

Exceptions specific to freezebase

errors.FreezebaseError

Base class for freezebase-specific errors.

errors.DownloadError

A download could not be completed.

errors.RasterWriteError

A raster could not be written.

S3

S3 UPath construction and retry configuration

s3.make_s3_upath()

Build an S3 UPath with shared authentication and retries.

s3.s3_env()

Enter a rasterio environment configured from an S3 UPath.

s3.subprocess_s3_env()

Build the S3 settings a child process needs, as environment variables.

s3.aws_session()

Return a cached rasterio AWSSession for an S3 path.

s3.clear_aws_session_cache()

Clear cached AWS sessions and configured endpoints.

s3.resolve_endpoint_url()

Return the endpoint an S3 path’s requests go to.

s3.configured_endpoint_url()

Return the S3 endpoint the AWS configuration sets for a profile, if any.

s3.list_object_sizes()

List a prefix as {relative path: size} from one listing call.

s3.atomic_write_text()

Write a text file so that a reader never sees it half-written.

s3.upload_object()

Upload bytes or a local file to an object store and confirm it arrived.

s3.content_type_for()

Return the content type an object should be served as, by its suffix.

s3.CONTENT_TYPES

S3 settings

Connection settings read from prefixed environment variables

settings.S3Settings

S3 profile and botocore tuning from <PREFIX>ENDPOINT_URL and friends.

settings.ChecksumPolicy
settings.AnyDir

Vector data

Cached vector datasets and GeoDataFrame helpers

vectordata.GeoVectorData

Base class for cached geospatial vector datasets.

vectordata.DatasetMetadata

Metadata container for dataset attribution and licensing.

vectools.write_parquet()

Atomically write a GeoDataFrame as zstd-compressed GeoParquet.

vectools.drop_z_if_zero()

Drop the Z axis when every Z coordinate is zero.

vectools.is_z_axis_zero()

Return whether every Z coordinate is zero.

vectools.simplify_multipolygons()

Convert single-part MultiPolygons to Polygons.

Utilities

Shared helpers used across the package

set_loglevel()

Set the package log level.

utils.get_cache_dir()

Get cache directory with fallback to system cache.

utils.get_data_dir()

Return the explicit or FREEZEBASE_DATA directory.

utils.get_credentials_from_env()

Read a non-empty username and password from the environment.

utils.depends_on_optional()

Require an optional dependency when the decorated function is called.

utils.file_sha256()

Return a file’s SHA-256 hex digest, read in chunks.

utils.shorten_string()

Shorten a string to n characters with a middle ellipsis.

utils.format_valid_options()

Format dictionary items as a bullet list.

pandas_utils.clean_names()

Normalize DataFrame column names.

progress.create_progress()

Create a rich progress bar with a custom column layout.

progress.track_progress()

Yield items while tracking progress with the shared layout.

Deprecated

Superseded functions, kept for now; each warns and names its replacement

vrt.build_vrt_mosaic()

Mosaic aligned tiles into a VRT.

vrt.create_warped_vrt()

Create a warped VRT reprojecting a raster onto a fixed target grid.

vrt.create_decibel_vrt()

Create a VRT applying a decibel conversion.

vrt.create_rgb_vrt()

Create a 3-band RGB VRT from VV and VH rasters.

vrt.create_rgba_vrt()

Create a 4-band uint8 RGBA VRT colour-mapping a raster through lookup tables.