Continuation
This module contains the functions needed to save and read SWAMPE data, as well as for continuation.
- SWAMPE.continuation.compute_t_from_timestamp(units, timestamp, dt)
Computes the current timestamp t based on timestamp, units, and timestep size.
- Parameters:
units (str) – Units of timestamps on the savefile: ‘hours’,’minutes’, or ‘seconds’
timestamp (int) – Timestamp in specified units
dt (float) – timestep length, in second s
- Returns:
number of timestep to continue the simulation
- Return type:
int
- SWAMPE.continuation.compute_timestamp(units, t, dt)
Computes timestamp in appropriate units to append to the saved data files.
- Parameters:
units (str) – Units of timestamps on the savefile: ‘hours’,’minutes’, or ‘seconds’
t (int) – number of current timestep
dt (float) – timestep length, in seconds
- Returns:
timestamp in desired units
- Return type:
string
- SWAMPE.continuation.load_data(timestamp, custompath=None)
Loads the data necessary for continuation based on timestamp.
- Parameters:
timestamp (string) – timestamp used for naming saved files
custompath (string) – path to the custom directory, defaults to None. If None, files will be saved in the parent_directory/data/
- Returns:
arrays of eta, delta, Phi, U, V
- Return type:
arrays of float JxI
- SWAMPE.continuation.read_pickle(filename, custompath=None)
Loads a pickle file.
- Parameters:
filename (string) – name of the pickle file to be read
custompath (string, optional) – path to the custom directory, defaults to None
- Returns:
any Python type from the pickle file
- Return type:
any Python type
- SWAMPE.continuation.save_data(timestamp, etadata, deltadata, Phidata, U, V, spinupdata, geopotdata, custompath=None)
Saves the data for plotting and continuation purposes.
- Parameters:
timestamp (string) – timestamp to be used for naming saved files
etadata (array of float JxI) – python array of the data for absolute vorticity eta
deltadata (array of float JxI) – python array of the data for divergence delta
Phidata (array of float JxI) – python array of the data for geopotential Phi
U (array of float JxI) – python array of the data for zonal winds U
V (array of float JxI) – python array of the data for meridional winds V
spinupdata (array of float) – time series array of minimum length of wind vector and RMS winds
geopotdata (array of float) – time series array of minimum and maximum of the geopotential Phi
custompath (string, optional) – path to the custom directory, defaults to None. If None, files will be saved in the parent_directory/data/
- SWAMPE.continuation.write_pickle(filename, data, custompath=None)
Writes a pickle file from the data.
- Parameters:
filename (string) – name of the pickle file to be saved
data (any Python type) – a Python array of data to be saved
custompath (string, optional) – path to the custom directory, defaults to None. If None, files will be saved in the parent_directory/data/.