Datasets

Container of Instant.

Classes Zone and Window inherit from Datasets.


Detailed Class Documentation

class antares.api.datasets.Datasets(other=None, inherit_computer=None)

Container of Instant.

Methods

add_computer_function(new_func)

Set a new function.

clear()

compute(var_name[, location, reset, store])

Compute a given variable on the whole zone.

compute_bounding_box(coordinates)

Compute the bounding box of the zone with respect to the coordinates.

compute_coordinate_system([ttype, ...])

Compute a new coordinate system in the Datasets.

copy()

delete_variables(list_vars[, location])

Delete variables in the dataset.

dimension()

Dimension of the Dataset.

duplicate_variables(list_vars, list_newvars)

Duplicate variables in the dataset.

fromkeys(iterable[, value])

get(k[,d])

get_location(location, new_dataset)

Return a copy of the Datasets containing only the variables located in the original Datasets at the specified location.

get_shape()

Get the shape of the dataset.

is_structured()

Tell whether the zone is a structured mesh or not.

items()

keys()

Return keys as a list and not KeysView nor dict_keys.

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem()

as a 2-tuple; but raise KeyError if D is empty.

rel_to_abs([coordinates, conservative_vars, ...])

Transform conservative variables from relative frame to absolute frame by looping on all instants using the Instant.rel_to_abs() method.

rename_variables(list_vars, list_newvars[, ...])

Rename variables in the dataset.

set_computer_model(modeling[, ...])

Set a computer modeling for the zone.

set_formula(formula)

Set a formula for the dataset (Zone or Boundary).

set_formula_from_attrs(name)

Set a formula from a name in the dataset attribute.

setdefault(k[,d])

update([E, ]**F)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values()

Attributes

attrs

Dictionary antares.core.AttrsManagement.AttrsManagement containing the attributes of the Datasets.

shared

Attribute (of type Instant) containing variables shared for all the Instants contained in the Datasets.

add_computer_function(new_func)

Set a new function.

The computer will receive a new function associated to its current modeling.

compute(var_name, location=None, reset=False, store=True)

Compute a given variable on the whole zone.

This variable is computed on all instants of the zone.

Use the Instant.compute() method.

Parameters:
  • var_name (str) – The name of the variable to compute.

  • location (str in LOCATIONS) – The location of the variable. If None, the default location is assumed.

  • reset (bool) – Remove temporary fields stored in the equation manager.

  • store (bool) – Store temporary fields in the equation manager.

compute_bounding_box(coordinates)

Compute the bounding box of the zone with respect to the coordinates.

Parameters:

coordinates (list(str)) – list of variable names

Returns:

the bounding box

Return type:

dictionary with key: variable names, value: list with min and max values

compute_coordinate_system(ttype='cartesian2cylindrical', remove_current=False, current_coord_sys=['x', 'y', 'z'], new_coord_sys=['x', 'r', 'theta'], origin=[0.0, 0.0, 0.0])

Compute a new coordinate system in the Datasets.

Parameters:
  • ttype (str in ['cartesian2cylindrical', 'cylindrical2cartesian']) – type of transformation

  • remove_current (bool) – remove current coordinate system after transformation

  • current_coord_sys (list of 3 str) – names of the current coordinates

  • new_coord_sys (list of 3 str) – names of the new coordinates

  • origin (list of 3 float) – position of the origin

Warning

‘cylindrical2cartesian’ not implemented

for ‘ttype’=’cartesian2cylindrical’, in ‘new_coord_sys’, the first coordinate is the axial direction, the second the radial one, and the third the azimuthal one (by default (x, r, \(\theta\)))

The first coordinate name in ‘new_coord_sys’ must also be into ‘current_coord_sys’.

delete_variables(list_vars, location=None)

Delete variables in the dataset.

Parameters:
  • list_vars (list(str)) – list of variables to delete

  • location (str in LOCATIONS or ‘None’) – if None, delete the variables at the all locations

equivalent to del zone[:, :, list_vars] which uses del with zone slicing instead.

dimension()

Dimension of the Dataset.

Returns:

dimension of the Datasets

Return type:

int

duplicate_variables(list_vars, list_newvars, location=None)

Duplicate variables in the dataset.

Parameters:
  • list_vars (list(str)) – list of variables to duplicate

  • list_newvars (list(str)) – list of new variable names

  • location (str in LOCATIONS) – if different from None, change only the variables at the location specified

Duplication is performed element-wise.

get_location(location, new_dataset)

Return a copy of the Datasets containing only the variables located in the original Datasets at the specified location.

Parameters:
  • location (string in LOCATIONS) – location to extract

  • new_dataset (Datasets) – The dataset that will contain the variables located at the given location.

Returns:

the Datasets with only specified location variables

Return type:

Datasets or None

get_shape()

Get the shape of the dataset.

The shape is the shape of the node values, either taken from the shared instant, or taken from the first instant.

Returns:

the shape

Return type:

tuple

is_structured()

Tell whether the zone is a structured mesh or not.

Note

all instants are supposed to be of the same kind.

Return type:

bool

rel_to_abs(coordinates=None, conservative_vars=None, omega='in_attr', angle='in_attr')

Transform conservative variables from relative frame to absolute frame by looping on all instants using the Instant.rel_to_abs() method.

Parameters:
  • coordinates (list(str)) – list of coordinates names

  • conservative_vars (list(str)) – list of conservative variables names in the following order: density, momentum along the x-axis; momentum along the y-axis, momentum along the z-axis and total energy per unit of volume

  • omega (float) – angular speed of the current base. If in_attr use the omega stored in the attrs, necessary if different angular speeds in the base (for example one angular speed per superblock)

  • angle (float) – angular deviation of the current base. If in_attr use the angle stored in the attrs, necessary if different angular deviations in the base (for example one angular deviation per superblock and per instant)

Note

may be moved elsewhere in future releases

Warning

the angular speed must be perpendicular to the x-axis

rename_variables(list_vars, list_newvars, location=None)

Rename variables in the dataset.

Parameters:
  • list_vars (list(str)) – list of variables to rename

  • list_newvars (list(str)) – list of new variable names

  • location (str in LOCATIONS) – if different from None, change only the variables at the location specified

Replacement is performed element-wise.

set_computer_model(modeling, species_database=None, addons=None)

Set a computer modeling for the zone.

See antares.api.Instant.Instant.set_computer_model().

set_formula(formula)

Set a formula for the dataset (Zone or Boundary).

See antares.api.Instant.Instant.set_formula()

set_formula_from_attrs(name)

Set a formula from a name in the dataset attribute.

The computer will receive a new formula associated to its current modeling. This formula is included in the zone attribute with the key name.

property attrs

Dictionary antares.core.AttrsManagement.AttrsManagement containing the attributes of the Datasets.

property shared

Attribute (of type Instant) containing variables shared for all the Instants contained in the Datasets.