gplately.PresentDayRasterManager

class gplately.PresentDayRasterManager(data_dir='present-day-rasters', raster_manifest=None)[source]

Bases: object

Manage present-day raster metadata retrieval and local raster access.

__init__(data_dir='present-day-rasters', raster_manifest=None)[source]

Create a PresentDayRasterManager instance.

The raster manifest can be provided either as a local file path or as an HTTP(S) URL. If omitted, the default PMM raster manifest endpoint is used.

Parameters:
  • data_dir – Directory where raster files and metadata are stored.

  • raster_manifest – Local path or URL to a present_day_rasters.json manifest. Provide this only when using a custom raster service.

Raises:

Exception – If the manifest source is invalid or cannot be fetched.

Methods

__init__([data_dir, raster_manifest])

Create a PresentDayRasterManager instance.

get_raster(_name[, width, height, bbox, ...])

Download or fetch a raster and return its local file path.

is_wms(_name[, check_raster_avail_flag])

Return whether a raster is served through WMS metadata.

list_present_day_rasters()

Return the list of available present-day raster names.

set_data_dir(data_dir)

Set the directory used to store downloaded raster files.

Attributes

rasters

Return raster metadata loaded from the configured manifest.

get_raster(_name: str, width=1800, height=800, bbox=[-180, -80, 180, 80], large_file_hint=True)[source]

Download or fetch a raster and return its local file path.

For file-based rasters, this method downloads and caches files under self.data_dir. For WMS rasters, it requests a GeoTIFF with the given output dimensions and bounding box, and caches the result using a hash of the WMS request URL.

Call list_present_day_rasters() to inspect available raster names.

Parameters:
  • _name (str) – The raster name of interest.

  • width (int) – Output raster width in pixels for WMS requests.

  • height (int) – Output raster height in pixels for WMS requests.

  • bbox (list[float]) – Geographic bounding box [min_lon, min_lat, max_lon, max_lat] used for WMS requests.

  • large_file_hint (bool) – Passed to file downloader to optimize large-file handling for non-WMS rasters.

Returns:

Local path to the downloaded or cached raster file.

Return type:

str

Raises:
  • RasterNameNotFound – If the raster name is not in the manifest.

  • Exception – If raster retrieval fails.

is_wms(_name: str, check_raster_avail_flag=True)[source]

Return whether a raster is served through WMS metadata.

Parameters:
  • _name (str) – The raster name of interest.

  • check_raster_avail_flag (bool) – If True, validate the raster name against the loaded manifest before checking service type.

Returns:

True when the raster metadata marks the service as WMS; otherwise False.

Return type:

bool

list_present_day_rasters()[source]

Return the list of available present-day raster names.

Returns:

Available raster names from the manifest.

Return type:

list[str]

property rasters: Dict

Return raster metadata loaded from the configured manifest.

Returns:

Mapping of raster names to raster metadata.

Return type:

Dict

Raises:

Exception – If raster metadata is unexpectedly unavailable.

set_data_dir(data_dir)[source]

Set the directory used to store downloaded raster files.

Parameters:

data_dir – Directory path for local raster data.