Skip to content

client.l2cache

Client for interacting with the level2 cache service.

Methods:

Name Description
cache_metadata

Retrieves the meta data for the cache

get_l2data

Gets the attributed statistics data for L2 ids.

get_l2data_table

Gets the attributed statistics data for L2 ids, returned as a dataframe.

has_cache

Checks if the l2 cache is available for the dataset

table_mapping

Retrieves table mappings for l2 cache.

Attributes:

Name Type Description
server_version Optional[Version]

The version of the service running on the remote server. Note that this

server_version: Optional[Version] property

The version of the service running on the remote server. Note that this refers to the software running on the server and has nothing to do with the version of the datastack itself.

cache_metadata()

Retrieves the meta data for the cache

Returns:

Type Description
dict

keys are attribute names, values are datatypes

get_l2data(l2_ids, attributes=None)

Gets the attributed statistics data for L2 ids.

Parameters:

Name Type Description Default
l2_ids list or ndarray

A list of level 2 ids.

required
attributes list

A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

  • area_nm2
  • chunk_intersect_count
  • max_dt_nm
  • mean_dt_nm
  • pca
  • pca_val
  • rep_coord_nm
  • size_nm3

See the tutorial for more description.

None

Returns:

Type Description
dict

Keys are l2 ids, values are data.

get_l2data_table(l2_ids, attributes=None, split_columns=True)

Gets the attributed statistics data for L2 ids, returned as a dataframe.

Parameters:

Name Type Description Default
l2_ids list or ndarray

A list of level 2 ids.

required
attributes list

A list of attributes to retrieve. Defaults to None, which will return all that are available. Available stats are:

  • area_nm2
  • chunk_intersect_count
  • max_dt_nm
  • mean_dt_nm
  • pca
  • pca_val
  • rep_coord_nm
  • size_nm3

See the tutorial for more description.

None
split_columns bool

Whether to split columns with multiple values into separate columns.

True

Returns:

Type Description
DataFrame

A pandas dataframe with the requested attributes as columns and indexed by l2_id.

has_cache(datastack_name=None)

Checks if the l2 cache is available for the dataset

Parameters:

Name Type Description Default
datastack_name str

The name of the datastack to check, by default None (if None, uses the client's datastack)

None

Returns:

Type Description
bool

True if the l2 cache is available, False otherwise

table_mapping()

Retrieves table mappings for l2 cache.

Returns:

Type Description
dict

keys are pcg table names, values are dicts with fields l2cache_id and cv_path.