TimeAtlas Client

The TimeAtlas client provides a Python interface for interacting with the TimeAtlas API.

Main Client Class

class timeatlas.TimeAtlas.TimeAtlas[source]

Bases: object

default_save_cache_filepath = 'rde_entity_cache.pkl'
__init__(api_url)[source]
Parameters:

api_url (str)

entity_cache = {}
save_entity_cache_to_file(filepath=None)[source]
Parameters:

filepath (str)

get_single_rde_object(endpoint, uuid)[source]
Parameters:
Return type:

RDE

get_all_results_from_endpoint(endpoint, per_page=1000)[source]
Parameters:
  • endpoint (str)

  • per_page (int)

Return type:

list[dict]

get_dataset(dataset_uuid)[source]
Parameters:

dataset_uuid (str)

Return type:

Dataset

get_dataset_by_slug(slug)[source]
Parameters:

slug (str)

Return type:

Dataset

generate_all_hr_from_dataset(dataset)[source]
Parameters:

dataset (Dataset)

Return type:

list[HistoricalRecord]

generate_obs_from_list_of_hr(hr_list)[source]
Parameters:

hr_list (list[HistoricalRecord])

Return type:

list[Observation]

generate_geoms_from_list_of_obs(obs_list)[source]
Parameters:

obs_list (list[Observation])

Return type:

list[Geometry]

generate_pois_from_list_of_obs(obs_list)[source]
Parameters:

obs_list (list[Observation])

Return type:

list[PointOfInterest]

materialize_all_rde_from_dataset_obj(dataset)[source]
Parameters:

dataset (Dataset)

Return type:

list[RDE]

materialize_all_rde_from_dataset_slug(dataset_slug)[source]
Parameters:

dataset_slug (str)

Return type:

list[RDE]

static hr_list_to_dataframe(hr_list)[source]
Parameters:

hr_list (list[HistoricalRecord])

Return type:

DataFrame

Usage Examples

Basic Usage

from timeatlas import TimeAtlas

# Initialize the client
client = TimeAtlas(api_url='https://your-timeatlas-instance.com/v1')

# Fetch a single RDE object
entity = client.get_single_rde_object('historical-records', 'uuid-here')

# Save entity cache to file
client.save_entity_cache_to_file('my_cache.pkl')

Working with Cached Entities

The TimeAtlas client maintains an internal cache of fetched entities for improved performance. The cache is automatically saved to disk and loaded on subsequent client initializations.

# Cache is automatically loaded from default file on initialization
client = TimeAtlas(api_url='https://api.example.com/v1')

# Save cache to custom location
client.save_entity_cache_to_file('custom_cache.pkl')