SCHISM Procedural Example¶
This notebook demonstrates how to configure and run a SCHISM ocean model simulation using the rompy-schism package. SCHISM (Semi-implicit Cross-scale Hydroscience Integrated System Model) is a 3D unstructured-grid ocean model that can simulate coastal and estuarine hydrodynamics with optional wave coupling.. HEre is a change
Overview¶
This tutorial covers:
- Setting up a SCHISM computational grid
- Configuring atmospheric forcing data
- Setting up boundary conditions (tidal, ocean, and wave)
- Running the model using Docker backends
- Visualizing and analyzing results
The notebook uses a procedural approach where each component is built step-by-step, providing full control over the model configuration.
Frontmatter¶
This section sets up the environment and imports required packages for the SCHISM model configuration.
Key Components:¶
- Grid specification: Defines the computational mesh
- Helper functions: Utilities for workspace management and visualization
- Test data: Sample datasets for demonstration purposes
# Choose computational grid file
# The hgrid.gr3 file contains the unstructured grid definition including:
# - Node coordinates (longitude, latitude, depth)
# - Element connectivity
# - Boundary information
hgrid_file = "hgrid.gr3" # SCHISM grid file
# Enable automatic module reloading for development
%load_ext autoreload
%autoreload 2
# Suppress warnings for cleaner output
import warnings
from rompy_schism.boundary_core import ElevationType, VelocityType
from rompy_schism.namelists import wwminput
warnings.filterwarnings("ignore")
# Core Python libraries
from datetime import datetime
from pathlib import Path
from shutil import rmtree
import logging
# Scientific computing libraries
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
# Geospatial libraries
import cartopy.crs as ccrs
# Data catalog management
import intake
# rompy core classes for data and time handling
from rompy.core.data import DataBlob
from rompy.core.time import TimeRange
# rompy-schism specific grid class
from rompy_schism import SCHISMGrid
# Configure logging to see model progress
logging.basicConfig(level=logging.INFO)
# Path to test data directory containing sample forcing files
TEST_DATA = Path("../tests/data")
Workspace Setup¶
Setting up the working directory where all model input files, configuration files, and output results will be stored. The workspace is organized to maintain a clean separation between input preparation and model execution.
from pathlib import Path
from shutil import rmtree
# Create and configure the working directory
workdir = Path("schism_demo")
# Clean up any existing workspace to ensure fresh start
if workdir.exists():
rmtree(workdir)
# Create the workspace directory
workdir.mkdir(exist_ok=True)
def print_new_contents(path, old_contents=None):
"""
Helper function to display directory contents and highlight new files.
Parameters:
-----------
path : Path
Directory path to inspect
old_contents : set, optional
Previously existing file names for comparison
Returns:
--------
set : Set of current file names in the directory
"""
print(f"\nContents of {path}:")
for item in path.iterdir():
if item.is_dir():
print(f" - {item.name}/")
print_new_contents(item, old_contents=old_contents)
if old_contents is None or item.name not in old_contents:
print(f" - {item.name} (new)")
else:
print(f" - {item.name}")
return set(item.name for item in path.iterdir())
# Initialize workspace contents tracking
contents = print_new_contents(workdir)
Contents of schism_demo:
Model Grid Configuration¶
The computational grid is the foundation of any SCHISM simulation. It defines the spatial discretization of the model domain using an unstructured triangular mesh.
Grid Components:¶
- hgrid.gr3: Contains node coordinates and element connectivity
- Bathymetry: Water depth information at each grid node
- Boundary segments: Open ocean, land, and river boundaries
- Drag coefficient: Bottom friction parameter
# Import SCHISM grid class
from rompy_schism import SCHISMGrid
# Uncomment to see SCHISMGrid documentation
# SCHISMGrid?
# Load the computational grid from test data
# This grid covers a coastal region and provides good performance characteristics:
# - Medium resolution: ~3 minutes runtime on 48 cores for 1 day simulation
# - Alternative fast grid option available (commented below): ~1 minute on 4 cores
hgrid = TEST_DATA / "schism" / "hgrid.gr3"
# Alternative smaller grid for faster testing (uncomment if needed):
# hgrid = HERE / "test_data" / "hgrid_20kmto60km_rompyschism_testing.gr3"
# Create the SCHISMGrid object with bathymetry and friction settings
grid = SCHISMGrid(
hgrid=DataBlob(id="hgrid", source=hgrid), # Grid geometry and bathymetry
drag=1, # Manning drag coefficient for bottom friction
)
# Optional: visualize the grid mesh
# grid.plot_hgrid()
2025-10-06 17:20:04 [WARNING] rompy_schism.grid : ! drag is being set to a constant value, this is not recommended. For best results, please supply friction gr3 files with spatially varying values. Further options are under development.
# Visualize the computational grid
# This shows the triangular mesh elements and domain boundaries
grid.plot()
(<Figure size 1200x1000 with 1 Axes>, <GeoAxes: >)
# Visualize the bathymetry (water depth) across the model domain
# Bathymetry is critical for accurate hydrodynamic modeling
# Positive values = water depth, negative values = land elevation
grid.plot_bathymetry()
(<Figure size 1200x1000 with 2 Axes>, <GeoAxes: >)
# Generate grid files in the workspace
# This creates the necessary grid files that SCHISM needs to run:
# - hgrid.gr3: Main grid file with coordinates and bathymetry
# - Additional mesh files as needed
grid.get(workdir)
# Check what new files were created
contents = print_new_contents(workdir, old_contents=contents)
2025-10-06 17:20:04 [INFO] rompy_schism.grid : Generating albedo.gr3 with constant value 0.15 2025-10-06 17:20:04 [INFO] rompy_schism.grid : Generating diffmin.gr3 with constant value 1e-06 2025-10-06 17:20:04 [INFO] rompy_schism.grid : Generating diffmax.gr3 with constant value 1.0 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Generating watertype.gr3 with constant value 1.0 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Generating windrot_geo2proj.gr3 with constant value 0.0 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Generating drag.gr3 with constant value 1.0 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo/hgrid.ll 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo/hgrid_WWM.gr3 2025-10-06 17:20:05 [INFO] rompy_schism.grid : → Generating vertical grid configuration 2025-10-06 17:20:05 [INFO] rompy_schism.vgrid : Creating vgrid.in with ivcor=2, nvrt=2, zlevels=-1000000.0, h_c=40.0, theta_b=0.5, theta_f=1.0 2025-10-06 17:20:05 [INFO] rompy_schism.vgrid : Successfully used create_schism_vgrid to create schism_demo/vgrid.in 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Creating tvd.prop with two-column format for 4030 elements 2025-10-06 17:20:05 [INFO] rompy_schism.grid : Successfully created tvd.prop with 4030 elements
Contents of schism_demo: - hgrid.gr3 (new) - albedo.gr3 (new) - diffmin.gr3 (new) - diffmax.gr3 (new) - watertype.gr3 (new) - windrot_geo2proj.gr3 (new) - drag.gr3 (new) - hgrid.ll (new) - hgrid_WWM.gr3 (new) - wwmbnd.gr3 (new) - vgrid.in (new) - tvd.prop (new)
Forcing Data Configuration¶
SCHISM requires various types of forcing data to drive the simulation:
Atmospheric Forcing (Sflux)¶
- Wind fields: Surface wind velocity components (u10, v10)
- Air pressure: Mean sea level pressure (optional)
- Air temperature: For heat flux calculations (optional)
- Humidity: For evaporation calculations (optional)
Boundary Conditions¶
- Tidal forcing: Harmonic constituents for astronomical tides
- Ocean forcing: External water level, temperature, salinity from parent models
- River inputs: Freshwater discharge and associated tracers
Wave Forcing (Optional)¶
- Wave spectra: For wave-current interaction
- Wave parameters: Significant wave height, period, direction
# First lists import the main data classes
# Import main forcing data classes for SCHISM
from rompy_schism.data import (
SCHISMDataSflux,
SCHISMDataWave,
SCHISMDataBoundaryConditions,
)
# Import specific forcing components used in data construction
from rompy_schism.data import TidalDataset, SfluxAir, SCHISMDataBoundary
# Import core data source abstractions
# These classes work identically across rompy packages for consistent data handling
from rompy.core.data import DataBlob # For static data files
from rompy.core.source import SourceFile, SourceIntake # For various data sources
# Import boundary configuration classes for complex boundary setups
from rompy_schism.data import BoundarySetupWithSource, SCHISMDataBoundary
# Import factory functions for simplified boundary condition configuration
# These provide pre-configured setups for common boundary condition scenarios
from rompy_schism.boundary_conditions import (
create_tidal_only_boundary_config, # Pure tidal forcing
create_hybrid_boundary_config, # Tidal + external ocean data
create_river_boundary_config, # River discharge boundaries
create_nested_boundary_config, # Nested model coupling
)
Atmospheric Forcing (Sflux) Data¶
SCHISM uses the Sflux format for atmospheric forcing, which organizes meteorological data into structured NetCDF files. The Sflux system:
- Handles multiple data types: Wind, pressure, temperature, humidity, radiation
- Supports flexible grids: Can interpolate from various input grid formats
- Manages time series: Automatically handles temporal interpolation
- Provides efficient I/O: Optimized for large-scale simulations
The following example demonstrates setting up wind forcing from ERA5 reanalysis data.
# SCHISMDataSflux??
# SfluxSource??
# Sflux_Inputs??
# Uncomment these lines to explore the Sflux documentation:
# SCHISMDataSflux? # View SCHISMDataSflux class documentation
# SfluxSource? # View data source options
# Sflux_Inputs? # View input parameter details
# Load and visualize sample ERA5 atmospheric forcing data
# ERA5 is a global atmospheric reanalysis providing comprehensive meteorological fields
# Initialize variables for visualization
nn = 0 # Time index for plotting (first time step)
# Load data catalog and ERA5 dataset
cat = intake.open_catalog(TEST_DATA / "catalog.yaml")
ds = xr.open_dataset(TEST_DATA / "schism" / "era5.nc")
# Create visualization of wind speed at first time step
plt.figure(figsize=(10, 4))
ax = plt.axes(projection=ccrs.PlateCarree())
# Calculate wind speed magnitude from u and v components
wind_speed = np.sqrt(ds.u10[nn] ** 2 + ds.v10[nn] ** 2)
# Plot wind speed with coastlines
wind_speed.plot(ax=ax, transform=ccrs.PlateCarree())
ax.coastlines()
ax.set_title(f"ERA5 Wind Speed {ds.time.isel(time=nn).values}")
Text(0.5, 1.0, 'ERA5 Wind Speed 2023-01-01T00:00:00.000000000')
# Inspect the ERA5 dataset structure
# This shows the dimensions, coordinates, and data variables available
ds
<xarray.Dataset> Size: 3MB
Dimensions: (time: 73, latitude: 45, longitude: 69)
Coordinates:
* latitude (latitude) float32 180B -15.0 -15.25 -15.5 ... -25.5 -25.75 -26.0
* longitude (longitude) float32 276B 140.0 140.2 140.5 ... 156.5 156.8 157.0
* time (time) datetime64[ns] 584B 2023-01-01 ... 2023-01-04
Data variables:
msl (time, latitude, longitude) float32 907kB ...
u10 (time, latitude, longitude) float32 907kB ...
v10 (time, latitude, longitude) float32 907kB ...
Attributes:
Conventions: CF-1.7
GRIB_centre: ecmf
GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts
GRIB_subCentre: 0
history: 2024-11-10T00:18 GRIB to CDM+CF via cfgrib-0.9.1...
institution: European Centre for Medium-Range Weather Forecasts
_coordinates: {"t":"time","x":"longitude","y":"latitude"}
_request_size: 907700
_domain_size: 226665# Check what variables are available in the ERA5 dataset
print("Available variables in ERA5 dataset:")
print(list(ds.data_vars.keys()))
print("\nDataset info:")
print(ds)
Available variables in ERA5 dataset:
['msl', 'u10', 'v10']
Dataset info:
<xarray.Dataset> Size: 3MB
Dimensions: (time: 73, latitude: 45, longitude: 69)
Coordinates:
* latitude (latitude) float32 180B -15.0 -15.25 -15.5 ... -25.5 -25.75 -26.0
* longitude (longitude) float32 276B 140.0 140.2 140.5 ... 156.5 156.8 157.0
* time (time) datetime64[ns] 584B 2023-01-01 ... 2023-01-04
Data variables:
msl (time, latitude, longitude) float32 907kB ...
u10 (time, latitude, longitude) float32 907kB ...
v10 (time, latitude, longitude) float32 907kB ...
Attributes:
Conventions: CF-1.7
GRIB_centre: ecmf
GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts
GRIB_subCentre: 0
history: 2024-11-10T00:18 GRIB to CDM+CF via cfgrib-0.9.1...
institution: European Centre for Medium-Range Weather Forecasts
_coordinates: {"t":"time","x":"longitude","y":"latitude"}
_request_size: 907700
_domain_size: 226665
# Configure atmospheric forcing using ERA5 data
# This demonstrates setting up wind forcing through the Sflux system
from rompy.core.time import TimeRange
from rompy_schism.data import SfluxAir
# Create atmospheric forcing configuration
atmos_forcing = SCHISMDataSflux(
air_1=SfluxAir(
id="air_1", # Identifier for this forcing component
source=SourceFile(
uri=TEST_DATA / "schism" / "era5.nc", # Path to ERA5 data file
),
# Map ERA5 variable names to SCHISM requirements
uwind_name="u10", # 10-meter eastward wind component
vwind_name="v10", # 10-meter northward wind component
# Note: prmsl_name (pressure) removed as this ERA5 file lacks 'msl' variable
# Data processing filters
filter={
"sort": {"coords": ["latitude"]}, # Ensure consistent coordinate ordering
},
buffer=2, # Grid buffer for interpolation (grid cells)
)
)
# Generate Sflux files for the specified time period
# Files are created in workdir/sflux/ directory
atmos_forcing.get(
destdir=workdir,
grid=grid,
time=TimeRange(
start="2023-01-01", end="2023-01-02", dt=3600
), # 1-day simulation, hourly output
)
2025-10-06 17:20:05 [INFO] rompy_schism.data : Successfully created SfluxAir instance with source type: <class 'rompy.core.source.SourceFile'> 2025-10-06 17:20:05 [INFO] rompy_schism.data : • Variables: air_1 2025-10-06 17:20:05 [INFO] rompy_schism.data : • Source: ../tests/data/schism/era5.nc 2025-10-06 17:20:05 [INFO] rompy_schism.data : • Output: schism_demo/sflux
{'air_1': PosixPath('schism_demo/sflux/air_1.0001.nc'),
'nml': PosixPath('schism_demo/sflux/sflux_inputs.txt')}
# Verify that Sflux files were created successfully
# The sflux directory should now contain processed atmospheric forcing files
# These files are in the format required by SCHISM for atmospheric input
contents = print_new_contents(workdir, old_contents=contents)
Contents of schism_demo: - hgrid.gr3 - albedo.gr3 - diffmin.gr3 - diffmax.gr3 - watertype.gr3 - windrot_geo2proj.gr3 - drag.gr3 - hgrid.ll - hgrid_WWM.gr3 - wwmbnd.gr3 - vgrid.in - tvd.prop - sflux/ Contents of schism_demo/sflux: - air_1.0001.nc (new) - sflux_inputs.txt (new) - sflux (new)
# Visualize the processed Sflux data
# This verifies that the atmospheric forcing was correctly processed and formatted
# Create map projection for visualization
ax = plt.axes(projection=ccrs.PlateCarree())
# Load the processed Sflux file (air_1.0001.nc corresponds to first time file)
ds = xr.open_dataset("schism_demo/sflux/air_1.0001.nc")
# Calculate wind speed magnitude from processed data
wind_speed = np.sqrt(ds.u10.isel(time=nn) ** 2 + ds.v10.isel(time=nn) ** 2)
# Plot the processed wind field
wind_speed.plot(ax=ax, transform=ccrs.PlateCarree())
ax.coastlines()
ax.set_title("Processed Sflux Wind Speed Data")
Text(0.5, 1.0, 'Processed Sflux Wind Speed Data')
Boundary Conditions Configuration¶
SCHISM's new unified boundary conditions system provides a single, comprehensive interface for configuring all types of model boundaries. This represents a significant improvement over the previous separate configuration approach.
Boundary Types Supported:¶
- Tidal boundaries: Harmonic constituents for astronomical tides
- Ocean boundaries: External water level, temperature, salinity from parent models
- River boundaries: Freshwater discharge with associated tracers
- Nested boundaries: Coupling with parent model outputs including relaxation zones
Key Advantages:¶
- Unified interface: Single configuration object handles all boundary types
- Factory functions: Pre-configured setups for common scenarios
- Better validation: Comprehensive error checking and parameter validation
- Flexible mixing: Different boundary types can be applied to different segments
- Seamless integration: Works directly with the data processing pipeline
The following example demonstrates hybrid boundary conditions combining tidal forcing with external ocean data.
# Load and visualize external ocean forcing data (HYCOM)
# HYCOM provides high-resolution ocean analysis for boundary forcing
ds = xr.open_dataset(TEST_DATA / "schism" / "hycom.nc")
# Create map to visualize sea surface elevation from external ocean model
ax = plt.axes(projection=ccrs.PlateCarree())
ds["surf_el"].isel(time=0).plot(ax=ax, transform=ccrs.PlateCarree())
ax.coastlines()
ax.set_title("HYCOM Sea Surface Elevation - External Ocean Forcing")
Text(0.5, 1.0, 'HYCOM Sea Surface Elevation - External Ocean Forcing')
# Configure hybrid boundary conditions (tidal + external ocean data)
# This replaces the old separate SCHISMDataOcean and SCHISMDataTides classes
# with a unified, more flexible approach
boundary_conditions = create_hybrid_boundary_config(
# Tidal forcing configuration
# Harmonic constituents for astronomical tidal forcing
constituents=[
"M2",
"S2",
"N2",
], # Major tidal constituents (M2=principal lunar, S2=principal solar, N2=lunar elliptic)
# Tidal database configuration
tidal_database=TEST_DATA / "schism" / "tides", # Path to tidal harmonic database
tidal_model="OCEANUM-atlas", # Specify which tidal atlas to use
# External ocean data for elevation forcing
# This provides the non-tidal component of water level variations
elev_source=SCHISMDataBoundary(
id="elev2D", # Identifier for elevation boundary data
source=SourceFile(
uri=TEST_DATA / "schism" / "hycom.nc", # Path to HYCOM ocean model data
),
variables=["surf_el"], # Variable name for sea surface elevation
coords={
"t": "time", # Time coordinate mapping
"y": "ylat", # Latitude coordinate mapping
"x": "xlon", # Longitude coordinate mapping
},
),
# Optional: Additional 3D boundary forcing can be added
# vel_source=SCHISMDataBoundary(...), # Temperature forcing
# temp_source=SCHISMDataBoundary(...), # Temperature forcing
# salt_source=SCHISMDataBoundary(...), # Salinity forcing
)
# Generate boundary condition files for the simulation
# This processes tidal and ocean boundary data and creates the necessary input files
boundary_conditions.get(
destdir=workdir,
grid=grid,
time=TimeRange(start="2023-01-01", end="2023-01-02", dt=3600),
)
# Check what boundary condition files were created
contents = print_new_contents(workdir, old_contents=contents)
2025-10-06 17:20:05 [INFO] rompy_schism.data : → Processing tidal constituents: m2, s2, n2 2025-10-06 17:20:06 [INFO] rompy_schism.data : → Generating boundary condition file: bctides.in 2025-10-06 17:20:06 [INFO] rompy_schism.bctides: → Computing tidal factors for 3 constituents 2025-10-06 17:20:06 [INFO] rompy_schism.bctides: Applying nodal phase corrections to earth equilibrium argument 2025-10-06 17:20:06 [INFO] rompy_schism.bctides: Processing tide for boundary 1 2025-10-06 17:20:06 [INFO] rompy_schism.bctides: Number of boundary nodes: 94 2025-10-06 17:20:06 [INFO] rompy_schism.bctides: Number of tidal coefficients: 3 2025-10-06 17:20:06 [INFO] rompy_schism.bctides: Tidal_data shape: (94, 3, 2) 2025-10-06 17:20:06 [INFO] rompy_schism.data : → Boundary conditions written successfully 2025-10-06 17:20:06 [INFO] rompy_schism.data : → Processing boundary data: elevation 2025-10-06 17:20:06 [INFO] rompy_schism.data : • Source: ../tests/data/schism/hycom.nc 2025-10-06 17:20:06 [INFO] rompy_schism.data : • Files: elev2D.th.nc
Contents of schism_demo: - hgrid.gr3 - albedo.gr3 - diffmin.gr3 - diffmax.gr3 - watertype.gr3 - windrot_geo2proj.gr3 - drag.gr3 - hgrid.ll - hgrid_WWM.gr3 - wwmbnd.gr3 - vgrid.in - tvd.prop - sflux/ Contents of schism_demo/sflux: - air_1.0001.nc (new) - sflux_inputs.txt (new) - sflux - bctides.in (new) - elev2D.th.nc (new)
# Inspect the processed boundary condition data
# The elev2D.th.nc file contains time series of elevation boundary conditions
dsb = xr.open_dataset("schism_demo/elev2D.th.nc")
# Display the first time step to verify proper time handling
dsb.time[0]
<xarray.DataArray 'time' ()> Size: 8B
array('2023-01-01T00:00:00.000000000', dtype='datetime64[ns]')
Coordinates:
time datetime64[ns] 8B 2023-01-01
Attributes:
long_name: Time
standard_name: time
base_date: [2023 1 1 0 0 0]# Visualize boundary condition application
# This shows how external ocean data is interpolated to the model boundary points
# Set color scale limits for consistent visualization
vmin, vmax = 0.3, 0.9
time = dsb.time[0]
# Create map projection
ax = plt.axes(projection=ccrs.PlateCarree())
# Plot the original HYCOM sea surface elevation field
ds["surf_el"].sel(time=time).plot(
ax=ax,
transform=ccrs.PlateCarree(),
vmin=vmin,
vmax=vmax,
cbar_kwargs={"label": "Sea Surface Elevation (m)"},
)
ax.coastlines()
# Extract boundary condition values at the first time step
values = dsb.time_series.isel(time=0)
# Get boundary point coordinates from the grid
x, y = grid.boundary_points()
# Overlay boundary points with their interpolated values
ax.scatter(
x,
y,
transform=ccrs.PlateCarree(),
c=values,
cmap="viridis",
vmin=vmin,
vmax=vmax,
edgecolor="black",
s=50,
label="Boundary points",
)
ax.set_title("External Ocean Forcing Applied to Model Boundary Points")
ax.legend()
<matplotlib.legend.Legend at 0x14b44b4c8b30>
Understanding the New Boundary Conditions System¶
The new SCHISMDataBoundaryConditions class provides a unified interface for all boundary condition types:
- Tidal-only: Pure harmonic tidal forcing using tidal constituents
- Hybrid: Combined harmonic tidal + external ocean data (what we used above)
- River: Constant or time-varying river inputs with optional tidal forcing on other boundaries
- Nested: Coupling with parent model outputs with relaxation parameters
Key Benefits:
- Single configuration object for all boundary types
- Factory functions for common configurations
- Better validation and error checking
- Seamless integration with data processing pipeline
- Flexible mixing of different boundary types per segment
Alternative Boundary Condition Configurations¶
The unified boundary conditions system supports several configuration patterns. Here are some additional examples:
# Tidal data is now configured through the unified boundary conditions system
# create_tidal_only_boundary_config creates purely tidal boundaries
# create_river_boundary_config creates river boundaries with optional tidal forcing
# create_nested_boundary_config creates nested model boundaries
# Example: Pure tidal boundary configuration (no external ocean data)
tidal_only_boundary = create_tidal_only_boundary_config(
constituents=["M2", "S2", "N2"],
tidal_database=TEST_DATA / "schism" / "tides",
tidal_model="OCEANUM-atlas",
nodal_corrections=True,
tidal_potential=True,
cutoff_depth=50.0,
)
# Example: River boundary configuration
# Note: River temperature and salinity would be handled separately in the full model setup
river_boundary = create_river_boundary_config(
river_boundary_index=1, # Index of the river boundary
river_flow=-100.0, # Negative for inflow (m³/s)
other_boundaries="tidal", # Other boundaries are tidal
constituents=["M2", "S2"],
tidal_database=TEST_DATA / "schism" / "tides",
tidal_model="OCEANUM-atlas",
)
print(f"Tidal-only boundaries: {len(tidal_only_boundary.boundaries)} configured")
print(f"River boundaries: {len(river_boundary.boundaries)} configured")
print(
f"Hybrid (main) boundary: {boundary_conditions.setup_type} with {len(boundary_conditions.boundaries)} boundaries"
)
Tidal-only boundaries: 0 configured River boundaries: 1 configured Hybrid (main) boundary: hybrid with 1 boundaries
Note on River Boundary Configuration:
The create_river_boundary_config factory function focuses on the core river flow and boundary topology setup. Additional properties like river temperature and salinity would typically be configured through:
- Direct boundary setup: Using
BoundarySetupWithSourcewith custom sources for temperature/salinity - Model initialization: Through hotstart files or initial conditions
- Separate forcing files: Time-varying temperature/salinity data
This design keeps the factory functions simple and focused on their primary purpose while allowing for more complex configurations through the full API.
Wave boundaries¶
Wave Boundary Forcing¶
SCHISM can be coupled with wave models (like WWM-III) to simulate wave-current interactions. When WWM is active, the model requires wave boundary conditions as well. In this examples, we are uisng spectral output from a WW3 model run. The image below shows the full spectral output points over the wholed or australia. Similarly to the atmpspheric forcing and oceanum boundary conditions above, we can simply point the a large lazy dataset, and rompy will extract that times and locations it needs. In the example case blow, you can see all the spectral output points from WW3 in blue, and the extracted points in orange. In this case, only those points within a specified distance from the boundary (default of 2 degress), are used, and interpolated schism boundary points.
# Configure wave boundary forcing for SCHISM-WWM coupling
# This sets up wave spectra data from an external wave model or observations
wave_forcing = SCHISMDataWave(
id="wavedata", # Identifier for wave forcing component
source=SourceIntake(
dataset_id="ausspec", # Wave dataset identifier in the catalog
catalog_uri=TEST_DATA / "catalog.yaml", # Path to data catalog
),
coords={
"x": "lon", # Longitude coordinate mapping
"y": "lat", # Latitude coordinate mapping
},
)
# Visualize wave forcing domain and boundary application
ax = wave_forcing.plot(model_grid=grid)
wave_forcing.plot_boundary(ax=ax, grid=grid)
ax.set_title("Wave Forcing Domain and Model Grid Boundary")
ax.legend()
<matplotlib.legend.Legend at 0x14b4d4638aa0>
SCHISM Namelist Configuration¶
SCHISM uses namelist files to configure model parameters, which are organized in a hierarchical structure. The namelist system controls:
Namelist Structure:¶
- Core parameters: Fundamental simulation settings (time steps, run duration, etc.)
- Optional parameters: Advanced configuration options (friction, wind forcing, etc.)
- Output controls: Which variables to save and how frequently
- Physics modules: Various model components (wave, ice, sediment, etc.)
Main Namelist Components:¶
param: Main parameter namelist with subsections for core, opt, schout, etc.core: Basic simulation parameters like time step and run lengthopt: Optional parameters like friction coefficients and forcing optionsschout: Output control parameters to specify which variables to save
Additional Physics Modules:¶
ice: Ice model parameters for sea ice simulationicm: Integrated Compartment Model parameters for ecosystem modelingsediment: Sediment transport and morphology parameterswwminput: Wave model input parameters for WWM couplingcosine: CoSiNE ecosystem model parametersmice: Multiple Ice Categories model parameters
The namelist system provides a standardised way to configure the model, ensuring all parameters are properly validated and organised.
Complete Model Configuration¶
Now we assemble all forcing components into a complete SCHISM configuration. The main configuration includes:
Configuration Components:¶
- Grid specification: The computational mesh and bathymetry
- Forcing data: Atmospheric, boundary, and wave forcing inputs
- Namelist parameters: Model physics, numerics, and output controls
- Validation: Ensuring all components are compatible and properly configured
Namelist Integration:¶
- Parameter organization: All model parameters must be properly placed in the namelist structure
- Module activation: Different physical processes are enabled through specific namelist settings
- Output control: Variables to save are specified through the schout section of the namelist
from rompy_schism import SCHISMConfig
from rompy_schism.data import SCHISMData
from rompy_schism.namelists import NML
from rompy_schism.namelists.param import Param, Core, Opt, Schout
from rompy_schism.namelists.wwminput import Wwminput, Engs, Proc
from pydantic import ValidationError
# Create comprehensive SCHISM configuration
config = SCHISMConfig(
# Grid configuration
grid=grid,
# Namelist configuration - using correct structure
nml=NML(
param=Param(
# Core parameters can be set here
core=Core(
dt=150.0, # Time step in seconds
# Set core simulation parameters here if needed
),
schout=Schout(
# Output control - hydrodynamic variables
iof_hydro__1=1, # Water elevation output
iof_hydro__14=1, # Wind speed output
iof_hydro__16=1, # Surface velocities output
# Output control - wave variables (WWM coupling)
iof_wwm__18=1, # Peak wave direction output
iof_wwm__1=1, # Significant wave height output
iof_wwm__9=1, # Peak wave period output
),
),
wwminput=Wwminput(
engs=Engs(fricc=0.006),
proc=Proc(deltc=150.0),
),
),
# Complete forcing data configuration
data=SCHISMData(
atmos=atmos_forcing, # Atmospheric forcing (wind)
boundary_conditions=boundary_conditions, # Unified boundary conditions
wave=wave_forcing, # Wave forcing
),
)
print("✓ Complete configuration created successfully!")
print(f"✓ Grid contains {config.grid.pylibs_hgrid.np} nodes")
print(
f"✓ Forcing components: {len([f for f in [atmos_forcing, boundary_conditions, wave_forcing] if f])} configured"
)
✓ Complete configuration created successfully! ✓ Grid contains 2135 nodes ✓ Forcing components: 3 configured
Model Execution¶
With the complete configuration ready, we can now execute the SCHISM simulation. The model run process involves:
Execution Steps:¶
- Workspace preparation: Generate all input files in the correct format
- Model compilation: Build SCHISM executable (if using Docker)
- Parallel execution: Run SCHISM using MPI for parallel processing
- Output generation: Write results to NetCDF files
Performance Considerations:¶
- Grid size: Larger grids require more computational resources
- Time step: Smaller time steps increase accuracy but require more computation
- Output frequency: More frequent output increases I/O overhead
- Parallel scaling: Optimal core count depends on grid size and domain decomposition
Note: Most configuration fields use default values optimized for typical coastal applications.
Model Run Setup¶
The ModelRun class orchestrates the complete simulation workflow from input preparation through model execution. It handles:
- Input file generation: Converts configuration objects to SCHISM input format
- Workspace organization: Creates proper directory structure
- Time management: Handles simulation period and output intervals
- Backend integration: Interfaces with different execution backends (local, Docker, HPC)
# if workdir.exists():
# rmtree(workdir)
# workdir.mkdir(exist_ok=True)
# Create and configure the model run
# This sets up the complete simulation workflow
from rompy.model import ModelRun
# Configure the model run with all necessary parameters
model_run = ModelRun(
run_id="test_schism", # Unique identifier for this simulation run
# Simulation time period - 12-hour test run with hourly output
period=TimeRange(
start=datetime(2023, 1, 1, 0), # Start: 2023-01-01 00:00:00
end=datetime(2023, 1, 1, 12), # End: 2023-01-01 12:00:00
interval="1h", # Output every hour
),
output_dir=str(workdir), # Directory for all simulation files
config=config, # Complete SCHISM configuration object
)
# Generate the complete model workspace
# This creates all input files SCHISM needs to run
print("Generating model workspace...")
rundir = model_run() # Returns path to the run directory
print(f"✓ Model workspace created at: {rundir}")
2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ MODEL RUN CONFIGURATION ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : Run ID : test_schism 2025-10-06 17:20:10 [INFO] rompy.model : Model Type : SCHISMConfig 2025-10-06 17:20:10 [INFO] rompy.model : Start Time : 2023-01-01T00:00:00 2025-10-06 17:20:10 [INFO] rompy.model : End Time : 2023-01-01T12:00:00 2025-10-06 17:20:10 [INFO] rompy.model : Duration : 12 hours 2025-10-06 17:20:10 [INFO] rompy.model : Time Interval : 1:00:00 2025-10-06 17:20:10 [INFO] rompy.model : Output Directory : schism_demo 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : 2025-10-06 17:20:10 [INFO] root : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] root : ┃ MODEL CONFIGURATION (SCHISMConfig) ┃ 2025-10-06 17:20:10 [INFO] root : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] root : 2025-10-06 17:20:10 [INFO] rompy.model : SCHISMConfig: 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ SCHISM MODEL CONFIGURATION ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┠━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┨ 2025-10-06 17:20:10 [INFO] rompy.model : • Grid: SCHISMGrid 2025-10-06 17:20:10 [INFO] rompy.model : Horizontal grid: ../tests/data/schism/hgrid.gr3 2025-10-06 17:20:10 [INFO] rompy.model : Vertical grid: VGrid 2025-10-06 17:20:10 [INFO] rompy.model : • Data: SCHISMData 2025-10-06 17:20:10 [INFO] rompy.model : Components: Atmospheric, Wave, Boundary Conditions 2025-10-06 17:20:10 [INFO] rompy.model : • Namelist: NML 2025-10-06 17:20:10 [INFO] rompy.model : Active modules: Parameters, Wave 2025-10-06 17:20:10 [INFO] rompy.model : • Template: .../rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ STARTING MODEL GENERATION ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : Preparing input files in schism_demo 2025-10-06 17:20:10 [INFO] rompy.model : Processing model configuration... 2025-10-06 17:20:10 [INFO] rompy.model : Running configuration callable... 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┃ GENERATING GRID FILES ┃ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Grid type: SCHISMGrid 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Horizontal grid: ../tests/data/schism/hgrid.gr3 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Vertical grid: VGrid 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating albedo.gr3 with constant value 0.15 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating diffmin.gr3 with constant value 1e-06 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating diffmax.gr3 with constant value 1.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating watertype.gr3 with constant value 1.0
Generating model workspace...
2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating windrot_geo2proj.gr3 with constant value 0.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating drag.gr3 with constant value 1.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo/test_schism/hgrid.ll 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo/test_schism/hgrid_WWM.gr3 2025-10-06 17:20:10 [INFO] rompy_schism.grid : → Generating vertical grid configuration 2025-10-06 17:20:10 [INFO] rompy_schism.vgrid : Creating vgrid.in with ivcor=2, nvrt=2, zlevels=-1000000.0, h_c=40.0, theta_b=0.5, theta_f=1.0 2025-10-06 17:20:10 [INFO] rompy_schism.vgrid : Successfully used create_schism_vgrid to create schism_demo/test_schism/vgrid.in 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Creating tvd.prop with two-column format for 4030 elements 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Successfully created tvd.prop with 4030 elements 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Grid files generated successfully 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┃ PROCESSING INPUT DATA ┃ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Components: Atmospheric, Wave, Boundary Conditions 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing atmospheric forcing data 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Variables: air_1 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Source: ../tests/data/schism/era5.nc 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Output: schism_demo/test_schism/sflux 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Atmospheric data processed successfully 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing wave boundary data 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Source: ../tests/data/catalog.yaml (dataset: ausspec) 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Output: schism_demo/test_schism/wavedata.nc 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Wave data processed successfully 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing boundary conditions 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing tidal constituents: m2, s2, n2 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Generating boundary condition file: bctides.in 2025-10-06 17:20:10 [INFO] rompy_schism.bctides: → Computing tidal factors for 3 constituents 2025-10-06 17:20:10 [INFO] rompy_schism.bctides: Applying nodal phase corrections to earth equilibrium argument 2025-10-06 17:20:10 [INFO] rompy_schism.bctides: Processing tide for boundary 1 2025-10-06 17:20:10 [INFO] rompy_schism.bctides: Number of boundary nodes: 94 2025-10-06 17:20:10 [INFO] rompy_schism.bctides: Number of tidal coefficients: 3 2025-10-06 17:20:10 [INFO] rompy_schism.bctides: Tidal_data shape: (94, 3, 2) 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Boundary conditions written successfully 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing boundary data: elevation 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Source: ../tests/data/schism/hycom.nc 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Files: elev2D.th.nc 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Boundary conditions processed successfully 2025-10-06 17:20:10 [WARNING] rompy_schism.namelists.schism: ! Overwriting existing wave data source specified in namelist with rompy generated data 2025-10-06 17:20:10 [WARNING] rompy_schism.namelists.schism: ! Overwriting param nws value of 0 to 2 to use rompy generated sflux data 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Input data processed successfully 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┃ CONFIGURING NAMELISTS ┃ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Active modules: Parameters, Wave 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Namelists configured successfully 2025-10-06 17:20:10 [INFO] rompy.model : Rendering model templates to schism_demo/test_schism... 2025-10-06 17:20:10 [INFO] rompy.core.render : Template source: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:10 [INFO] rompy.core.render : Output directory: schism_demo 2025-10-06 17:20:10 [INFO] rompy.core.render : Using template version: main 2025-10-06 17:20:10 [INFO] rompy.core.render : • Locating template repository... 2025-10-06 17:20:10 [INFO] rompy.core.render : Template repository located at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:10 [INFO] rompy.core.render : • Generating files from template... 2025-10-06 17:20:10 [INFO] rompy.core.render : • Rendering time: 0.02 seconds 2025-10-06 17:20:10 [INFO] rompy.core.render : • Total process time: 0.02 seconds 2025-10-06 17:20:10 [INFO] rompy.core.render : • Files created: 23 2025-10-06 17:20:10 [INFO] rompy.core.render : • Output location: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism 2025-10-06 17:20:10 [INFO] rompy.model : 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ MODEL GENERATION COMPLETE ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : Model files generated at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism
✓ Model workspace created at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism
Summary: Updated Boundary Conditions Workflow¶
The notebook has been updated to use the new unified boundary conditions system. Here's a summary of the key changes:
Before (Old System):
# Separate classes for different boundary types
tidal_forcing = SCHISMDataTides(...)
ocean_forcing = SCHISMDataOcean(...)
# Separate configuration in SCHISMData
data = SCHISMData(
tides=tidal_forcing,
ocean=ocean_forcing,
atmos=atmos_forcing,
wave=wave_forcing
)
After (New System):
# Unified boundary conditions with factory functions
boundary_conditions = create_hybrid_boundary_config(
constituents=["M2", "S2", "N2"],
tidal_elevations="path/to/tidal_data.nc",
elev_source=SCHISMDataBoundary(...)
)
# Single boundary_conditions field in SCHISMData
data = SCHISMData(
boundary_conditions=boundary_conditions,
atmos=atmos_forcing,
wave=wave_forcing
)
This provides better integration, validation, and flexibility while maintaining all the functionality of the previous system.
SCHISM Model Execution¶
The generated workspace now has all required in puts to perform the schism run. This can be done independent of rompy, using, for example, exiting schism binaries installed on a users system. HOwever, we will execute the SCHISM model using the rompy backend system. This system provides flexible execution options including Docker containerization for reproducible, portable simulations.
Available Execution Backends:¶
Run Backends:¶
- Local: Direct execution on the local machine
- Docker: Containerized execution for reproducibility
- HPC: High-performance computing cluster integration
Pipeline Backends:¶
- Sequential: Run components in order
- Parallel: Execute independent components simultaneously
Postprocessors:¶
- Output conversion: Transform results to different formats
- Visualization: Generate plots and animations
- Analysis: Compute derived quantities and statistics
The Docker backend provides several advantages:
- Reproducible environment: Consistent SCHISM build across systems
- Dependency isolation: No conflicts with local software
- Portable execution: Run anywhere Docker is available
- Version control: Specific SCHISM versions with known configurations
See https://rom-py.github.io/rompy/backends.html# for details.
# Discover available execution backends
# This shows all the backend options available in the current rompy installation
from rompy.model import RUN_BACKENDS, POSTPROCESSORS, PIPELINE_BACKENDS
print("Available Run Backends:")
print("=" * 50)
for name, backend_class in RUN_BACKENDS.items():
print(f" • {name}: {backend_class.__name__}")
print(f"\nAvailable Postprocessors:")
print("=" * 50)
for name, processor_class in POSTPROCESSORS.items():
print(f" • {name}: {processor_class.__name__}")
print(f"\nAvailable Pipeline Backends:")
print("=" * 50)
for name, pipeline_class in PIPELINE_BACKENDS.items():
print(f" • {name}: {pipeline_class.__name__}")
print(
f"\nTotal backends available: {len(RUN_BACKENDS) + len(POSTPROCESSORS) + len(PIPELINE_BACKENDS)}"
)
Available Run Backends: ================================================== • docker: DockerRunBackend • local: LocalRunBackend Available Postprocessors: ================================================== • noop: NoopPostprocessor Available Pipeline Backends: ================================================== • local: LocalPipelineBackend Total backends available: 4
Docker Backend Configuration¶
The Docker backend allows us to run SCHISM in a containerized environment using a pre-built Dockerfile. This approach offers several benefits:
Advantages of Docker Execution:¶
- Consistent environment: Same SCHISM build regardless of host system
- Reproducible results: Identical execution environment across different machines
- No local dependencies: SCHISM and all libraries contained in the image
- Version control: Specific SCHISM versions with known configurations
- Resource management: Control CPU, memory, and other system resources
Docker Configuration Parameters:¶
- Dockerfile: Path to SCHISM build instructions
- Build context: Directory containing source code and dependencies
- Resources: CPU cores, memory limits, execution timeout
- Volumes: Mount points for input/output data exchange
- Environment: Variables for MPI and execution control
No lets run the model using this dockerfile. We can provide an image, or a Dockerfile that will be build. In this case, we are providing a dockerfile, so this should build the docker (which will take a few minutes the first time its run)
# Configure Docker backend for SCHISM execution
# This Docker builds multiple SCHISM versions - we'll use v5.13.0 with wave coupling
from rompy.backends.config import DockerConfig
# SCHISM version and executable configuration
schism_version = "v5.13.0"
exe_suffix = "_WWM" # WWM = Wind Wave Model coupling
# MPI execution command for containerized SCHISM
# Running on 8 cores with 4 scribes (output processors)
command = f"cd /tmp/schism && mpirun --oversubscribe --allow-run-as-root -n 8 schism_{schism_version}{exe_suffix} 4"
# Create Docker configuration object
docker_config = DockerConfig(
# Docker build configuration
dockerfile=Path("Dockerfile"), # Dockerfile for SCHISM build
build_context=Path("../docker/schism"), # Build context directory
# Resource limits and timeouts
timeout=3600, # 1 hour execution timeout
cpu=8, # Number of CPU cores
memory="4g", # Memory limit
# Execution configuration
executable=f'bash -c "{command}"', # Command to run inside container
# Volume mounts for data exchange
volumes=[f"{rundir}:/tmp/schism:Z"], # Mount run directory
# Environment variables for MPI execution
env_vars={
"OMPI_ALLOW_RUN_AS_ROOT": "1", # Allow root user in MPI
"OMPI_ALLOW_RUN_AS_ROOT_CONFIRM": "1", # Confirm root user permission
},
# Container management
remove_container=True, # Clean up after execution
user="root", # Run as root user
)
# Execute the model using Docker backend
print("Starting SCHISM execution in Docker container...")
print(f"Command: {command}")
print(f"Resources: {docker_config.cpu} CPUs, {docker_config.memory} memory")
print("This may take several minutes depending on grid size and simulation length...")
# Run the model and capture success status
success = model_run.run(backend=docker_config)
print(f"✓ Docker execution completed successfully: {success}")
2025-10-06 17:20:10 [WARNING] rompy.run.docker : ! No workspace_dir provided, generating files (this may cause double generation in pipeline) 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ MODEL RUN CONFIGURATION ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : Run ID : test_schism 2025-10-06 17:20:10 [INFO] rompy.model : Model Type : SCHISMConfig 2025-10-06 17:20:10 [INFO] rompy.model : Start Time : 2023-01-01T00:00:00 2025-10-06 17:20:10 [INFO] rompy.model : End Time : 2023-01-01T12:00:00 2025-10-06 17:20:10 [INFO] rompy.model : Duration : 12 hours 2025-10-06 17:20:10 [INFO] rompy.model : Time Interval : 1:00:00 2025-10-06 17:20:10 [INFO] rompy.model : Output Directory : schism_demo 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : 2025-10-06 17:20:10 [INFO] root : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] root : ┃ MODEL CONFIGURATION (SCHISMConfig) ┃ 2025-10-06 17:20:10 [INFO] root : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] root : 2025-10-06 17:20:10 [INFO] rompy.model : SCHISMConfig: 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ SCHISM MODEL CONFIGURATION ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┠━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┨ 2025-10-06 17:20:10 [INFO] rompy.model : • Grid: SCHISMGrid 2025-10-06 17:20:10 [INFO] rompy.model : Horizontal grid: ../tests/data/schism/hgrid.gr3 2025-10-06 17:20:10 [INFO] rompy.model : Vertical grid: VGrid 2025-10-06 17:20:10 [INFO] rompy.model : • Data: SCHISMData 2025-10-06 17:20:10 [INFO] rompy.model : Components: Atmospheric, Wave, Boundary Conditions 2025-10-06 17:20:10 [INFO] rompy.model : • Namelist: NML 2025-10-06 17:20:10 [INFO] rompy.model : Active modules: Parameters, Wave 2025-10-06 17:20:10 [INFO] rompy.model : • Template: .../rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : 2025-10-06 17:20:10 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy.model : ┃ STARTING MODEL GENERATION ┃ 2025-10-06 17:20:10 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy.model : Preparing input files in schism_demo 2025-10-06 17:20:10 [INFO] rompy.model : Processing model configuration... 2025-10-06 17:20:10 [INFO] rompy.model : Running configuration callable... 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┃ GENERATING GRID FILES ┃ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Grid type: SCHISMGrid 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Horizontal grid: ../tests/data/schism/hgrid.gr3 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Vertical grid: VGrid 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating albedo.gr3 with constant value 0.15 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating diffmin.gr3 with constant value 1e-06 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating diffmax.gr3 with constant value 1.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating watertype.gr3 with constant value 1.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating windrot_geo2proj.gr3 with constant value 0.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Generating drag.gr3 with constant value 1.0 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo/test_schism/hgrid.ll 2025-10-06 17:20:10 [ERROR] rompy_schism.grid : ✗ Error generating hgridll: [Errno 17] File exists: 'hgrid.gr3' -> 'schism_demo/test_schism/hgrid.ll' 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo/test_schism/hgrid_WWM.gr3 2025-10-06 17:20:10 [ERROR] rompy_schism.grid : ✗ Error generating hgrid_WWM: [Errno 17] File exists: 'hgrid.gr3' -> 'schism_demo/test_schism/hgrid_WWM.gr3' 2025-10-06 17:20:10 [INFO] rompy_schism.grid : → Generating vertical grid configuration
Starting SCHISM execution in Docker container... Command: cd /tmp/schism && mpirun --oversubscribe --allow-run-as-root -n 8 schism_v5.13.0_WWM 4 Resources: 8 CPUs, 4g memory This may take several minutes depending on grid size and simulation length...
2025-10-06 17:20:10 [INFO] rompy_schism.vgrid : Creating vgrid.in with ivcor=2, nvrt=2, zlevels=-1000000.0, h_c=40.0, theta_b=0.5, theta_f=1.0 2025-10-06 17:20:10 [INFO] rompy_schism.vgrid : Successfully used create_schism_vgrid to create schism_demo/test_schism/vgrid.in 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Creating tvd.prop with two-column format for 4030 elements 2025-10-06 17:20:10 [INFO] rompy_schism.grid : Successfully created tvd.prop with 4030 elements 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Grid files generated successfully 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┃ PROCESSING INPUT DATA ┃ 2025-10-06 17:20:10 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:10 [INFO] rompy_schism.config : → Components: Atmospheric, Wave, Boundary Conditions 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing atmospheric forcing data 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Variables: air_1 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Source: ../tests/data/schism/era5.nc 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Output: schism_demo/test_schism/sflux 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Atmospheric data processed successfully 2025-10-06 17:20:10 [INFO] rompy_schism.data : → Processing wave boundary data 2025-10-06 17:20:10 [INFO] rompy_schism.data : • Source: ../tests/data/catalog.yaml (dataset: ausspec) 2025-10-06 17:20:11 [INFO] rompy_schism.data : • Output: schism_demo/test_schism/wavedata.nc 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Wave data processed successfully 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Processing boundary conditions 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Processing tidal constituents: m2, s2, n2 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Generating boundary condition file: bctides.in 2025-10-06 17:20:11 [INFO] rompy_schism.bctides: → Computing tidal factors for 3 constituents 2025-10-06 17:20:11 [INFO] rompy_schism.bctides: Applying nodal phase corrections to earth equilibrium argument 2025-10-06 17:20:11 [INFO] rompy_schism.bctides: Processing tide for boundary 1 2025-10-06 17:20:11 [INFO] rompy_schism.bctides: Number of boundary nodes: 94 2025-10-06 17:20:11 [INFO] rompy_schism.bctides: Number of tidal coefficients: 3 2025-10-06 17:20:11 [INFO] rompy_schism.bctides: Tidal_data shape: (94, 3, 2) 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Boundary conditions written successfully 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Processing boundary data: elevation 2025-10-06 17:20:11 [INFO] rompy_schism.data : • Source: ../tests/data/schism/hycom.nc 2025-10-06 17:20:11 [INFO] rompy_schism.data : • Files: elev2D.th.nc 2025-10-06 17:20:11 [INFO] rompy_schism.data : → Boundary conditions processed successfully 2025-10-06 17:20:11 [WARNING] rompy_schism.namelists.schism: ! Overwriting existing wave data source specified in namelist with rompy generated data 2025-10-06 17:20:11 [INFO] rompy_schism.config : → Input data processed successfully 2025-10-06 17:20:11 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:11 [INFO] rompy_schism.config : ┃ CONFIGURING NAMELISTS ┃ 2025-10-06 17:20:11 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:11 [INFO] rompy_schism.config : → Active modules: Parameters, Wave 2025-10-06 17:20:11 [INFO] rompy_schism.config : → Namelists configured successfully 2025-10-06 17:20:11 [INFO] rompy.model : Rendering model templates to schism_demo/test_schism... 2025-10-06 17:20:11 [INFO] rompy.core.render : Template source: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:11 [INFO] rompy.core.render : Output directory: schism_demo 2025-10-06 17:20:11 [INFO] rompy.core.render : Using template version: main 2025-10-06 17:20:11 [INFO] rompy.core.render : • Locating template repository... 2025-10-06 17:20:11 [INFO] rompy.core.render : Template repository located at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:11 [INFO] rompy.core.render : • Generating files from template... 2025-10-06 17:20:11 [INFO] rompy.core.render : • Rendering time: 0.00 seconds 2025-10-06 17:20:11 [INFO] rompy.core.render : • Total process time: 0.01 seconds 2025-10-06 17:20:11 [INFO] rompy.core.render : • Files created: 23 2025-10-06 17:20:11 [INFO] rompy.core.render : • Output location: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism 2025-10-06 17:20:11 [INFO] rompy.model : 2025-10-06 17:20:11 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:11 [INFO] rompy.model : ┃ MODEL GENERATION COMPLETE ┃ 2025-10-06 17:20:11 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:11 [INFO] rompy.model : Model files generated at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism 2025-10-06 17:20:11 [INFO] rompy.run.docker : Using existing Docker image: rompy-14ed396ca30d 2025-10-06 17:20:11 [INFO] rompy.run.docker : Executing: docker run --rm --user root -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 -v /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism:/app/run_id:Z -v /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism:/tmp/schism:Z rompy-14ed396ca30d bash -c cd /app/run_id && echo 'Directory contents:' && ls -la && echo 'Executing model...' && bash -c "cd /tmp/schism && mpirun --oversubscribe --allow-run-as-root -n 8 schism_v5.13.0_WWM 4" 2025-10-06 17:20:24 [INFO] rompy.run.docker : Docker stdout: Directory contents: total 1536 drwxr-xr-x. 1 1001 1001 418 Oct 6 06:20 . drwxr-xr-x. 1 root root 12 Oct 6 06:20 .. -rw-r--r--. 1 1001 1001 250 Oct 6 06:20 README -rw-r--r--. 1 1001 1001 170035 Oct 6 06:20 albedo.gr3 -rw-r--r--. 1 1001 1001 7419 Oct 6 06:20 bctides.in drwxr-xr-x. 1 1001 1001 18 Oct 6 06:20 datasets -rw-r--r--. 1 1001 1001 170036 Oct 6 06:20 diffmax.gr3 -rw-r--r--. 1 1001 1001 170036 Oct 6 06:20 diffmin.gr3 -rw-r--r--. 1 1001 1001 170033 Oct 6 06:20 drag.gr3 -rw-r--r--. 1 1001 1001 2624 Oct 6 06:20 elev2D.th.nc -rw-r--r--. 1 1001 1001 225576 Oct 6 06:20 hgrid.gr3 lrwxrwxrwx. 1 1001 1001 9 Oct 6 06:20 hgrid.ll -> hgrid.gr3 lrwxrwxrwx. 1 1001 1001 9 Oct 6 06:20 hgrid_WWM.gr3 -> hgrid.gr3 drwxr-xr-x. 1 1001 1001 18 Oct 6 06:20 outputs -rw-r--r--. 1 1001 1001 4748 Oct 6 06:20 param.nml drwxr-xr-x. 1 1001 1001 70 Oct 6 06:20 sflux -rw-r--r--. 1 1001 1001 27103 Oct 6 06:20 tvd.prop -rw-r--r--. 1 1001 1001 131 Oct 6 06:20 vgrid.in -rw-r--r--. 1 1001 1001 170038 Oct 6 06:20 watertype.gr3 -rw-r--r--. 1 1001 1001 71836 Oct 6 06:20 wavedata.nc -rw-r--r--. 1 1001 1001 170045 Oct 6 06:20 windrot_geo2proj.gr3 -rw-r--r--. 1 1001 1001 163166 Oct 6 06:20 wwmbnd.gr3 -rw-r--r--. 1 1001 1001 4559 Oct 6 06:20 wwminput.nml Executing model... 0: ABORT: QUICKSEARCH: Cannot find a vert. level: NaN 6.9527706805855553E-310 9.8813129168249309E-324 -136.44125996254107 NaN 1: ABORT: QUICKSEARCH: Cannot find a vert. level: -81.163639220970339 3.1620201333839779E-321 4.6700390133766318E-310 -81.171790348831792 NaN 2: ABORT: QUICKSEARCH: Cannot find a vert. level: NaN 3.0780289735909660E-321 4.6585502406820444E-310 -56.060496561422276 NaN 3: ABORT: QUICKSEARCH: Cannot find a vert. level: NaN 2.9545125621306543E-321 4.6419552489453656E-310 -30.600794404007058 NaN 2025-10-06 17:20:24 [WARNING] rompy.run.docker : ! Docker stderr: -------------------------------------------------------------------------- MPI_ABORT was invoked on rank 2 in communicator MPI COMMUNICATOR 3 DUP FROM 0 with errorcode 0. NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. You may or may not see output from other processes, depending on exactly when Open MPI kills them. -------------------------------------------------------------------------- [3e630105fc2e:00001] 3 more processes have sent help message help-mpi-api.txt / mpi-abort [3e630105fc2e:00001] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages 2025-10-06 17:20:24 [INFO] rompy.run.docker : Model run completed successfully with exit code 0
✓ Docker execution completed successfully: True
Model Output Verification¶
After successful execution, SCHISM generates output files containing simulation results. The key output files include:
Primary Output Files:¶
- schout_*.nc: Main output files with hydrodynamic and wave variables
- param.nml: Final parameter file with all model settings
- mirror.out: Runtime information and performance statistics
- **local_to_global_***: Parallel decomposition mapping files
Output Variables (if enabled):¶
- Hydrodynamic: Water elevation, velocities, temperature, salinity
- Wave fields: Significant wave height, peak period, wave direction
- Atmospheric: Wind speed, air pressure, heat fluxes
- Bed dynamics: Bottom stress, sediment transport (if enabled)
# Inspect the model output directory
# This shows all files generated by the SCHISM simulation
print("Model Output Files:")
print("=" * 50)
outputs = print_new_contents(Path(f"{rundir}/outputs"))
Model Output Files: ================================================== Contents of /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo/test_schism/outputs: - readme.md (new) - mirror.out.scribe (new) - fatal.error (new) - nonfatal_000001 (new) - nonfatal_000002 (new) - nonfatal_000003 (new) - nonfatal_000000 (new) - mirror.out (new) - total_TR.out (new) - total.out (new) - JCG.out (new) - subcycling.out (new) - param.out.nml (new) - flux.out (new) - global_to_local.prop (new) - coriolis.out (new) - local_to_global_000000 (new) - local_to_global_000002 (new) - local_to_global_000003 (new) - local_to_global_000001 (new)
Using configurations files¶
The advantage of using pydantic to define interfaces is that the entire model can now be descibed as a schema. This means that the entire definition of model run can be described in a single configuration file.
An instantiated object, can be dumped to a yaml or json file and then used to reinstatiate that same configuration.
# Export complete model configuration to YAML file
# This creates a comprehensive record of all model settings and data sources
import yaml
print("Exporting complete model configuration...")
# Dump the full model configuration to YAML format
# model_dump() serializes all configuration objects with their current values
with open("full_spec.yaml", "w") as f:
yaml.dump(model_run.model_dump(), f)
print("✓ Complete model configuration saved to 'full_spec.yaml'")
print(
" This file contains all parameters, data sources, and settings used in the simulation"
)
print(
" Note: The full dump includes all default values, making it quite comprehensive"
)
Exporting complete model configuration... ✓ Complete model configuration saved to 'full_spec.yaml' This file contains all parameters, data sources, and settings used in the simulation Note: The full dump includes all default values, making it quite comprehensive
# Display the exported model configuration
# This shows the complete YAML representation of the model setup
print("Complete Model Configuration (model.yaml):")
print("=" * 60)
!cat model.yaml
Complete Model Configuration (model.yaml):
============================================================
config:
data:
atmos:
air_1:
_original_inputs:
buffer: 2
filter:
sort:
coords:
- latitude
id: air_1
uwind_name: u10
vwind_name: v10
buffer: 2.0
coords:
s: null
t: time
x: longitude
y: latitude
z: null
crop_data: true
data_type: sflux_air
fail_if_missing: true
filter:
crop:
latitude:
start: -26.529484917
stop: -14.3399080571
longitude:
start: 143.4089758468
stop: 156.1664617424
time:
start: 2022-12-31 00:00:00
stop: 2023-01-02 13:00:00
derived: {}
rename: {}
sort:
coords:
- latitude
subset: {}
timenorm: {}
id: air_1
max_window_hours: 120.0
model_type: grid
prmsl_name: null
relative_weight: 1.0
source:
kwargs: {}
model_type: file
uri: !!python/object/apply:pathlib.PosixPath
- ..
- tests
- data
- schism
- era5.nc
variable: null
spfh_name: null
stmp_name: null
time_buffer:
- 0
- 1
uwind_name: u10
variables:
- u10
- v10
vwind_name: v10
air_2: null
data_type: sflux
prc_1: null
prc_2: null
rad_1: null
rad_2: null
boundary_conditions:
boundaries:
0:
const_elev: null
const_flow: null
const_salt: null
const_temp: null
elev_source:
buffer: 0.0
coords:
s: null
t: time
x: xlon
y: ylat
z: depth
crop_data: true
data_grid_source: null
data_type: boundary
filter:
crop:
time:
start: &id001 2023-01-01 00:00:00
stop: 2023-01-02 12:00:00
derived: {}
rename: {}
sort: {}
subset: {}
timenorm: {}
id: elev2D
model_type: data_boundary
sel_method: interp
sel_method_kwargs: {}
source:
kwargs: {}
model_type: file
uri: !!python/object/apply:pathlib.PosixPath
- ..
- tests
- data
- schism
- hycom.nc
variable: null
spacing: null
time_buffer:
- 0
- 1
variables:
- surf_el
elev_st_path: null
elev_type: 5
flow_th_path: null
inflow_relax: 0.5
mean_elev: null
mean_flow: null
outflow_relax: 0.1
salt_3d_path: null
salt_nudge: 1.0
salt_source: null
salt_th_path: null
salt_type: 3
temp_3d_path: null
temp_nudge: 1.0
temp_source: null
temp_th_path: null
temp_type: 3
vel_source: null
vel_st_path: null
vel_type: 5
data_type: boundary_conditions
hotstart_config: null
setup_type: hybrid
tidal_data:
constituents:
- m2
- s2
- n2
cutoff_depth: 50.0
extra_databases:
- !!python/object/apply:pathlib.PosixPath
- ..
- tests
- data
- schism
- tides
- database.json
extrapolate_tides: false
extrapolation_distance: 50.0
mean_dynamic_topography: 0.0
nodal_corrections: true
tidal_database: !!python/object/apply:pathlib.PosixPath
- ..
- tests
- data
- schism
- tides
tidal_model: OCEANUM-atlas
tidal_potential: true
tide_interpolation_method: bilinear
data_type: schism
wave:
buffer: 2.0
coords:
s: null
t: time
x: lon
y: lat
z: null
crop_data: true
data_type: wave
filter:
crop:
time:
start: *id001
stop: 2023-01-01 18:00:00
derived: {}
rename: {}
sort: {}
subset: {}
timenorm: {}
grid_type: boundary_wave_station
id: wavedata
model_type: data_boundary
sel_method: nearest
sel_method_kwargs:
unique: true
source:
catalog_uri: !!python/object/apply:pathlib.PosixPath
- ..
- tests
- data
- catalog.yaml
catalog_yaml: null
dataset_id: ausspec
kwargs: {}
model_type: intake
spacing: null
time_buffer:
- 0
- 1
variables:
- efth
- lon
- lat
grid:
albedo: 0.15
crs: epsg:4326
diffmax: 1.0
diffmin: 1.0e-06
drag: 1.0
grid_type: schism
hgrid:
id: hgrid
link: false
model_type: data_blob
source: &id002 !!python/object/apply:pathlib.PosixPath
- ..
- tests
- data
- schism
- hgrid.gr3
hgrid_WWM:
gridtype: hgrid_WWM
hgrid:
id: hgrid
link: false
model_type: data_blob
source: *id002
hgridll:
gridtype: hgridll
hgrid:
id: hgrid
link: false
model_type: data_blob
source: *id002
vgrid:
h_c: 40.0
ivcor: 2
model_type: schism_vgrid
nvrt: 2
theta_b: 0.5
theta_f: 1.0
zlevels: -1000000.0
watertype: 1.0
windrot_geo2proj: 0.0
wwmbnd:
hgrid:
id: hgrid
link: false
model_type: data_blob
source: *id002
model_type: wwmbnd_generator
model_type: schism
nml:
param:
core:
dt: 100.0
eco_class: 27
ibc: 0
ibtp: 1
ihfskip: 864
ipre: 0
mdc2: 24
msc2: 24
nbins_veg_vert: 2
nspool: 36
ntracer_age: 4
ntracer_gen: 2
rnday: 0.5
sed_class: 5
opt:
alphaw: 0.5
btrack_nudge: 0.009013
coricoef: 0
courant_weno: 0.5
cur_wwm: 0
dfh0: 0.0001
dfv0: 0.01
dramp: 1.0
dramp_ss: 2
drampbc: 0.0
drampwafo: 0.0
drampwind: 1.0
dtb_max: 30.0
dtb_min: 10.0
dzb_min: 0.5
eos_a: -0.1
eos_b: 1001.0
eps1_tvd_imp: 0.0001
eps2_tvd_imp: 1.0e-14
epsilon1: 0.001
epsilon2: 1.0e-10
epsilon3: 1.0e-25
flag_ic__1: 0
flag_ic__10: 1
flag_ic__11: 1
flag_ic__12: 0
flag_ic__2: 0
flag_ic__3: 1
flag_ic__5: 1
flag_ic__6: 1
flag_ic__7: 1
flag_ic__8: 1
flag_ic__9: 1
fwvor_advxy_stokes: 1
fwvor_advz_stokes: 1
fwvor_breaking: 1
fwvor_gradpress: 1
fwvor_streaming: 1
fwvor_wveg: 0
fwvor_wveg_nl: 0
gen_wsett: 0.0
h0: 0.01
h1_bcc: 50.0
h2_bcc: 100.0
h_tvd: 5.0
hmin_airsea_ex: 0.2
hmin_man: 1.0
hmin_radstress: 1.0
hmin_salt_ex: 0.2
hvis_coef0: 0.025
hw_depth: 1000000.0
hw_ratio: 0.5
i_hmin_airsea_ex: 2
i_hmin_salt_ex: 2
i_prtnftl_weno: 0
ibcc_mean: 0
ibdef: 10
ic_elev: 0
icou_elfe_wwm: 0
ics: 2
ielad_weno: 0
ielm_transport: 0
ieos_pres: 0
ieos_type: 0
if_source: 0
ihconsv: 0
ihdif: 0
ihhat: 1
ihorcon: 0
ihot: 0
ihydraulics: 0
iloadtide: 0
imm: 0
indvel: 0
inter_mom: 0
inu_elev: 0
inu_tr__1: 0
inu_tr__10: 0
inu_tr__11: 0
inu_tr__12: 0
inu_tr__2: 0
inu_tr__3: 0
inu_tr__4: 0
inu_tr__5: 0
inu_tr__6: 0
inu_tr__7: 0
inu_tr__8: 0
inu_tr__9: 0
inu_uv: 0
inunfl: 0
inv_atm_bnd: 0
ip_weno: 2
ipre2: 0
iprecip_off_bnd: 0
isconsv: 0
ishapiro: 1
itr_met: 3
itransport_only: 0
itur: 3
iunder_deep: 0
iupwind_mom: 0
iwbl: 0
iwind_form: 1
iwindoff: 0
kr_co: 1
lev_tr_source__1: -9
lev_tr_source__10: -9
lev_tr_source__11: -9
lev_tr_source__12: -9
lev_tr_source__2: -9
lev_tr_source__3: -9
lev_tr_source__4: -9
lev_tr_source__5: -9
lev_tr_source__6: -9
lev_tr_source__7: -9
lev_tr_source__8: -9
lev_tr_source__9: -9
level_age:
- 9
- -999
loadtide_coef: 0.1
max_subcyc: 10
mid: KL
model_type_pahm: 10
moitn0: 50
mxitn0: 1500
nadv: 1
nchi: 0
ncor: 1
niter_shap: 1
nquad: 2
nramp_elev: 0
nstep_wwm: 1
ntd_weno: 1
nu_sum_mult: 1
nws: 2
prmsl_ref: 101325.0
rlatitude: 46
rmaxvel: 5.0
rtol0: 1.0e-12
sfea0: 45
shapiro0: 0.5
shorewafo: 0
slam0: -124
small_elad: 0.0001
stab: KC
start_day: 1
start_hour: 0
start_month: 1
start_year: 2023
thetai: 0.6
turbinj: 0.15
turbinjds: 1.0
utc_start: 0
velmin_btrack: 0.0001
wafo_obcramp: 0
wtiminc: 150.0
xlsc0: 0.1
schout:
iof_hydro__1: 1
iof_hydro__10: 0
iof_hydro__11: 0
iof_hydro__12: 0
iof_hydro__13: 0
iof_hydro__14: 0
iof_hydro__15: 0
iof_hydro__16: 1
iof_hydro__17: 0
iof_hydro__18: 0
iof_hydro__19: 0
iof_hydro__2: 0
iof_hydro__20: 0
iof_hydro__21: 0
iof_hydro__22: 0
iof_hydro__23: 0
iof_hydro__24: 0
iof_hydro__26: 1
iof_hydro__27: 0
iof_hydro__28: 0
iof_hydro__29: 0
iof_hydro__3: 0
iof_hydro__30: 0
iof_hydro__31: 0
iof_hydro__4: 0
iof_hydro__5: 0
iof_hydro__6: 0
iof_hydro__7: 0
iof_hydro__8: 0
iof_hydro__9: 0
iof_ugrid: 0
iof_wwm__1: 0
iof_wwm__10: 0
iof_wwm__11: 0
iof_wwm__12: 0
iof_wwm__13: 0
iof_wwm__14: 0
iof_wwm__15: 0
iof_wwm__16: 0
iof_wwm__17: 0
iof_wwm__18: 0
iof_wwm__19: 0
iof_wwm__2: 0
iof_wwm__20: 0
iof_wwm__21: 0
iof_wwm__22: 0
iof_wwm__23: 0
iof_wwm__24: 0
iof_wwm__25: 0
iof_wwm__26: 0
iof_wwm__27: 0
iof_wwm__28: 0
iof_wwm__29: 0
iof_wwm__3: 0
iof_wwm__30: 0
iof_wwm__31: 0
iof_wwm__32: 0
iof_wwm__33: 0
iof_wwm__34: 0
iof_wwm__35: 0
iof_wwm__36: 0
iof_wwm__37: 0
iof_wwm__4: 0
iof_wwm__5: 0
iof_wwm__6: 0
iof_wwm__7: 0
iof_wwm__8: 0
iof_wwm__9: 0
iout_sta: 0
nc_out: 1
nhot: 0
nhot_write: 8640
nspool_sta: 10
vegetation:
iveg: 0
veg_cw: 1.5
veg_lai: 1.0
veg_vert_scale_cd:
- 1.0
- 1.0
- 1.0
veg_vert_scale_d:
- 1.0
- 1.0
- 1.0
veg_vert_scale_n:
- 1.0
- 1.0
- 1.0
veg_vert_z:
- 0.0
- 0.5
- 1.0
vertical:
flag_fib: 1
h_bcc1: 100.0
h_massconsv: 2.0
iadjust_mass_consv0__1: 0
iadjust_mass_consv0__10: 0
iadjust_mass_consv0__11: 0
iadjust_mass_consv0__12: 0
iadjust_mass_consv0__2: 0
iadjust_mass_consv0__3: 0
iadjust_mass_consv0__4: 0
iadjust_mass_consv0__5: 0
iadjust_mass_consv0__6: 0
iadjust_mass_consv0__7: 0
iadjust_mass_consv0__8: 0
iadjust_mass_consv0__9: 0
ibtrack_test: 0
iflux: 0
iharind: 0
irouse_test: 0
izonal5: 0
nstep_ice: 1
rearth_eq: 6378206.4
rearth_pole: 6378206.4
rho0: 1000.0
rinflation_icm: 0.001
s1_mxnbt: 0.5
s2_mxnbt: 3.5
shw: 4184.0
slr_rate: 120.0
step_nu_tr: 86400.0
vclose_surf_frac: 1.0
vnf1: 0.0
vnf2: 0.0
vnh1: 400
vnh2: 500
wwminput:
bouc:
begtc: '20230101.000000'
deltc: 1
endtc: '20230101.120000'
filebound: wwmbnd.gr3
filewave: wavedata.nc
iboundformat: 6
lbcse: true
lbcsp: true
lbcwa: false
lbinter: true
lbsp1d: false
lbsp2d: true
lindsprdeg: true
linhom: true
lparmdir: false
unitc: HR
wbdm: 90.0
wbds: 10.0
wbdsms: 1
wbgauss: 0.1
wbhs: 2.0
wbpken: 3.3
wbss: 2
wbtp: 8.0
coupl:
dtcoup: 600.0
lcpl: true
letot: false
nlvt: 10
radflag: LON
curr: {}
engs:
a_biph: 0.2
a_brcr: 0.76
alprol: 0.85
b_alp: 0.5
b_brcr: 0.29
bc_break: 1
br_coef_method: 1
brcr: 0.73
fricc: 0.006
ibreak: 1
icrit: 1
ifric: 1
iroller: 0
lmaxetot: true
max_brcr: 0.8
mesbf: 2
mesbr: 1
mesds: 1
mesin: 1
mesnl: 1
mestr: 1
meveg: 0
min_brcr: 0.25
trico: 0.1
trira: 2.5
triurs: 0.1
zprof_break: 2
grid:
filegrid: hgrid_WWM.gr3
frhigh: 1.0
frlow: 0.04
igridtype: 3
lcird: true
loptsig: false
lslop: false
lstag: false
lvar1d: false
maxdir: 360.0
mdc: 24
mindir: 0.0
msc: 24
slmax: 0.2
history:
alpha_ch: false
begtc: '20230101.000000'
botexper: false
cd: false
cfl1: false
cfl2: false
cfl3: false
cgpp: false
cpp: false
currtx: false
currty: false
definetc: -1
deltc: 3600
dep: false
depdt: false
dm: true
dpeak: false
dspr: true
endtc: '20230101.120000'
etotc: false
etots: false
fileout: wwm_hist.nc
gridwrite: true
hs: true
klm: false
kpp: false
lpp: false
multipleout: 0
orbital: false
outstyle: 'NO'
paramwrite: true
peakd: true
peakdspr: true
printmma: false
rsxx: false
rsxy: false
rsyy: false
stokesbarox: false
stokesbaroy: false
stokessurfx: true
stokessurfy: true
tauhf: false
tautot: true
tauw: true
tm01: true
tm02: true
tmbot: false
tpp: true
tppd: false
ubot: false
ufric: false
unitc: SEC
ursell: false
use_single_out: true
watlev: false
watlevold: false
windx: false
windy: false
wlm: false
wnpp: false
z0: false
hotfile:
begtc: '20230101.000000'
deltc: 2678400.0
endtc: '20230101.120000'
filehot_in: wwm_hot_in.nc
filehot_out: wwm_hot_out.nc
hotstyle_in: 2
hotstyle_out: 2
ihotpos_in: 2
lcyclehot: false
lhotf: true
multiplein: 0
multipleout: 0
unitc: SEC
init:
initstyle: 2
lhotr: false
linid: true
nesting: {}
nums:
amethod: 7
aspar_local_level: 0
block_gauss_seidel: true
dmethod: 2
dtmin_dyn: 1.0
dtmin_sbf: 1.0
dtmin_sbr: 0.1
dtmin_sds: 1.0
dtmin_sin: 1.0
dtmin_snl3: 1.0
dtmin_snl4: 1.0
epsh1: 0.01
epsh2: 0.01
epsh3: 0.01
epsh4: 0.01
epsh5: 0.01
fmethod: 1
freqexp: 0.1
icomp: 3
idiffr: 1
ivector: 2
l_solver_norm: false
laccel: false
ladvtest: false
lcfl: false
lchkconv: false
lconv: false
ldifr: false
lexpimp: false
lfiltersig: false
lfilterth: false
limfak: 0.1
litersplit: false
llimt: true
lnaninfchk: false
lnonl: false
lsoubound: false
lsourceswam: false
lvector: false
lzeta_setup: false
maxcflsig: 1.0
maxcflth: 1.0
maxiter: 1000
melim: 1
ndyniter: 100
ndyniter_sbf: 10
ndyniter_sbr: 10
ndyniter_sds: 10
ndyniter_sin: 10
ndyniter_snl3: 10
ndyniter_snl4: 10
nqsiter: 1
pmin: 1.0
qsconv1: 0.98
qsconv2: 0.98
qsconv3: 0.98
qsconv4: 0.98
qsconv5: 0.98
rtheta: 0.5
smethod: 6
wae_solverthr: 1.0e-06
zeta_meth: 0
petscoptions:
abstol: 1.0e-20
dtol: 10000.0
gmrespreallocate: true
initialguessnonzero: false
ksptype: LGMRES
maxits: 1000
pctype: SOR
rtol: 1.0e-20
proc:
begtc: '20230101.000000'
deltc: 600
dimmode: 2
dmin: 0.01
endtc: '20230101.120000'
lmono_in: false
lmono_out: false
lnautin: true
lnautout: true
lqstea: false
lsphe: true
lstea: false
procname: ACS
unitc: SEC
station:
ac: true
acout_1d: false
acout_2d: false
alpha_ch: false
begtc: '20230101.000000'
botexper: false
cd: false
cfl1: false
cfl2: false
cfl3: false
cgpp: false
cpp: false
currtx: false
currty: false
cutoff: 0.0
definetc: -1
deltc: 3600
dep: true
depdt: false
dm: true
dpeak: false
dspr: true
endtc: '20230101.120000'
etotc: false
etots: false
fileout: wwm_sta.nc
hs: true
iouts: 12
klm: false
kpp: false
loutiter: false
lpp: false
lsigmax: true
lsp1d: true
lsp2d: true
multipleout: 0
nouts:
- BatemansBay
- Brisbane
- ByronBay
- Cairns
- CoffsHbr
- CrowdyHead
- Eden
- HayPt
- Mackay
- PortKembla
- Tsv
- Mandurah
orbital: false
outstyle: NC
paramwrite: true
peakd: true
peakdspr: true
rsxx: false
rsxy: false
rsyy: false
stokesbarox: false
stokesbaroy: false
stokessurfx: true
stokessurfy: true
tauhf: false
tautot: false
tauw: false
tm01: true
tm02: true
tmbot: false
tpp: true
tppd: true
ubot: false
ufric: false
unitc: SEC
ursell: false
use_single_out: true
watlev: false
watlevold: false
windx: true
windy: true
wk: false
wlm: false
wnpp: false
xouts:
- 150.31972
- 153.63166
- 153.745
- 145.715167
- 153.27722
- 152.85333
- 150.15833
- 149.31025
- 149.5467
- 151.01667
- 147.059333
- 115.572227
youts:
- -35.75528
- -27.48716
- -28.67167
- -16.7305
- -30.34361
- -31.82694
- -37.175
- -21.2715
- -21.037333
- -34.46694
- -19.159167
- -32.452787
z0: false
walv: {}
wind: {}
template: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism
delete_existing: false
model_type: modelrun
output_dir: !!python/object/apply:pathlib.PosixPath
- schism_procedural
period:
end: 2023-01-01 12:00:00
include_end: true
interval: !!python/object/apply:datetime.timedelta
- 0
- 3600
- 0
start: *id001
run_id: test_schism
run_id_subdir: true
Simplified Configuration Files¶
The complete model dump shown above includes all parameters with their default values, which makes it comprehensive but verbose. For practical use, the same model configuration can be achieved with much simpler files that specify only non-default values.
Benefits of Simplified Configurations:¶
- Readability: Focus on the parameters that matter for your specific case
- Maintainability: Easier to modify key settings without scrolling through defaults
- Version control: Cleaner diffs when configuration changes
- Documentation: Serves as concise documentation of model setup choices
Example Use Cases:¶
- Parameter studies: Easy to create variants by changing a few key values
- Reproducible research: Minimal files that capture the essence of experiments
- Operational modeling: Standard configurations for routine forecasting
The schism_demo.yaml file below demonstrates this approach with the same configuration using minimal specification.
# Display the simplified demo configuration
# This shows how the same model can be configured with minimal YAML
print("Simplified Model Configuration (schism_demo.yaml):")
print("=" * 50)
print("This compact file achieves the same result as the verbose model.yaml above")
print("by specifying only the non-default parameters.\n")
!cat schism_demo.yaml
Simplified Model Configuration (schism_demo.yaml):
==================================================
This compact file achieves the same result as the verbose model.yaml above
by specifying only the non-default parameters.
run_id: test_schism
run_id_subdir: true
delete_existing: true
output_dir: schism_demo_config
period:
start: 2023-01-01 00:00:00
end: 2023-01-01 12:00:00
config:
model_type: schism
grid:
grid_type: schism
hgrid:
id: hgrid
model_type: data_blob
source: "../tests/data/schism/hgrid.gr3"
# vgrid:
# source: "../tests/data/schism/vgrid.in"
drag: 1
data:
atmos:
air_1:
data_type: sflux_air
source:
model_type: file
uri: "../tests/data/schism/era5.nc"
uwind_name: u10
vwind_name: v10
prmsl_name: msl
filter:
sort:
coords:
- latitude
buffer: 5
boundary_conditions:
data_type: boundary_conditions
setup_type: tidal
tidal_data:
tidal_database: "../tests/data/schism/tides"
tidal_model: "OCEANUM-atlas"
constituents:
- M2
- S2
- N2
nodal_corrections: false
tidal_potential: false
extrapolate_tides: true
boundaries:
0:
elev_type: 5
vel_type: 5
temp_type: 0
salt_type: 0
elev_source:
data_type: boundary
source:
model_type: file
uri: "../tests/data/schism/hycom.nc"
variables:
- surf_el
coords:
t: time
x: xlon
y: ylat
wave:
data_type: wave
coords:
t: time
x: lon
y: lat
grid_type: boundary_wave_station
id: wavedata
source:
catalog_uri: "../tests/data/catalog.yaml"
dataset_id: ausspec
model_type: intake
nml:
param:
core:
dt: 150.0
schout:
iof_hydro__1: 1 # Water elevation output
iof_hydro__14: 1 # Wind speed output
iof_hydro__16: 1 # Surface velocities output
iof_wwm__18: 1 # Peak wave direction output
iof_wwm__1: 1 # Significant wave height output
iof_wwm__9: 1 # Peak wave period output
wwminput:
engs:
fricc: 0.006
proc:
deltc: 150
# Load and execute model from simplified YAML configuration
# This demonstrates how to reproduce the same simulation using a configuration file
import yaml
print("Loading model from simplified configuration file...")
# Load the demo configuration from YAML
demo_config = yaml.load(open("schism_demo.yaml", "r"), Loader=yaml.FullLoader)
# Create ModelRun object from the loaded configuration
run = ModelRun(**demo_config)
# Clean up any existing run directory to ensure fresh start
if run.output_dir.exists():
rmtree(run.output_dir)
print("✓ Cleaned up previous run directory")
# Execute the model run
print("Executing model from configuration file...")
rundir_demo = run()
print(f"✓ Model execution completed. Results in: {rundir_demo}")
2025-10-06 17:20:24 [WARNING] rompy_schism.grid : ! drag is being set to a constant value, this is not recommended. For best results, please supply friction gr3 files with spatially varying values. Further options are under development.
2025-10-06 17:20:24 [INFO] rompy_schism.data : Converting air_1 dictionary to SfluxAir object: {'data_type': 'sflux_air', 'source': {'model_type': 'file', 'uri': '../tests/data/schism/era5.nc'}, 'uwind_name': 'u10', 'vwind_name': 'v10', 'prmsl_name': 'msl', 'filter': {'sort': {'coords': ['latitude']}}, 'buffer': 5}
2025-10-06 17:20:24 [INFO] rompy_schism.data : Converting source dictionary to source object: {'model_type': 'file', 'uri': '../tests/data/schism/era5.nc'}
2025-10-06 17:20:24 [INFO] rompy_schism.data : Created source object from URI: ../tests/data/schism/era5.nc
2025-10-06 17:20:24 [INFO] rompy_schism.data : Successfully created SfluxAir instance with source type: <class 'rompy.core.source.SourceFile'>
2025-10-06 17:20:24 [INFO] rompy_schism.data : Successfully converted air_1 to SfluxAir instance
2025-10-06 17:20:24 [WARNING] rompy_schism.data : ! vel_source should be provided for EXTERNAL, HARMONICEXTERNAL, or RELAXED velocity type
2025-10-06 17:20:24 [WARNING] rompy_schism.data : ! vel_source should be provided for EXTERNAL, HARMONICEXTERNAL, or RELAXED velocity type
2025-10-06 17:20:24 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:24 [INFO] rompy.model : ┃ MODEL RUN CONFIGURATION ┃
2025-10-06 17:20:24 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:24 [INFO] rompy.model : Run ID : test_schism
2025-10-06 17:20:24 [INFO] rompy.model : Model Type : SCHISMConfig
2025-10-06 17:20:24 [INFO] rompy.model : Start Time : 2023-01-01T00:00:00
2025-10-06 17:20:24 [INFO] rompy.model : End Time : 2023-01-01T12:00:00
2025-10-06 17:20:24 [INFO] rompy.model : Duration : 12 hours
2025-10-06 17:20:24 [INFO] rompy.model : Time Interval : 1:00:00
2025-10-06 17:20:24 [INFO] rompy.model : Output Directory : schism_demo_config
2025-10-06 17:20:24 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:24 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:24 [INFO] rompy.model :
2025-10-06 17:20:24 [INFO] root : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:24 [INFO] root : ┃ MODEL CONFIGURATION (SCHISMConfig) ┃
2025-10-06 17:20:24 [INFO] root : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:24 [INFO] root :
2025-10-06 17:20:24 [INFO] rompy.model : SCHISMConfig:
2025-10-06 17:20:24 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:24 [INFO] rompy.model : ┃ SCHISM MODEL CONFIGURATION ┃
2025-10-06 17:20:24 [INFO] rompy.model : ┠━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┨
2025-10-06 17:20:24 [INFO] rompy.model : • Grid: SCHISMGrid
2025-10-06 17:20:24 [INFO] rompy.model : Horizontal grid: ../tests/data/schism/hgrid.gr3
2025-10-06 17:20:24 [INFO] rompy.model : Vertical grid: VGrid
2025-10-06 17:20:24 [INFO] rompy.model : • Data: SCHISMData
2025-10-06 17:20:24 [INFO] rompy.model : Components: Atmospheric, Wave, Boundary Conditions
2025-10-06 17:20:24 [INFO] rompy.model : • Namelist: NML
2025-10-06 17:20:24 [INFO] rompy.model : Active modules: Parameters, Wave
2025-10-06 17:20:24 [INFO] rompy.model : • Template: .../rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:24 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:24 [INFO] rompy.model :
2025-10-06 17:20:24 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:24 [INFO] rompy.model : ┃ STARTING MODEL GENERATION ┃
2025-10-06 17:20:24 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:24 [INFO] rompy.model : Preparing input files in schism_demo_config
2025-10-06 17:20:24 [INFO] rompy.model : Processing model configuration...
2025-10-06 17:20:24 [INFO] rompy.model : Running configuration callable...
2025-10-06 17:20:24 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:24 [INFO] rompy_schism.config : ┃ GENERATING GRID FILES ┃
2025-10-06 17:20:24 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:24 [INFO] rompy_schism.config : → Grid type: SCHISMGrid
2025-10-06 17:20:24 [INFO] rompy_schism.config : → Horizontal grid: ../tests/data/schism/hgrid.gr3
2025-10-06 17:20:24 [INFO] rompy_schism.config : → Vertical grid: VGrid
Loading model from simplified configuration file... ✓ Cleaned up previous run directory Executing model from configuration file...
2025-10-06 17:20:24 [INFO] rompy_schism.grid : Generating albedo.gr3 with constant value 0.15 2025-10-06 17:20:24 [INFO] rompy_schism.grid : Generating diffmin.gr3 with constant value 1e-06 2025-10-06 17:20:24 [INFO] rompy_schism.grid : Generating diffmax.gr3 with constant value 1.0 2025-10-06 17:20:24 [INFO] rompy_schism.grid : Generating watertype.gr3 with constant value 1.0 2025-10-06 17:20:24 [INFO] rompy_schism.grid : Generating windrot_geo2proj.gr3 with constant value 0.0 2025-10-06 17:20:25 [INFO] rompy_schism.grid : Generating drag.gr3 with constant value 1.0 2025-10-06 17:20:25 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo_config/test_schism/hgrid.ll 2025-10-06 17:20:25 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo_config/test_schism/hgrid_WWM.gr3 2025-10-06 17:20:25 [INFO] rompy_schism.grid : → Generating vertical grid configuration 2025-10-06 17:20:25 [INFO] rompy_schism.vgrid : Creating vgrid.in with ivcor=2, nvrt=2, zlevels=-1000000.0, h_c=40.0, theta_b=0.5, theta_f=1.0 2025-10-06 17:20:25 [INFO] rompy_schism.vgrid : Successfully used create_schism_vgrid to create schism_demo_config/test_schism/vgrid.in 2025-10-06 17:20:25 [INFO] rompy_schism.grid : Creating tvd.prop with two-column format for 4030 elements 2025-10-06 17:20:25 [INFO] rompy_schism.grid : Successfully created tvd.prop with 4030 elements 2025-10-06 17:20:25 [INFO] rompy_schism.config : → Grid files generated successfully 2025-10-06 17:20:25 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:25 [INFO] rompy_schism.config : ┃ PROCESSING INPUT DATA ┃ 2025-10-06 17:20:25 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:25 [INFO] rompy_schism.config : → Components: Atmospheric, Wave, Boundary Conditions 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Processing atmospheric forcing data 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Variables: air_1 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Source: ../tests/data/schism/era5.nc 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Output: schism_demo_config/test_schism/sflux 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Atmospheric data processed successfully 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Processing wave boundary data 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Source: ../tests/data/catalog.yaml (dataset: ausspec) 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Output: schism_demo_config/test_schism/wavedata.nc 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Wave data processed successfully 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Processing boundary conditions 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Processing tidal constituents: m2, s2, n2 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Generating boundary condition file: bctides.in 2025-10-06 17:20:25 [INFO] rompy_schism.bctides: → Computing tidal factors for 3 constituents 2025-10-06 17:20:25 [INFO] rompy_schism.bctides: Processing tide for boundary 1 2025-10-06 17:20:25 [INFO] rompy_schism.bctides: Number of boundary nodes: 94 2025-10-06 17:20:25 [INFO] rompy_schism.bctides: Number of tidal coefficients: 3 2025-10-06 17:20:25 [INFO] rompy_schism.bctides: Tidal_data shape: (94, 3, 2) 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Boundary conditions written successfully 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Processing boundary data: elevation 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Source: ../tests/data/schism/hycom.nc 2025-10-06 17:20:25 [INFO] rompy_schism.data : • Files: elev2D.th.nc 2025-10-06 17:20:25 [INFO] rompy_schism.data : → Boundary conditions processed successfully 2025-10-06 17:20:25 [WARNING] rompy_schism.namelists.schism: ! Overwriting existing wave data source specified in namelist with rompy generated data 2025-10-06 17:20:25 [WARNING] rompy_schism.namelists.schism: ! Overwriting param nws value of 0 to 2 to use rompy generated sflux data 2025-10-06 17:20:25 [INFO] rompy_schism.config : → Input data processed successfully 2025-10-06 17:20:25 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:25 [INFO] rompy_schism.config : ┃ CONFIGURING NAMELISTS ┃ 2025-10-06 17:20:25 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:25 [INFO] rompy_schism.config : → Active modules: Parameters, Wave 2025-10-06 17:20:25 [INFO] rompy_schism.config : → Namelists configured successfully 2025-10-06 17:20:25 [INFO] rompy.model : Rendering model templates to schism_demo_config/test_schism... 2025-10-06 17:20:25 [INFO] rompy.core.render : Template source: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:25 [INFO] rompy.core.render : Output directory: schism_demo_config 2025-10-06 17:20:25 [INFO] rompy.core.render : Using template version: main 2025-10-06 17:20:25 [INFO] rompy.core.render : • Locating template repository... 2025-10-06 17:20:25 [INFO] rompy.core.render : Template repository located at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism 2025-10-06 17:20:25 [INFO] rompy.core.render : • Generating files from template... 2025-10-06 17:20:25 [INFO] rompy.core.render : • Rendering time: 0.00 seconds 2025-10-06 17:20:25 [INFO] rompy.core.render : • Total process time: 0.00 seconds 2025-10-06 17:20:25 [INFO] rompy.core.render : • Files created: 23 2025-10-06 17:20:25 [INFO] rompy.core.render : • Output location: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism 2025-10-06 17:20:25 [INFO] rompy.model : 2025-10-06 17:20:25 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ 2025-10-06 17:20:25 [INFO] rompy.model : ┃ MODEL GENERATION COMPLETE ┃ 2025-10-06 17:20:25 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ 2025-10-06 17:20:25 [INFO] rompy.model : Model files generated at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
✓ Model execution completed. Results in: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
Command line interface¶
Alternatively, these configurations can be simply executed using the cli (https://rom-py.github.io/rompy/cli.html)
!rompy generate schism_demo.yaml -v
print("Executing model via rompy CLI...")
print("Command: rompy schism demo.yaml")
print("=" * 40)
2025-10-06 17:20:27 [INFO] rompy.cli : Loading config from: schism_demo.yaml
2025-10-06 17:20:27 [INFO] rompy.cli : Parsed config as YAML
2025-10-06 17:20:27 [WARNING] rompy_schism.grid : ! drag is being set to a constant value, this is not recommended. For best results, please supply friction gr3 files with spatially varying values. Further options are under development.
2025-10-06 17:20:27 [INFO] rompy_schism.data : Converting air_1 dictionary to SfluxAir object: {'data_type': 'sflux_air', 'source': {'model_type': 'file', 'uri': '../tests/data/schism/era5.nc'}, 'uwind_name': 'u10', 'vwind_name': 'v10', 'prmsl_name': 'msl', 'filter': {'sort': {'coords': ['latitude']}}, 'buffer': 5}
2025-10-06 17:20:27 [INFO] rompy_schism.data : Converting source dictionary to source object: {'model_type': 'file', 'uri': '../tests/data/schism/era5.nc'}
2025-10-06 17:20:27 [INFO] rompy_schism.data : Created source object from URI: ../tests/data/schism/era5.nc
2025-10-06 17:20:27 [INFO] rompy_schism.data : Successfully created SfluxAir instance with source type: <class 'rompy.core.source.SourceFile'>
2025-10-06 17:20:27 [INFO] rompy_schism.data : Successfully converted air_1 to SfluxAir instance
2025-10-06 17:20:27 [WARNING] rompy_schism.data : ! vel_source should be provided for EXTERNAL, HARMONICEXTERNAL, or RELAXED velocity type
2025-10-06 17:20:27 [WARNING] rompy_schism.data : ! vel_source should be provided for EXTERNAL, HARMONICEXTERNAL, or RELAXED velocity type
2025-10-06 17:20:27 [INFO] rompy.cli : Generating inputs for: schism
2025-10-06 17:20:27 [INFO] rompy.cli : Run ID: test_schism
2025-10-06 17:20:27 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] rompy.model : ┃ MODEL RUN CONFIGURATION ┃
2025-10-06 17:20:27 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] rompy.model : Run ID : test_schism
2025-10-06 17:20:27 [INFO] rompy.model : Model Type : SCHISMConfig
2025-10-06 17:20:27 [INFO] rompy.model : Start Time : 2023-01-01T00:00:00
2025-10-06 17:20:27 [INFO] rompy.model : End Time : 2023-01-01T12:00:00
2025-10-06 17:20:27 [INFO] rompy.model : Duration : 12 hours
2025-10-06 17:20:27 [INFO] rompy.model : Time Interval : 1:00:00
2025-10-06 17:20:27 [INFO] rompy.model : Output Directory : schism_demo_config
2025-10-06 17:20:27 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] rompy.model :
2025-10-06 17:20:27 [INFO] root : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] root : ┃ MODEL CONFIGURATION (SCHISMConfig) ┃
2025-10-06 17:20:27 [INFO] root : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] root :
2025-10-06 17:20:27 [INFO] rompy.model : SCHISMConfig:
2025-10-06 17:20:27 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] rompy.model : ┃ SCHISM MODEL CONFIGURATION ┃
2025-10-06 17:20:27 [INFO] rompy.model : ┠━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┨
2025-10-06 17:20:27 [INFO] rompy.model : • Grid: SCHISMGrid
2025-10-06 17:20:27 [INFO] rompy.model : Horizontal grid: ../tests/data/schism/hgrid.gr3
2025-10-06 17:20:27 [INFO] rompy.model : Vertical grid: VGrid
2025-10-06 17:20:27 [INFO] rompy.model : • Data: SCHISMData
2025-10-06 17:20:27 [INFO] rompy.model : Components: Atmospheric, Wave, Boundary Conditions
2025-10-06 17:20:27 [INFO] rompy.model : • Namelist: NML
2025-10-06 17:20:27 [INFO] rompy.model : Active modules: Parameters, Wave
2025-10-06 17:20:27 [INFO] rompy.model : • Template: .../rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:27 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] rompy.model :
2025-10-06 17:20:27 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] rompy.model : ┃ STARTING MODEL GENERATION ┃
2025-10-06 17:20:27 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] rompy.model : Preparing input files in schism_demo_config
2025-10-06 17:20:27 [INFO] rompy.model : Processing model configuration...
2025-10-06 17:20:27 [INFO] rompy.model : Running configuration callable...
2025-10-06 17:20:27 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] rompy_schism.config : ┃ GENERATING GRID FILES ┃
2025-10-06 17:20:27 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] rompy_schism.config : → Grid type: SCHISMGrid
2025-10-06 17:20:27 [INFO] rompy_schism.config : → Horizontal grid: ../tests/data/schism/hgrid.gr3
2025-10-06 17:20:27 [INFO] rompy_schism.config : → Vertical grid: VGrid
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Generating albedo.gr3 with constant value 0.15
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Generating diffmin.gr3 with constant value 1e-06
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Generating diffmax.gr3 with constant value 1.0
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Generating watertype.gr3 with constant value 1.0
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Generating windrot_geo2proj.gr3 with constant value 0.0
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Generating drag.gr3 with constant value 1.0
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo_config/test_schism/hgrid.ll
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo_config/test_schism/hgrid_WWM.gr3
2025-10-06 17:20:27 [INFO] rompy_schism.grid : → Generating vertical grid configuration
2025-10-06 17:20:27 [INFO] rompy_schism.vgrid : Creating vgrid.in with ivcor=2, nvrt=2, zlevels=-1000000.0, h_c=40.0, theta_b=0.5, theta_f=1.0
2025-10-06 17:20:27 [INFO] rompy_schism.vgrid : Successfully used create_schism_vgrid to create schism_demo_config/test_schism/vgrid.in
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Creating tvd.prop with two-column format for 4030 elements
2025-10-06 17:20:27 [INFO] rompy_schism.grid : Successfully created tvd.prop with 4030 elements
2025-10-06 17:20:27 [INFO] rompy_schism.config : → Grid files generated successfully
2025-10-06 17:20:27 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:27 [INFO] rompy_schism.config : ┃ PROCESSING INPUT DATA ┃
2025-10-06 17:20:27 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:27 [INFO] rompy_schism.config : → Components: Atmospheric, Wave, Boundary Conditions
2025-10-06 17:20:27 [INFO] rompy_schism.data : → Processing atmospheric forcing data
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Variables: air_1
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Source: ../tests/data/schism/era5.nc
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Output: schism_demo_config/test_schism/sflux
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Atmospheric data processed successfully
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Processing wave boundary data
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Source: ../tests/data/catalog.yaml (dataset: ausspec)
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Output: schism_demo_config/test_schism/wavedata.nc
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Wave data processed successfully
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Processing boundary conditions
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Processing tidal constituents: m2, s2, n2
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Generating boundary condition file: bctides.in
2025-10-06 17:20:28 [INFO] rompy_schism.bctides: → Computing tidal factors for 3 constituents
2025-10-06 17:20:28 [INFO] rompy_schism.bctides: Processing tide for boundary 1
2025-10-06 17:20:28 [INFO] rompy_schism.bctides: Number of boundary nodes: 94
2025-10-06 17:20:28 [INFO] rompy_schism.bctides: Number of tidal coefficients: 3
2025-10-06 17:20:28 [INFO] rompy_schism.bctides: Tidal_data shape: (94, 3, 2)
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Boundary conditions written successfully
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Processing boundary data: elevation
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Source: ../tests/data/schism/hycom.nc
2025-10-06 17:20:28 [INFO] rompy_schism.data : • Files: elev2D.th.nc
2025-10-06 17:20:28 [INFO] rompy_schism.data : → Boundary conditions processed successfully
2025-10-06 17:20:28 [WARNING] rompy_schism.namelists.schism: ! Overwriting existing wave data source specified in namelist with rompy generated data
2025-10-06 17:20:28 [WARNING] rompy_schism.namelists.schism: ! Overwriting param nws value of 0 to 2 to use rompy generated sflux data
2025-10-06 17:20:28 [INFO] rompy_schism.config : → Input data processed successfully
2025-10-06 17:20:28 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:28 [INFO] rompy_schism.config : ┃ CONFIGURING NAMELISTS ┃
2025-10-06 17:20:28 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:28 [INFO] rompy_schism.config : → Active modules: Parameters, Wave
2025-10-06 17:20:28 [INFO] rompy_schism.config : → Namelists configured successfully
2025-10-06 17:20:28 [INFO] rompy.model : Rendering model templates to schism_demo_config/test_schism...
2025-10-06 17:20:28 [INFO] rompy.core.render : Template source: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:28 [INFO] rompy.core.render : Output directory: schism_demo_config
2025-10-06 17:20:28 [INFO] rompy.core.render : Using template version: main
2025-10-06 17:20:28 [INFO] rompy.core.render : • Locating template repository...
2025-10-06 17:20:28 [INFO] rompy.core.render : Template repository located at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:28 [INFO] rompy.core.render : • Generating files from template...
2025-10-06 17:20:28 [INFO] rompy.core.render : • Rendering time: 0.01 seconds
2025-10-06 17:20:28 [INFO] rompy.core.render : • Total process time: 0.01 seconds
2025-10-06 17:20:28 [INFO] rompy.core.render : • Files created: 23
2025-10-06 17:20:28 [INFO] rompy.core.render : • Output location: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:28 [INFO] rompy.model :
2025-10-06 17:20:28 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:28 [INFO] rompy.model : ┃ MODEL GENERATION COMPLETE ┃
2025-10-06 17:20:28 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:28 [INFO] rompy.model : Model files generated at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:28 [INFO] rompy.cli : ✅ Inputs generated in 0.79s
2025-10-06 17:20:28 [INFO] rompy.cli : 📁 Staging directory: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:28 [INFO] rompy.cli : Generated 21 files
Executing model via rompy CLI...
Command: rompy schism demo.yaml
========================================
Similarly, we can use the cli to run the model using a predifined configuration file. Note that the backend is separted here in a deliberate attemp to keep model configuration separte from runtime configuration (https://rom-py.github.io/rompy/developer/architecture/selection_patterns.html#the-two-patterns)
# The equivalent configuration above is given in docker_run_config.yaml
!cat docker_run_config.yaml
type: docker
build_args: {}
build_context: ../docker/schism
cpu: 8
dockerfile: Dockerfile
env_vars:
OMPI_ALLOW_RUN_AS_ROOT: "1"
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: "1"
executable:
bash -c "cd /tmp/schism && mpirun --oversubscribe --allow-run-as-root
-n 8 schism_v5.13.0_WWM 4"
memory: 4g
remove_container: true
timeout: 3600
user: root
volumes:
- ./schism_demo_config/test_schism:/tmp/schism:Z
# Now we can used this configuration to run the model using the rompy cli
!rompy run schism_demo.yaml --backend-config docker_run_config.yaml -v
print("\n✓ CLI execution completed")
print("✓ This demonstrates three equivalent ways to run the same SCHISM simulation:")
print(" 1. Programmatic: Create objects and call methods (shown earlier)")
print(" 2. Configuration: Load YAML file and create ModelRun object")
print(" 3. Command-line: Use 'rompy schism config.yaml' command")
2025-10-06 17:20:31 [INFO] rompy.cli : Loading config from: schism_demo.yaml
2025-10-06 17:20:31 [INFO] rompy.cli : Parsed config as YAML
2025-10-06 17:20:31 [WARNING] rompy_schism.grid : ! drag is being set to a constant value, this is not recommended. For best results, please supply friction gr3 files with spatially varying values. Further options are under development.
2025-10-06 17:20:31 [INFO] rompy_schism.data : Converting air_1 dictionary to SfluxAir object: {'data_type': 'sflux_air', 'source': {'model_type': 'file', 'uri': '../tests/data/schism/era5.nc'}, 'uwind_name': 'u10', 'vwind_name': 'v10', 'prmsl_name': 'msl', 'filter': {'sort': {'coords': ['latitude']}}, 'buffer': 5}
2025-10-06 17:20:31 [INFO] rompy_schism.data : Converting source dictionary to source object: {'model_type': 'file', 'uri': '../tests/data/schism/era5.nc'}
2025-10-06 17:20:31 [INFO] rompy_schism.data : Created source object from URI: ../tests/data/schism/era5.nc
2025-10-06 17:20:31 [INFO] rompy_schism.data : Successfully created SfluxAir instance with source type: <class 'rompy.core.source.SourceFile'>
2025-10-06 17:20:31 [INFO] rompy_schism.data : Successfully converted air_1 to SfluxAir instance
2025-10-06 17:20:31 [WARNING] rompy_schism.data : ! vel_source should be provided for EXTERNAL, HARMONICEXTERNAL, or RELAXED velocity type
2025-10-06 17:20:31 [WARNING] rompy_schism.data : ! vel_source should be provided for EXTERNAL, HARMONICEXTERNAL, or RELAXED velocity type
2025-10-06 17:20:31 [INFO] rompy.cli : Running model: schism
2025-10-06 17:20:31 [INFO] rompy.cli : Run ID: test_schism
2025-10-06 17:20:31 [INFO] rompy.cli : Loading backend configuration from: docker_run_config.yaml
2025-10-06 17:20:31 [INFO] rompy.cli : Loading config from: docker_run_config.yaml
2025-10-06 17:20:31 [INFO] rompy.cli : Parsed config as YAML
2025-10-06 17:20:31 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] rompy.model : ┃ MODEL RUN CONFIGURATION ┃
2025-10-06 17:20:31 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] rompy.model : Run ID : test_schism
2025-10-06 17:20:31 [INFO] rompy.model : Model Type : SCHISMConfig
2025-10-06 17:20:31 [INFO] rompy.model : Start Time : 2023-01-01T00:00:00
2025-10-06 17:20:31 [INFO] rompy.model : End Time : 2023-01-01T12:00:00
2025-10-06 17:20:31 [INFO] rompy.model : Duration : 12 hours
2025-10-06 17:20:31 [INFO] rompy.model : Time Interval : 1:00:00
2025-10-06 17:20:31 [INFO] rompy.model : Output Directory : schism_demo_config
2025-10-06 17:20:31 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] rompy.model :
2025-10-06 17:20:31 [INFO] root : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] root : ┃ MODEL CONFIGURATION (SCHISMConfig) ┃
2025-10-06 17:20:31 [INFO] root : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] root :
2025-10-06 17:20:31 [INFO] rompy.model : SCHISMConfig:
2025-10-06 17:20:31 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] rompy.model : ┃ SCHISM MODEL CONFIGURATION ┃
2025-10-06 17:20:31 [INFO] rompy.model : ┠━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┨
2025-10-06 17:20:31 [INFO] rompy.model : • Grid: SCHISMGrid
2025-10-06 17:20:31 [INFO] rompy.model : Horizontal grid: ../tests/data/schism/hgrid.gr3
2025-10-06 17:20:31 [INFO] rompy.model : Vertical grid: VGrid
2025-10-06 17:20:31 [INFO] rompy.model : • Data: SCHISMData
2025-10-06 17:20:31 [INFO] rompy.model : Components: Atmospheric, Wave, Boundary Conditions
2025-10-06 17:20:31 [INFO] rompy.model : • Namelist: NML
2025-10-06 17:20:31 [INFO] rompy.model : Active modules: Parameters, Wave
2025-10-06 17:20:31 [INFO] rompy.model : • Template: .../rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:31 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] rompy.model :
2025-10-06 17:20:31 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] rompy.model : ┃ STARTING MODEL GENERATION ┃
2025-10-06 17:20:31 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] rompy.model : Preparing input files in schism_demo_config
2025-10-06 17:20:31 [INFO] rompy.model : Processing model configuration...
2025-10-06 17:20:31 [INFO] rompy.model : Running configuration callable...
2025-10-06 17:20:31 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] rompy_schism.config : ┃ GENERATING GRID FILES ┃
2025-10-06 17:20:31 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] rompy_schism.config : → Grid type: SCHISMGrid
2025-10-06 17:20:31 [INFO] rompy_schism.config : → Horizontal grid: ../tests/data/schism/hgrid.gr3
2025-10-06 17:20:31 [INFO] rompy_schism.config : → Vertical grid: VGrid
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Generating albedo.gr3 with constant value 0.15
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Generating diffmin.gr3 with constant value 1e-06
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Generating diffmax.gr3 with constant value 1.0
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Generating watertype.gr3 with constant value 1.0
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Generating windrot_geo2proj.gr3 with constant value 0.0
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Generating drag.gr3 with constant value 1.0
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo_config/test_schism/hgrid.ll
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Linking hgrid.gr3 to schism_demo_config/test_schism/hgrid_WWM.gr3
2025-10-06 17:20:31 [INFO] rompy_schism.grid : → Generating vertical grid configuration
2025-10-06 17:20:31 [INFO] rompy_schism.vgrid : Creating vgrid.in with ivcor=2, nvrt=2, zlevels=-1000000.0, h_c=40.0, theta_b=0.5, theta_f=1.0
2025-10-06 17:20:31 [INFO] rompy_schism.vgrid : Successfully used create_schism_vgrid to create schism_demo_config/test_schism/vgrid.in
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Creating tvd.prop with two-column format for 4030 elements
2025-10-06 17:20:31 [INFO] rompy_schism.grid : Successfully created tvd.prop with 4030 elements
2025-10-06 17:20:31 [INFO] rompy_schism.config : → Grid files generated successfully
2025-10-06 17:20:31 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:31 [INFO] rompy_schism.config : ┃ PROCESSING INPUT DATA ┃
2025-10-06 17:20:31 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:31 [INFO] rompy_schism.config : → Components: Atmospheric, Wave, Boundary Conditions
2025-10-06 17:20:31 [INFO] rompy_schism.data : → Processing atmospheric forcing data
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Variables: air_1
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Source: ../tests/data/schism/era5.nc
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Output: schism_demo_config/test_schism/sflux
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Atmospheric data processed successfully
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Processing wave boundary data
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Source: ../tests/data/catalog.yaml (dataset: ausspec)
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Output: schism_demo_config/test_schism/wavedata.nc
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Wave data processed successfully
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Processing boundary conditions
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Processing tidal constituents: m2, s2, n2
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Generating boundary condition file: bctides.in
2025-10-06 17:20:32 [INFO] rompy_schism.bctides: → Computing tidal factors for 3 constituents
2025-10-06 17:20:32 [INFO] rompy_schism.bctides: Processing tide for boundary 1
2025-10-06 17:20:32 [INFO] rompy_schism.bctides: Number of boundary nodes: 94
2025-10-06 17:20:32 [INFO] rompy_schism.bctides: Number of tidal coefficients: 3
2025-10-06 17:20:32 [INFO] rompy_schism.bctides: Tidal_data shape: (94, 3, 2)
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Boundary conditions written successfully
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Processing boundary data: elevation
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Source: ../tests/data/schism/hycom.nc
2025-10-06 17:20:32 [INFO] rompy_schism.data : • Files: elev2D.th.nc
2025-10-06 17:20:32 [INFO] rompy_schism.data : → Boundary conditions processed successfully
2025-10-06 17:20:32 [WARNING] rompy_schism.namelists.schism: ! Overwriting existing wave data source specified in namelist with rompy generated data
2025-10-06 17:20:32 [WARNING] rompy_schism.namelists.schism: ! Overwriting param nws value of 0 to 2 to use rompy generated sflux data
2025-10-06 17:20:32 [INFO] rompy_schism.config : → Input data processed successfully
2025-10-06 17:20:32 [INFO] rompy_schism.config : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:32 [INFO] rompy_schism.config : ┃ CONFIGURING NAMELISTS ┃
2025-10-06 17:20:32 [INFO] rompy_schism.config : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:32 [INFO] rompy_schism.config : → Active modules: Parameters, Wave
2025-10-06 17:20:32 [INFO] rompy_schism.config : → Namelists configured successfully
2025-10-06 17:20:32 [INFO] rompy.model : Rendering model templates to schism_demo_config/test_schism...
2025-10-06 17:20:32 [INFO] rompy.core.render : Template source: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:32 [INFO] rompy.core.render : Output directory: schism_demo_config
2025-10-06 17:20:32 [INFO] rompy.core.render : Using template version: main
2025-10-06 17:20:32 [INFO] rompy.core.render : • Locating template repository...
2025-10-06 17:20:32 [INFO] rompy.core.render : Template repository located at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/src/rompy_schism/templates/schism
2025-10-06 17:20:32 [INFO] rompy.core.render : • Generating files from template...
2025-10-06 17:20:32 [INFO] rompy.core.render : • Rendering time: 0.01 seconds
2025-10-06 17:20:32 [INFO] rompy.core.render : • Total process time: 0.01 seconds
2025-10-06 17:20:32 [INFO] rompy.core.render : • Files created: 23
2025-10-06 17:20:32 [INFO] rompy.core.render : • Output location: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:32 [INFO] rompy.model :
2025-10-06 17:20:32 [INFO] rompy.model : ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2025-10-06 17:20:32 [INFO] rompy.model : ┃ MODEL GENERATION COMPLETE ┃
2025-10-06 17:20:32 [INFO] rompy.model : ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
2025-10-06 17:20:32 [INFO] rompy.model : Model files generated at: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:32 [INFO] rompy.cli : Inputs generated in: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:32 [INFO] rompy.run.docker : Using provided workspace directory: /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism
2025-10-06 17:20:32 [INFO] rompy.run.docker : Using existing Docker image: rompy-14ed396ca30d
2025-10-06 17:20:32 [INFO] rompy.run.docker : Executing: docker run --rm --user root -e OMPI_ALLOW_RUN_AS_ROOT=1 -e OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 -v /home/tdurrant/source/rompy/rompy-meta/repos/rompy-schism/notebooks/schism_demo_config/test_schism:/app/run_id:Z -v ./schism_demo_config/test_schism:/tmp/schism:Z rompy-14ed396ca30d bash -c cd /app/run_id && echo 'Directory contents:' && ls -la && echo 'Executing model...' && bash -c "cd /tmp/schism && mpirun --oversubscribe --allow-run-as-root -n 8 schism_v5.13.0_WWM 4"
2025-10-06 17:20:45 [INFO] rompy.run.docker : Docker stdout:
Directory contents:
total 1548
drwxr-xr-x. 1 1001 1001 418 Oct 6 06:20 .
drwxr-xr-x. 1 root root 12 Oct 6 06:20 ..
-rw-r--r--. 1 1001 1001 250 Oct 6 06:20 README
-rw-r--r--. 1 1001 1001 170035 Oct 6 06:20 albedo.gr3
-rw-r--r--. 1 1001 1001 19632 Oct 6 06:20 bctides.in
drwxr-xr-x. 1 1001 1001 18 Oct 6 06:20 datasets
-rw-r--r--. 1 1001 1001 170036 Oct 6 06:20 diffmax.gr3
-rw-r--r--. 1 1001 1001 170036 Oct 6 06:20 diffmin.gr3
-rw-r--r--. 1 1001 1001 170033 Oct 6 06:20 drag.gr3
-rw-r--r--. 1 1001 1001 2624 Oct 6 06:20 elev2D.th.nc
-rw-r--r--. 1 1001 1001 225576 Oct 6 06:20 hgrid.gr3
lrwxrwxrwx. 1 1001 1001 9 Oct 6 06:20 hgrid.ll -> hgrid.gr3
lrwxrwxrwx. 1 1001 1001 9 Oct 6 06:20 hgrid_WWM.gr3 -> hgrid.gr3
drwxr-xr-x. 1 1001 1001 18 Oct 6 06:20 outputs
-rw-r--r--. 1 1001 1001 4748 Oct 6 06:20 param.nml
drwxr-xr-x. 1 1001 1001 70 Oct 6 06:20 sflux
-rw-r--r--. 1 1001 1001 27103 Oct 6 06:20 tvd.prop
-rw-r--r--. 1 1001 1001 131 Oct 6 06:20 vgrid.in
-rw-r--r--. 1 1001 1001 170038 Oct 6 06:20 watertype.gr3
-rw-r--r--. 1 1001 1001 71836 Oct 6 06:20 wavedata.nc
-rw-r--r--. 1 1001 1001 170045 Oct 6 06:20 windrot_geo2proj.gr3
-rw-r--r--. 1 1001 1001 163166 Oct 6 06:20 wwmbnd.gr3
-rw-r--r--. 1 1001 1001 4559 Oct 6 06:20 wwminput.nml
Executing model...
0: ABORT: MISC: uv3D.th.nc
2025-10-06 17:20:45 [WARNING] rompy.run.docker : ! Docker stderr:
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI COMMUNICATOR 3 DUP FROM 0
with errorcode 0.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
2025-10-06 17:20:45 [INFO] rompy.run.docker : Model run completed successfully with exit code 0
2025-10-06 17:20:45 [INFO] rompy.cli : ✅ Model completed successfully in 13.66s
✓ CLI execution completed
✓ This demonstrates three equivalent ways to run the same SCHISM simulation:
1. Programmatic: Create objects and call methods (shown earlier)
2. Configuration: Load YAML file and create ModelRun object
3. Command-line: Use 'rompy schism config.yaml' command
Summary¶
This notebook has demonstrated a complete SCHISM modeling workflow using the rompy-schism package. Here's what we accomplished:
Key Components Configured:¶
- Computational Grid: Unstructured triangular mesh with bathymetry
- Atmospheric Forcing: ERA5 wind data via Sflux format
- Boundary Conditions: Hybrid tidal + ocean forcing using the unified system
- Wave Forcing: Spectral wave data for wave-current coupling
- Model Execution: Docker-based containerized simulation
Workflow Approaches Demonstrated:¶
- Procedural: Step-by-step object creation and configuration
- Configuration-based: YAML file-driven model setup
- Command-line: Direct execution via
rompyCLI
Key Features of the New System:¶
- Unified boundary conditions: Single interface for all boundary types
- Factory functions: Simplified configuration for common scenarios
- Flexible backends: Docker, local, and HPC execution options
- Comprehensive validation: Automatic parameter checking and error reporting
Next Steps:¶
- Parameter studies: Modify configurations to explore sensitivity
- Extended simulations: Run longer time periods with different forcing
- Advanced analysis: Use output data for derived quantities and statistics
- Operational deployment: Set up automated forecasting workflows
The rompy-schism system provides a powerful, flexible framework for coastal ocean modeling with SCHISM, enabling both research applications and operational oceanography.