pyopmnearwell.ml.resdata_dataset module#
This module provides functionality to parse *.UNRST files for given keywords and
transform the extracted values into a tensorflow dataset.
Note: Some manual changes are needed if the tensors of the dataset shall have a shape different from the default one. The lines that need to be changed are marked with # MANUAL CHANGES.
Deprecated: This module is deprecated in favor of the ensemble module which can run
an ensemble of pyopmnearwell decks AND extract data afterwards.
- class ResDataSet(path, input_kws, target_kws, file_format='resdata', dtype=tf.float32, shuffle_on_epoch_end=False, read_data_on_init=True)[source]#
Bases:
objectGenerate samples for a
tf.data.Datasetfrom a folder of.UNRSTfiles.Example
After instantiation of the class, it can be passed to
tf.data.Dataset.from_generator(), to create a dataset thattensorflowcan work with. >>> data = ResDataSet(path, input_kws, target_kws) >>> data.read_data() >>> ds = tf.data.Dataset.from_generator( >>> data, >>> output_signature=(tf.TensorSpec(), tf.TensorSpec()) >>> )To save the dataset, use >>> ds.save(path) Afterwards, the
.UNRSTfiles used to generated the dataset can be deleted.- Parameters:
- features: Tensor#
Stores all inputs of the dataset.
shape=(num_files, num_report_steps, num_cells, len(input_kws))
- targets: Tensor#
Stores all targets of the dataset.
shape=(num_files, num_report_steps, num_cells, len(target_kws))
- read_data()[source]#
Extract configured restart keywords and populate feature and target tensors.
- Returns:
Result produced by the operation.
- Return type:
Any