ogs5py.fileclasses.RFR
- class ogs5py.fileclasses.RFR(variables=None, data=None, units=None, headers=None, name=None, file_ext='.rfr', task_root=None, task_id='model')[source]
Bases:
File
Class for the ogs RESTART file, if the DIS_TYPE in IC is set to RESTART.
- Parameters:
variables (
list
ofstr
, optional) – List of variable names. Default:None
data (
numpy.ndarray
, optional) – RFR data. 2D array, where the first dimension is the number of variables. Default:None
units (
list
ofstr
, optional) – List of units for the occurring variables. Can be None. OGS5 ignores them anyway. Default:None
headers (str or None, optional) – First four lines of the RFR file. If
None
, a standard header is written. Default:None
name (str, optional) – File name for the RFR file. If
None
, the task_id is used. Default:None
file_ext (
str
, optional) – extension of the file (with leading dot “.rfr”) Default: “.rfr”task_root (str, optional) – Path to the destiny model folder. Default: cwd+”ogs5model”
task_id (str, optional) – Name for the ogs task. Default: “model”
Notes
- First line (ignored):
#0#0#0#1#100000#0… (don’t ask why)
- Second line (ignored):
1 1 4 (don’t ask why)
- Third line (information about Variables):
(No. of Var.) (No of data of 1. Var) (No of data of 2. Var) …
1 1 (example: 1 Variable with 1 component)
2 1 1 (example: 2 Variables with 1 component each)
only 1 scalar per Variable allowed (bug in OGS5). See: https://github.com/ufz/ogs5/issues/151
- Fourth line (Variable names and units):
(Name1), (Unit1), (Name2), (Unit2), …
units are ignored
- Data (multiple lines):
(index) (Var1data1) .. (Var1dataN1) (Var2data1) .. (Var2dataN2) …
- Keyword documentation:
https://ogs5-keywords.netlify.com/ogs/wiki/public/doc-auto/by_ext/ic
- Reading routines:
https://github.com/ufz/ogs5/blob/master/FEM/rf_ic_new.cpp#L932
- Attributes:
data
Data in the RFR file.
file_name
str
: base name of the file with extension.file_path
str
: save path of the file.force_writing
bool
: state if the file is written even if empty.is_empty
State if the OGS file is empty.
name
str
: name of the file without extension.units
List of variable-units in the RFR file.
var_count
Count of variables in the RFR file (line 3).
var_info
Infos about variables and units in the RFR file (line 4).
variables
List of variables in the RFR file.
Methods
add_copy_link
(path[, symlink])Add a link to copy a file instead of writing.
check
([verbose])Check if the external geometry definition is valid.
Remove a former given link to an external file.
Get the OGS file class name.
read_file
(path[, encoding, verbose])Write the actual RFR input file to the given folder.
reset
()Delete every content.
save
(path, **kwargs)Save the actual RFR external file in the given path.
Write the actual OGS input file to the given folder.
- add_copy_link(path, symlink=False)
Add a link to copy a file instead of writing.
Instead of writing a file, you can give a path to an existing file, that will be copied/linked to the target folder.
- Parameters:
path (str) – path to the existing file that should be copied
symlink (bool, optional) – on UNIX systems it is possible to use a symbolic link to save time if the file is big. Default: False
- check(verbose=True)[source]
Check if the external geometry definition is valid.
In the sence, that the contained data is consistent.
- Parameters:
verbose (bool, optional) – Print information for the executed checks. Default: True
- Returns:
result – Validity of the given gli.
- Return type:
- del_copy_link()
Remove a former given link to an external file.
- get_file_type()
Get the OGS file class name.
- read_file(path, encoding=None, verbose=False)[source]
Write the actual RFR input file to the given folder.
- reset()
Delete every content.
- save(path, **kwargs)[source]
Save the actual RFR external file in the given path.
- Parameters:
path (str) – path to where to file should be saved
- write_file()
Write the actual OGS input file to the given folder.
Its path is given by “task_root+task_id+file_ext”.
- property data
Data in the RFR file.
- property is_empty
State if the OGS file is empty.
- property units
List of variable-units in the RFR file.
- property var_count
Count of variables in the RFR file (line 3).
- property var_info
Infos about variables and units in the RFR file (line 4).
- property variables
List of variables in the RFR file.