pylag.model module
Model objects are used to calculate changes in particle states during the course of a typical simulation. They hold and manage all particle data.
Note
model is implemented in Cython. Only a small portion of the API is exposed in Python with accompanying documentation.
- class pylag.model.OPTModel(config, data_reader)
Bases:
object
Offline Particle Tracking Model
This class provides a generic interface for setting up and running a particle tracking simulation. This includes:
Creating a particle seed
Reading input data
Updating particle positions
Returning diagnostic data
- Parameters
config (configparser.ConfigParser) – PyLag configuration object
data_reader (pylag.data_reader.DataReader) – PyLag data reader
- get_diagnostics(self, time)
Get particle diagnostics
- get_grid_names(self)
Return a list of grid names
- get_particle_data(self)
Get particle data
Pool, sort and return data describing the basic state of each particle. The main purpose of this function is to assist with the creation of restart files.
- Returns
all_particle_data – Dictionary holding particle data.
- Return type
- read_input_data(self, time)
Update reading frames for FVCOM data fields.
- Parameters
time (float) – The current time.
- seed(self, time)
Set particle positions equal to those of the particle seed.
Create the particle seed if it has not been created already. Make an active copy of the particle seed.
- Parameters
time (float) – The current time.
- set_particle_data(self, group_ids, x1_positions, x2_positions, x3_positions)
Initialise memory views for data describing the particle seed.
- setup_input_data_access(self, start_datetime, end_datetime)
Setup access to FVCOM time dependent variables.
- Parameters
start_datime (Datetime) – The simulation start date and time.
end_datime (Datetime) – The simulation end date and time.