energy_data_retrieval.sources.chelsa.client#
Crop pinned CHELSA v2.1 climatology COGs without downloading global rasters.
- energy_data_retrieval.sources.chelsa.client.sha256(path)[source]#
- Parameters:
path (Path)
- Return type:
str
- class energy_data_retrieval.sources.chelsa.client.RangeReader(http, url, size, etag, *, block_size=1048576, maximum_bytes=64000000)[source]#
Bases:
RawIOBaseSeekable HTTP ranges with exact response validation and bounded memory/I/O.
The source-specific caller fixes the URL, size and strong ETag. Every read carries If-Match; an ETag is a version validator, not a SHA-256 checksum. No redirects or full-body fallbacks are accepted. The caller owns HTTP.
- Parameters:
http (httpx.Client)
url (str)
size (int)
etag (str)
block_size (int)
maximum_bytes (int)
- readable()[source]#
Return whether object was opened for reading.
If False, read() will raise OSError.
- Return type:
bool
- seekable()[source]#
Return whether object supports random access.
If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().
- Return type:
bool
- seek(offset, whence=0)[source]#
Change the stream position to the given byte offset.
- offset
The stream position, relative to ‘whence’.
- whence
The relative position to seek from.
The offset is interpreted relative to the position indicated by whence. Values for whence are:
os.SEEK_SET or 0 – start of stream (the default); offset should be zero or positive
os.SEEK_CUR or 1 – current stream position; offset may be negative
os.SEEK_END or 2 – end of stream; offset is usually negative
Return the new absolute position.
- Parameters:
offset (int)
whence (int)
- Return type:
int
- class energy_data_retrieval.sources.chelsa.client.CHELSAClient(http)[source]#
Bases:
objectExplicit acquisition of native tas/pr windows for baseline 1981-2010.
- Parameters:
http (httpx.Client)
- download_window(directory, variable, month, bounds, *, expected_etag=None, expected_pixels_sha256=None)[source]#
- Parameters:
directory (Path)
variable (str)
month (int)
bounds (tuple[float, float, float, float])
expected_etag (str | None)
expected_pixels_sha256 (str | None)
- Return type:
tuple[Path, dict]