Documentation of the pySCM package

In the following we will descibe the Simple Climate Model class and its public functions and methods. To run the simple climate model two input files are required:

(1) Parameter file (SimpleClimateModelParameterFile.txt) that sets parameters for the Simple Climate model run such as the start and end year of the simulation as well as the path and file names for the input and output files.

(2) The emission file (EmissionsForSCM.dat) containing the atmospheric emissions of carbon dioxid (CO2), methane (CH4), nitrous oxide (N2O) and sulfate (SOx).

Global constants

At the beginning of the Simple Climate Model class we define a set the global variables as constants. These variables will be used throughout the simple climate model run and therefore need to be global:

  • Carbon dioxide (CO2), methane (CH4), and nitrous oxide (N2O) concentrations at their pre-industrial level (e.g. 1750 values).

    baseCO2 = 278.305

    baseCH4 = 700.0

    baseN2O = 270.0

  • CO2 emissions are reported in Peta grams of carbon (PgC) where 1 PgC = 10^15 g carbon and therefore we need the PgCperppm constant which is the conversion factor for PgC to ppm of CO2.

    PgCperppm = 2.123

  • Estimates of direct (aerDirectFac) and indirect (aerIndirectFac) aerosol radiative forcing factors in units of (W/m^2)/TgS are:

    aerDirectFac = -0.002265226

    aerIndirectFac = -0.013558119

Description of the pySCM module

Emission record Class

class pySCM.scm.EmissionRec

We construct a class called EmissionRec which holds the atmospheric emissions of CO2, CH4, N2O and SOx. The emissions need to be provided as an input to the Simple Climate Model class, where the filename and path will be set in the SimpleClimateModelParameterFile.txt. The emissions will be read from file when the Simple Climate Model class is constructed by typing:

>>> SCM = pySCM.SimpleClimateModel('PathAndFileNameOfParameterFile')

Simple Climate Model Class

The Simple Climate Model class comprises only two public functions, i.e. runModel and saveOutput. The class uses the EmissionRec to store all GHG emissions that are going to be used during the model run.

class pySCM.SimpleClimateModel(filename)

This is the Simple Climate Model class which can be created by typing:

>>> SCM = pySCM.SimpleClimateModel('PathAndFileNameOfParameterFile')

During the call of the constructor, all parameters detailed in the SimpleClimateModelParameterFile.txt will be read from file as well as the atmospheric emissions of GHGs (detailed above).

Note

The file containing the emissions should be in a certain format. Please refer to the example file (EmissionsForSCM.dat) for details.

run_model(rf_flag=False)

This function runs the simple climate model. A number of private functions will be called but also a number of ‘independent’ functions (detailed below). The model takes the atmosheric GHG emissions as input, converts them into concentrations and calculates the radiative forcing from the change in GHG concentrations over the years. Finally, the temperature change is derived from the change in radiative forcing which is required to calculate the change in sea level. For more information on the theory behind those calculations, please refer to ‘Theory’ page.

To run the simple climate model, type:

>>> SCM.run_model() 

By default, the calculated temperature change and sea level change will be written to a textfile where the location and name of the textfile need to be specified in the parameter file. If the user wants to, a figure showing the temperature change and sea level change, respectively, will be saved to file and again the path and filename have to be specified in the parameter file.

Param:rf_flag (bool) which is set to ‘False’ by default. If it is set to ‘True’ the function returns the calculated radiative forcing.
Returns:This function returns the radiative forcing (numpy.array) if the flag was set to true. Otherwise, nothing will be returned.
save_output()

This function is optional and allows the user to save the calculated GHG concentrations and also a figure showing the evolution of GHG concentrations. You can call this function by typing:

>>> SCM.save_output()

If this function gets called, the user has to make sure that the path and filenames are given in the parameter file.

Independent public functions and methods

These are public functions that will be called within the Simple Climate Model but can also be called outside the class. By providing the right input, these functions can be used independently of the Simple Climate Model class, e.g.

>>> pySCM.CO2EmissionsToConcs(Emissions, numYr, OceanMLDepth)

where emissions are the CO2 emissions, numYr are the number of years the response function will be calculated for and OceanMLDepth is the ocean layer depth. More information are given in the code or in the ‘Theory’ part of this documentation.