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.SimpleClimateModel.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.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.

runModel(RadForcingFlag=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.runModel() 

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:RadForcingFlag (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.
saveOutput()

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.saveOutput()

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.

pySCM.SimpleClimateModel.CO2EmissionsToConcs(emissions, numYears, OceanMLDepth)

This function converts atmospheric CO2 emissions to concentrations as described in Joos et al. 1996.

Parameters:
  • emissions – atmospheric CO2 emissions [PgC/year]
  • numYears – number of years the response function is going to be calculated for
  • OceanMLDepth – ocean mixed layer depth [m]
Returns:

numpy array – containing the atmospheric CO2 concentrations for each year [ppm]

pySCM.SimpleClimateModel.CH4EmssionstoConcs(emissions)

This function converts methane (CH4) emissions into concentrations.

Parameters:emissions – CH4 emissions [TgCH4/year]
Returns:numpy.array – containing the CH4 concentrations for each year [ppb]
pySCM.SimpleClimateModel.N2OEmssionstoConcs(emissions)

This function converts nitrous oxide (N2O) emissions into concentrations.

Parameters:emissions – N2O emissions [TgN2O/year]
Returns:numpy.array – containing the N2O concentrations for each year [ppb]
pySCM.SimpleClimateModel.CalcRadForcing(emissions, CO2Concs, CH4Concs, N2OConcs)

This function calculates the total radiative forcing (formula given in IPCC TAR Chapter 6). The total change in radiative forcing is the sum of the changes in radiative forcing resulting from changes in CO2, CH4, and N2O concentrations and sulfate emissions.

Parameters:
  • emissions – SOx emissions [TgS/year]
  • CO2Concs – CO2 concentrations [ppm]
  • CH4Concs – CH4 concentrations [ppb]
  • N2OConcs – N2O concentrations [ppb]
Returns:

numpy.array – containing the change in radiative forcing per year.

pySCM.SimpleClimateModel.GenerateTempResponseFunction(numYrs)

This function calculates the temperature response function that is used to calculate the change in global mean surface temperature as a result of changes in radiative forcing.

Parameters:numYrs – number of years the response function will be evaluates for.
Returns:numpy.array – containing climate response function
pySCM.SimpleClimateModel.GenerateSeaLevelResponseFunction(numYrs)

This function calculates the sea level response function that is used to calculate the change in sea level as a result of changes in in global mean surface temperature. This equation only accounts for changes in sea level resulting from thermal expansion of the ocean, it does not include the effects of melting glaciers and melting grounded ice sheets.

Parameters:numYrs – number of years the response function will be evaluates for.
Returns:numpy.array – containing climate response function
pySCM.SimpleClimateModel.GenerateOceanResponseFunction(numYears, OceanMLDepth)

This function calculates the ocean mixed layer response function (HILDA model) as described in Joos et al., 1996. This function returns the amount of carbon remaining in the surface layer of the ocean after an input (pulse) from the atmosphere scaled to units of micromol/kg.

Parameters:
  • numYears – The number of years to calculate the response function for.
  • OceanMLDepth – Ocean mixed layer depth in meters.
Returns:

numpy.array – contains the remaining carbon per year.

pySCM.SimpleClimateModel.GenerateBiosphereResponseFunction(numYears)

This function calculates the decay response function for the biosphere.

Parameters:numYears – number of years to calculate the response function for.
Returns:numpy.array – contains the biosphere-atmospheric flux after initial carbon input per year
pySCM.SimpleClimateModel.DeltaSeaWaterCO2FromOceanDIC(SurfaceOceanDIC)

This function calculates the change in sea water CO2 from equilibrium corresponding to change in ocean mixed layer carbon from equilibrium.

Parameters:SurfaceOceanDIC – Surface ocean dissolved inorganic carbon (DIC) [micromol/kg]
Returns:the change in sea water CO2 [ppm]
pySCM.SimpleClimateModel.CalculateTemperatureChange(numYears, radForcing)

This function calculates the temperature change due to changes in radiative forcing.

Parameters:
  • numYears – number of years the temperature response function will be evaluated for.
  • radForcing – changes in radiative forcing due to changes in CO2, CH4, N2O concentrations and SOx emissions.
Returns:

numpy.array –containing the temperature change for every year.

pySCM.SimpleClimateModel.CalculateSeaLevelChange(numYears, tempChange)

This function calculated the changes in sea level due to changes in global mean surface temperatures.

Parameters:
  • numYears – number of years the sea level response function will be evaluated for.
  • tempChange – changes in global mean surface temperature due to changes in CO2, CH4, N2O concentrations and SOx emissions.
Returns:

numpy.array – containing the sea level change for every year.