Package: rompy
title: "Relocatable Ocean Modelling in PYthon (rompy)"IntroductionRelocatable Ocean Modelling in PYthon (rompy) combines templated cookie-cutter model configuration with variousxarrayextensions to assist in the setup and evaluation of coastal ocean models, and is intended to simplify their configuration, execution and analysis. This repository also includesJupyter notebooksthat provide examples to illustrate the use ofrompycode, create visualisations and provide inline documentation. Currentlyrompyimplements one model class for theSWAN wave modeldeveloped by Delft University of Technology.Jupyter NotebooksJupyter notebooks in the./notebooksdirectory include:catalog_advanced_BOM_WW3.ipynbOpens the includedrompycatalog and demonstrates reading BoM WaveWatch III data. A visualisation example usesgeoviewsto show the location of the WaveWatch III data overlayed on satellite imagery. This notebook also shows how a filter can be used with the catalog to load only a specific wave station.catalog_basic_AODN.ipynbOpens the includedrompycatalog and demonstrates reading the remotely sensed near-real-time SAR dataset from the AODN. It also demonstrates plotting the SAR locations and image timing viarompyvisualisation and shows the data as a timeseries usingxarrayplotting.catalog_basic_CSIRO_SWAN.ipynbOpens the includedrompycatalog and demonstrates reading and visualising the SWAN model outputs stored remotely on CSIRO thredds servers. This notebook provides visualisation of wave height as a spatial surface at a particular time with theholoviewspackage, and as a time series at a particular point. It shows a contour visualisation of spectral characteristics and waves at a point in space and time using thewavespectrapackage.model_swan_example.ipynbShows how the SwanModel class can be used to generate configuration for a SWAN model. It shows the creation of a SwanModel instance from a template and demonstrates the visualisation of the spatial boundaries of the SwanModel derived from the template.rompy-dev_matchup_code.ipynbDevelopment and testing of a function to match SwanModel outputs with observed data collected from a waverider buoy.Intake catalogsYAML files in the./rompy/catalogsdirectory are automatically parsed into a catalog in therompy.catvariable whenrompyis imported. The master catalog (master.yaml) points at the AODN, WA Department of Transport, CSIRO, and BoM datasets via subcatalogs.CSIROThe CSIRO catalog provides access to SWAN data runs for Mandurah and Perth domains, the main catalog links tocsiro.yamlto a catalog hosted on a CSIRO Thredds server.AODNThe AODN catalog provides access to wave buoy, altimetry and remotely sensed SAR wave data.BoMThe BoM catalog provides access to WaveWatch III (wind and waves) forecast data.WA Deptartment of TransportThe WA Deptartment of Transport catalog provides access to raster bathymetry data.Intake DriversCustom intake drivers are in./rompy/intake.py. An intake driver is code for loading data in an intake catalog. For example, built-in intake drivers can be associated with NetCDF, CSV, zarr, and other datasets inintake.yaml.Model WrappersBaseModelBaseModel is a general-purpose abstract model wrapper class. BaseModel provides a settings dictionary which is a general-purpose key value store that is used to replace values in the corresponding cookiecutter template.SwanModelSwanModel is a subclass of BaseModel and is a wrapper around a configuration of a SWAN model. SWAN model configurations are a set of files and directories expected by the externally developed SWAN model for it to correctly run and produce output. Therefore, SwanModel provides an interface between python code and the bespoke SWAN model configuration.BaseGridBaseGrid stores information about a geographic grid. The grid may be structured or unstructured. A list of $x$ and $y$ values can be set to define the grid points. From $x$ and $y$ values a bounding box can be accessed through thebboxfunction and ashapelyboundary shape generated through theboundaryfunction. Theboundary_pointsfunction provides a list of boundary points as coordinates and aplotfunction usesmatplotlibto plot the grid boundary over a coastline.SwanGridSwanGrid extends BaseGrid and can be parameterized to provide specific grid types for SWAN. A helper functionnearby_spectraaccepts a spectral file inwavespectraxarrayformat and selects spectral points close to the grid boundary.