pyfvcom2.restart module
Functions for handling FVCOM restart files
- pyfvcom2.restart.interpolate_restart_data(fvcom_reader, interpolator, variables: Sequence[str], target_datetime: datetime) dict
Interpolate source data onto an FVCOM restart grid.
This prepares the
datadictionary consumed bywrite_restart(). The supplied interpolator can be aNEMOInterpolator,CMEMSInterpolatoror any object implementing the pyfvcom2Interpolatorinterface.- Parameters:
fvcom_reader –
pyfvcom2.fvcom_reader.FVCOMReaderfor the restart template/grid.interpolator – Interpolator instance used to produce each variable.
variables – FVCOM restart variable names to interpolate.
target_datetime – Datetime to use for interpolation.
- Returns:
Dictionary of variable name to restart-shaped arrays, without the leading FVCOM time dimension.
- pyfvcom2.restart.write_restart(template_file_path: str, output_path: str, data: dict, new_datetime: datetime | None = None) None
Write data to a FVCOM restart file in NetCDF4 format
- Parameters:
template_file_path (str) – Path to the FVCOM restart template file.
output_path (str) – Path to save the FVCOM restart file.
data (dict) – Data to write to the restart file.
new_datetime (str, optional) – New datetime string to use, format ‘YYYY-MM-DD_HH:MM:SS’. Defaults to None.