Package: scmcallib
scmcallib is a tool to make it easy to derive parameter sets for Simple Climate Models (SCMs).
At the moment, the two focus use cases are:“emulation” of other, typically more complex and computationally expensive models“calibration” to observations i.e. the derivation of parameter sets which allow the SCM response to span the range of uncertainty of historical observationsThis package fits into a wider ecosystem of tools which are aiming to create a transparent and reproducible way of generating parameter sets for a wide range of SCMs, observations and climate model outputs in a number of use cases.
scmcallib usesscmdataandnetcdf-scmto make it easy to interface to a range of SCMs and climate model output, hiding the complexity of running these ‘simple’ climate models and processing complex model output.Getting StartedA number of the libraries used inscmcallibrequire compiled libraries and other system dependencies.
To make it easier to get started with this project it is recommended to set up a new Conda environment to isolate these libraries.
As this package is not currently installable via pypi, you have to install it from source.$gitclonegit://gitlab.com/magicc/scmcallib$cdscmcallib$condaenvcreate--namescmcallib--fileenvironment.yml$condaactivatescmcallib$pipinstall-e.Having installed, the scmcallib package is ready to generate parameter sets.EmulationEmulation is the process of finding a set of parameters which best fit output from another model.
Once this best fit point in parameter space has been found, the SCM provides a computationally cheap method for exploring how the these larger models would respond under various scenarios.TODO: Add documention about extractingBefore we can start emulating a model we must define the initial guess of the parameter distributions (i.e. the priors), for the parameters that are being constrained.[TODO: decide whether to put this example in e.g. a notebook so it’s under CI]fromscmcallibimportParameterSetbest_guess_c1=0.631best_guess_c2=0.429best_guess_a1=0.2240param_set=ParameterSet()param_set.set_tune('c1',Bound(Normal(mu=best_guess_c1,sd=1.),lower=0.1))param_set.set_tune('c2',Bound(Normal(mu=best_guess_c2,sd=0.1),lower=0.1))param_set.set_tune('a1',Bound(Normal(mu=best_guess_a1,sd=0.1),lower=0.0,upper=0.4))Once we have the data and parameters which describe how the model will be constrained, we can instantiate the PointEstimateFinder.
In this example we are using the A5IR SCM [TODO: fill out AR5IR SCM so it actually is the full things], a basic, but very fast model to speed up to emulation process.
The first step in emulation is finding the initial starting point for optimisation.
This start point is then used by the optimiser to find the point in parameter space which minimise the differences between the SCM output and the target timeseries (typically taken from a more complex model).fromscmcallibimportPointEstimateFinderfromscmcallib.scmimportAR5IR_SCMemulator=PointEstimateFinder(param_set,reference_period=(2000,2010))emulator.set_target(observed=observed_gmt)withAR5IR_SCM()asscm:results=emulator.find_best_fit(scm,optimiser_name='bayesopt')results.plot_summary()results.plot_fit()scmcallibprovides a method for readingtuningcorefiles which are used bysimcapto describe
how to tune magicc.CalibrationRun simple calibration exampleeditcalibration.pyandrun_calibration.pyto fit your personal settingsthen runpython run_calibration.pyvisualise withnotebooks/show_calibration.ipynb