MMM.load#

classmethod MMM.load(fname, check=True)#

Create a ModelBuilder instance from a file.

Loads inference data for the model.

This class method has a few steps:

  • Load the InferenceData from the file.

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

  • Build the model from the InferenceData

  • Check if the model id matches the id in the InferenceData 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 InferenceData 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)