Attention
This project is still in an early phase of development.
The python API is not yet stable, and some aspects of the schema for the blueprint and workplan will likely evolve. Therefore whilst you are welcome to try out using the package, we cannot yet guarantee backwards compatibility. We expect to reach a more stable version in 2026.
cstar.roms.ROMSSimulation.restart#
- ROMSSimulation.restart(new_end_date: str | datetime) ROMSSimulation#
Restart the ROMS simulation from the end of the current simulation, if possible.
This method creates a new ROMSSimulation instance that continues from the date specified by end_date in the current ROMSSimulation. The method searches for a restart file generated by the simulation corresponding to this date, and proceeds if one is found. The new instance inherits the configuration of the current simulation but updates the initial conditions based on the restart file.
- Parameters:
new_end_date (str or datetime) – The new end date for the restarted simulation. If given as a string, it will be parsed into a datetime object.
- Returns:
ROMSSimulation – A new instance of ROMSSimulation that starts from end_date and runs until new_end_date.
- Raises:
FileNotFoundError – If no restart file corresponding to the new start date is found in the output directory.
ValueError – If multiple distinct restart files match the expected restart pattern.
Notes
This method searches the output directory for restart files that match the timestamped pattern *_rst.YYYYMMDDHHMMSS.nc.
The new simulation instance will have its initial_conditions set to the detected restart file.
Cached dataset information is reset for the new instance.
Examples
>>> new_sim = simulation.restart(new_end_date="2025-06-01") >>> print(new_sim.initial_conditions.location) /path/to/output/restart_rst.20250601000000.nc