environmentaltools.processes.save_db

environmentaltools.processes.save_db(time_, grid, data, params)[source]

Create and save xarray Dataset with computed model results for a time step.

Updates the database by creating an xarray Dataset with the computation results and saves it to a NetCDF file.

Parameters:
  • time (int or pd.DatetimeIndex) – Time step identifier

  • grid (dict) –

    Dictionary containing computed values for the current time step including:

    • depthnp.ndarray

      Water depth

    • Hsnp.ndarray

      Significant wave height

    • DirMnp.ndarray

      Mean wave direction

    • Unp.ndarray

      Current velocity magnitude

    • DirUnp.ndarray

      Current direction

    • qc, qlnp.ndarray

      Cross-shore and longshore sediment transport

    • Setupnp.ndarray

      Wave setup

    • Qbnp.ndarray

      Bed load transport

  • data (pd.DataFrame) – DataFrame with boundary data

  • params (dict) –

    Dictionary with model parameters including:

    • fileoutstr

      Output file path prefix

Returns:

Updated dataset with computed fields

Return type:

xr.Dataset