-
Notifications
You must be signed in to change notification settings - Fork 6
Python Binout
PucklaJ edited this page Aug 14, 2023
·
2 revisions
This class is used to open and read data from a binout file (or multiple files by globbing)
def __init__(file_name: str)
Open a binout file (or multiple files by globbing) and parse its records to be ready to read data.
- file_name The path to the binout file or glob pattern
def read(self, path_to_variable: str) -> Int8Array | Uint8Array | Int16Array | Int32Array | Uint32Array | Int64Array | Uint64Array | FloatArray | DoubleArray | List[FloatArray] | List[DoubleArray] | List[String]
Read data from the file. All string values inside a binout are usually an Int8Array. If the path provided points to a folder the children of said folder will be returned.
-
path_to_variable The path to the variable inside the binout (e.g.
nodout/ids
)
def get_type_id(self, path_to_variable: str) -> BinoutType
Returns the type id of the given variable.
-
path_to_variable The path to the variable inside the binout (e.g.
/nodout/metadata/ids
)
def variable_exists(self, path_to_variable: str) -> bool
Returns whether a record with the given path and variable name exists.
-
path_to_variable The path to the variable inside the binout (e.g.
/nodout/metadata/ids
)
def get_num_timesteps(self, path: str) -> int
Returns the number of dxxxxxx folders inside of a given path. Each folder inside a binout can have a different number of time steps. This method is used to get the time steps of one single folder (e.g. /nodout
or /rcforc
).
-
path The path to a folder inside the binout (e.g.
/nodout
or/rcforc
)