TOML interface
EnsembleKalmanProcesses.TOMLInterface.path_to_ensemble_member
— Functionpath_to_ensemble_member(
base_path,
iteration,
member,
pad_zeros = 3,
)
Obtains the file path to a specified ensemble member. The likely form is base_path/iteration_X/member_Y/
with X,Y padded with zeros. The file path can be reconstructed with: base_path
- base path to where EKP parameters are stored member
- number of the ensemble member (without zero padding) iteration
- iteration of ensemble method (if =nothing then only the load path is used) pad_zeros
- amount of digits to pad to
One can also call this without the iteration level
EnsembleKalmanProcesses.TOMLInterface.get_parameter_distribution
— Functionget_parameter_distribution(param_dict, name)
Constructs a ParameterDistribution
for a single parameter
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionary of parameter information (in particular, the parameters' prior distributions and constraints) as values name
- parameter name
Returns a ParameterDistribution
get_parameter_distribution(param_dict, names)
Constructs a ParameterDistribution
for an array of parameters
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionary of parameter information (in particular, the parameters' prior distributions and constraints) as values names
- array of parameter names
Returns a ParameterDistribution
EnsembleKalmanProcesses.TOMLInterface.get_parameter_values
— Functionget_parameter_values(param_dict, names)
Gets parameter values from a parameter dictionary, indexing by name.
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionary of parameter information (in particular, the parameters' values) name
- iterable parameter names return_type
- return type, default "dict", otherwise "array"
EnsembleKalmanProcesses.TOMLInterface.save_parameter_ensemble
— Functionsave_parameter_ensemble(
param_array,
param_distribution,
default_param_data,
save_path,
save_file,
iteration
pad_zeros=3,
apply_constraints=true
)
Saves the parameters in the given param_array
to TOML files. The intended use is for saving the ensemble of parameters after each update of an ensemble Kalman process. Each ensemble member (column of param_array
) is saved in a separate directory "member<j>" (j=1, ..., Nens). The name of the saved toml file is given by save_file
; it is the same for all members. A directory "iteration<iter>" is created in `savepath`, which contains all the "member_<j>" subdirectories.
Args: param_array
- array of size Nparam x Nens param_distribution
- the parameter distribution underlying param_array
apply_constraints
- apply the constraints in param_distribution
default_param_data
- dict of default parameters to be combined and saved with the parameters in param_array
into a toml file save_path
- path to where the parameters will be saved save_file
- name of the toml files to be generated iteration
- the iteration of the ensemble Kalman process represented by the given param_array
pad_zeros
- the amount of zero-padding for the ensemble member number
One can also call this without the iteration level
EnsembleKalmanProcesses.TOMLInterface.get_admissible_parameters
— Functionget_admissible_parameters(param_dict)
Finds all parameters in param_dict
that are admissible for calibration.
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionaries of parameter information as values
Returns an array of the names of all admissible parameters in param_dict
. Admissible parameters must have a key "prior" and the value value of this is not set to "fixed". This allows for other parameters to be stored within the TOML file.
EnsembleKalmanProcesses.TOMLInterface.get_regularization
— Functionget_regularization(param_dict, name)
Returns the regularization information for a single parameter
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionary of parameter information as values name
- parameter name
Returns a tuple (<regularizationtype>, <regularizationvalue>), where the regularization type is either "L1" or "L2", and the regularization value is a float. Returns (nothing, nothing) if parameter has no regularization information.
get_regularization(param_dict, names)
Returns the regularization information for an array of parameters
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionary of parameter information as values names
- array of parameter names
Returns an arary of tuples (<regularizationtype>, <regularizationvalue>), with the ith tuple corresponding to the parameter names[i]
. The regularization type is either "L1" or "L2", and the regularization value is a float. Returns (nothing, nothing) for parameters that have no regularization information.
EnsembleKalmanProcesses.TOMLInterface.write_log_file
— Functionwrite_log_file(param_dict, file_path)
Writes the parameters in param_dict
into a .toml file
Args: param_dict
- nested dictionary that has parameter names as keys and the corresponding dictionaries of parameter information as values file_path
- path of the file where parameters are saved