iode.Scalars
- class iode.Scalars(filepath: str = None)[source]
IODE Scalars database.
- Parameters:
- filepath: str, optional
file containing the IODE scalars to load.
- Attributes:
- filename: str
- description: str
Methods
clear()Delete all objects from the current database.
compare(filepath[, ...])The objects of the current database are compared with those stored in the file filepath.
copy([pattern])Create a new database instance in which each object is a copy of the original object from the global IODE database.
copy_from(input_files[, names])Copy (a subset of) scalars from the input file(s) 'input_files' into the current database.
from_frame(df)Copy the pandas DataFrame df into the IODE Scalars database.
from_series(s)Copy the pandas Series s into the IODE Scalars database.
get_name(pos)Return the name of the IODE object at position pos in the database.
get_names([pattern, filepath])Returns the list of objects names given a pattern.
get_names_from_pattern(list_name, pattern, xdim)Generate an IODE list containing the names of objects that match a given pattern.
index(name)Return the position of the IODE object with name name in the database.
load(filepath)Load objects stored in file 'filepath' into the current database.
merge(other[, overwrite])Merge the content of the 'other' database into the current database.
merge_from(input_file)Merge all objects stored in the input file 'input_file' into the current database.
Create a new empty detached database.
print_to_file(filepath[, names, format])Print the list scalars defined by names to the file filepath using the format format.
remove(names)Delete the object(s) named 'names' from the current database.
rename(old_name, new_name[, overwrite])Rename an object of the database.
save(filepath[, compress])Save objects of the current database into the file 'filepath'.
search(pattern[, word, case_sensitive, ...])Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment...
subset(pattern, copy)Create a subset of the database filtered by a name pattern.
to_frame()Create a pandas DataFrame from the current Scalars database.
from_cython_obj
get_instance
- Returns:
- Scalars
Examples
>>> from iode import scalars, SAMPLE_DATA_DIR >>> scalars.load(f"{SAMPLE_DATA_DIR}/fun.scl") Loading .../fun.scl 161 objects loaded >>> len(scalars) 161 >>> scalars Workspace: Scalars nb scalars: 161 filename: ...\tests\data\fun.scl name value relax std acaf1 0.0158 1.0000 0.0014 acaf2 -0.0000 1.0000 0.0000 acaf3 2.5026 1.0000 0.8730 acaf4 -0.0085 1.0000 0.0021 dlnpaf 0.9000 1.0000 na ... ... ... ... y6 0.0000 0.0000 0.0000 y7 -0.1550 1.0000 0.3239 zkf1 0.2011 1.0000 0.3757 zkf2 0.7921 1.0000 0.1812 zkf3 -7.2712 1.0000 2.6764
Methods
__init__([filepath])clear()Delete all objects from the current database.
compare(filepath[, ...])The objects of the current database are compared with those stored in the file filepath.
copy([pattern])Create a new database instance in which each object is a copy of the original object from the global IODE database.
copy_from(input_files[, names])Copy (a subset of) scalars from the input file(s) 'input_files' into the current database.
from_cython_obj(obj)from_frame(df)Copy the pandas DataFrame df into the IODE Scalars database.
from_series(s)Copy the pandas Series s into the IODE Scalars database.
get_instance()get_name(pos)Return the name of the IODE object at position pos in the database.
get_names([pattern, filepath])Returns the list of objects names given a pattern.
get_names_from_pattern(list_name, pattern, xdim)Generate an IODE list containing the names of objects that match a given pattern.
index(name)Return the position of the IODE object with name name in the database.
load(filepath)Load objects stored in file 'filepath' into the current database.
merge(other[, overwrite])Merge the content of the 'other' database into the current database.
merge_from(input_file)Merge all objects stored in the input file 'input_file' into the current database.
Create a new empty detached database.
print_to_file(filepath[, names, format])Print the list scalars defined by names to the file filepath using the format format.
remove(names)Delete the object(s) named 'names' from the current database.
rename(old_name, new_name[, overwrite])Rename an object of the database.
save(filepath[, compress])Save objects of the current database into the file 'filepath'.
search(pattern[, word, case_sensitive, ...])Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment...
subset(pattern, copy)Create a subset of the database filtered by a name pattern.
to_frame()Create a pandas DataFrame from the current Scalars database.
Attributes
Description of the current database.
Create a pandas DataFrame from the current Scalars database.
Return the filepath associated with the current database.
Allow to select the ith scalar in the database.
Return the object type of the current database.
Whether or not any change made on the present database or subset will modify the global IODE workspace.
Whether or not the present database represents the global IODE workspace.
List of names of all objects in the current database.
Number of decimals to print.