ModelBuilder.load#

classmethod ModelBuilder.load(fname, check=True)[source]#

Create a ModelBuilder instance from a file.

Loads inference data for the model.

This class method has a few steps:

  • Load the DataTree from the file.

  • Construct a new instance of the model using the DataTree attrs

  • Build the model from the DataTree

  • Check if the model id matches the id in the DataTree loaded.

Parameters:
fnamestr

This denotes the name with path from where idata should be loaded from.

checkbool, optional

Whether to check if the model id matches the id in the DataTree loaded. Defaults to True.

Returns:
Returns an instance of ModelBuilder.
Raises:
DifferentModelError

If the inference data that is loaded doesn’t match with the model.

Examples

Load a model from a file

file_name: str = "./mymodel.nc"
model = MyModel.load(file_name)