The function provided in terra_model.py for writing a terra model into a Python pickle (write_pickle) files fails when no external pressure function is defined, because of the lambda function in the definition of the PREM function.
E.g.:
m = tm.read_netcdf(glob.glob(f'./NC_037/nc*')
m.write_pickle(f'NC_037.pkl')
results in:
AttributeError: Can't pickle local object 'TerraModel.init..'
The function provided in terra_model.py for writing a terra model into a Python pickle (write_pickle) files fails when no external pressure function is defined, because of the lambda function in the definition of the PREM function.
E.g.:
m = tm.read_netcdf(glob.glob(f'./NC_037/nc*') m.write_pickle(f'NC_037.pkl')
results in:
AttributeError: Can't pickle local object 'TerraModel.init..'