pySpeedy main module

example_bc_file()

Returns the Path to the example bc file.

example_sst_anomaly_file()

Returns the Path to the example SST anomaly file.

Speedy(**control_params)

Speedy model.

class pyspeedy.Speedy(**control_params)

Speedy model.

__init__(**control_params)

Constructor. Initializes the model.

For a complete list of the accepted initialization parameters, see: set_params().

get_shape(var_name)

Get the shape of an state variable.

grid2spectral()

Transform the grid u, v, t, qv, ps, and phi fields to the spectral domain.

run(callbacks=None)

Run the model between the start and the end date (defined in the instance start_date and end_date attributes).

Before running the model, the boundary conditions need to be set (see the set_bc() method).

Parameters
callbacks: iterable of callback functions

Sequence of callback functions to be call every history_interval time steps.

set_bc(bc_file=None, sst_anomaly=None)

Set the model boundary conditions from a Netcdf file. If no file is provided, the default boundary conditions from the original SPEEDY model are used.

The boundary conditions file (bc_file) should contain the following fields:

  • Time invariant (lon, lat):
    • orog: Orographic height [m]

    • lsm: Land sea mask fraction. Values between 0 and 1.

    • vegl: Low vegetation cover (fraction). Values between 0 and 1.

    • vegh: High vegetation cover (fraction). Values between 0 and 1.

    • alb: Annual-mean albedo (fraction). Values between 0 and 1.

  • Climatological values for each month of the year (lon, lat, month):
    • stl: Land surface temp (top-layer) [degK].

    • snowd: Snow depth [kg/m2]

    • swl1: Soil wetness (layer 1) [vol. fraction, 0-1]

    • swl2: Soil wetness (layer 2) [vol. fraction, 0-1]

    • swl3: Soil wetness (layer 3) [vol. fraction, 0-1]

    • icec: Sea-ice concentration (fraction). Values between 0 and 1.

    • sst: Sea surface temperature [degK].

In addition to the climatological fields, the SPEEDY model requires the sea surface temperature anomalies with respect to the the climatologies (lon, lat, day): These anomalies are loaded from the file specified in the sst_anomaly keyword, and it should contain the following field:

  • Anomalies fields (lon, lat, day):
    • ssta: Sea surface temperature anomaly [degK].

By default, the anomalies available in the original SPEEDY model are used. Note that the anomaly fields should cover the simulation period.

Notes

The exact shapes for the invariant fields are: (lon, lat, month) = (96, 48, 12)

The SPEEDY boundary conditions are included in the pySPEEDY package. This climatology was derived from the ERA interim re-analysis using the 1979-2008 period. Also, the example data provided in the pySPEEDY package include the monthly SST anomalies from 1979-01-01 to 2013-12-01 (Y/m/d).

set_params(diag_interval=180, start_date=datetime.datetime(1982, 1, 1, 0, 0), end_date=datetime.datetime(1982, 1, 2, 0, 0))

Set the model’s control parameters.

Parameters
diag_interval: int

Interval, in time steps, for which the diagnostic variables are saved.

start_date: datetime

Model start date.

end_date: datetime

Model end date.

spectral2grid()

Transform the spectral u, v, t, qv, ps, and phi fields to the grid domain.

to_dataframe(variables=None)

Return an xarray DataFrame with the current model state.

pyspeedy.example_bc_file()

Returns the Path to the example bc file.

pyspeedy.example_sst_anomaly_file()

Returns the Path to the example SST anomaly file.