gplately.PresentDayRasterManager
- class gplately.PresentDayRasterManager(data_dir='present-day-rasters', raster_manifest=None)[source]
Bases:
objectManage present-day raster metadata retrieval and local raster access.
- __init__(data_dir='present-day-rasters', raster_manifest=None)[source]
Create a
PresentDayRasterManagerinstance.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.jsonmanifest. 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
PresentDayRasterManagerinstance.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.
Return the list of available present-day raster names.
set_data_dir(data_dir)Set the directory used to store downloaded raster files.
Attributes
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:
- 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.