rompy.swan.subcomponents.spectrum.SHAPESPEC#

pydantic model rompy.swan.subcomponents.spectrum.SHAPESPEC[source]#

Spectral shape specification.

BOUND SHAPESPEC JONSWAP|PM|GAUSS|BIN|TMA PEAK|MEAN DSPR [POWER|DEGREES]

This command BOUND SHAPESPEC defines the shape of the spectra (both in frequency and direction) at the boundary of the computational grid in case of parametric spectral input.

Notes

While technically a component BOUND SHAPESPEC, this is only intended to be used as a subcomponent of the BOUNDSPEC component.

Examples

In [115]: from rompy.swan.subcomponents.spectrum import SHAPESPEC

In [116]: shapespec = SHAPESPEC()

In [117]: print(shapespec.render())
BOUND SHAPESPEC JONSWAP gamma=3.3 PEAK DSPR POWER

In [118]: shapespec = SHAPESPEC(
   .....:     shape=dict(model_type="tma", gamma=3.1, d=12),
   .....:     per_type="mean",
   .....:     dspr_type="degrees",
   .....: )
   .....: 

In [119]: print(shapespec.render())
BOUND SHAPESPEC TMA gamma=3.1 d=12.0 MEAN DSPR DEGREES

Show JSON schema
{
   "title": "SHAPESPEC",
   "description": "Spectral shape specification.\n\n.. code-block:: text\n\n    BOUND SHAPESPEC JONSWAP|PM|GAUSS|BIN|TMA PEAK|MEAN DSPR [POWER|DEGREES]\n\nThis command BOUND SHAPESPEC defines the shape of the spectra (both in frequency\nand direction) at the boundary of the computational grid in case of parametric\nspectral input.\n\nNotes\n-----\nWhile technically a component `BOUND SHAPESPEC`, this is only intended to be used\nas a subcomponent of the `BOUNDSPEC` component.\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.spectrum import SHAPESPEC\n    shapespec = SHAPESPEC()\n    print(shapespec.render())\n    shapespec = SHAPESPEC(\n        shape=dict(model_type=\"tma\", gamma=3.1, d=12),\n        per_type=\"mean\",\n        dspr_type=\"degrees\",\n    )\n    print(shapespec.render())",
   "type": "object",
   "properties": {
      "model_type": {
         "default": "shapespec",
         "description": "Model type discriminator",
         "enum": [
            "shapespec",
            "SHAPESPEC"
         ],
         "title": "Model Type",
         "type": "string"
      },
      "shape": {
         "anyOf": [
            {
               "$ref": "#/$defs/JONSWAP"
            },
            {
               "$ref": "#/$defs/PM"
            },
            {
               "$ref": "#/$defs/GAUSS"
            },
            {
               "$ref": "#/$defs/BIN"
            },
            {
               "$ref": "#/$defs/TMA"
            }
         ],
         "description": "The spectral shape",
         "title": "Shape"
      },
      "per_type": {
         "default": "peak",
         "description": "The type of characteristic wave period",
         "enum": [
            "peak",
            "mean"
         ],
         "title": "Per Type",
         "type": "string"
      },
      "dspr_type": {
         "default": "power",
         "description": "The type of directional spreading",
         "enum": [
            "power",
            "degrees"
         ],
         "title": "Dspr Type",
         "type": "string"
      }
   },
   "$defs": {
      "BIN": {
         "additionalProperties": false,
         "description": "Single frequency bin spectral shape.\n\n.. code-block:: text\n\n    BIN\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.spectrum import BIN\n    shape = BIN()\n    print(shape.render())",
         "properties": {
            "model_type": {
               "default": "bin",
               "description": "Model type discriminator",
               "enum": [
                  "bin",
                  "BIN"
               ],
               "title": "Model Type",
               "type": "string"
            }
         },
         "title": "BIN",
         "type": "object"
      },
      "GAUSS": {
         "additionalProperties": false,
         "description": "Gaussian spectral shape.\n\n.. code-block:: text\n\n    GAUSS [sigfr]\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.spectrum import GAUSS\n    shape = GAUSS(sigfr=0.02)\n    print(shape.render())",
         "properties": {
            "model_type": {
               "default": "gauss",
               "description": "Model type discriminator",
               "enum": [
                  "gauss",
                  "GAUSS"
               ],
               "title": "Model Type",
               "type": "string"
            },
            "sigfr": {
               "description": "Width of the Gaussian frequency spectrum expressed as a standard deviation in Hz.",
               "exclusiveMinimum": 0.0,
               "title": "Sigfr",
               "type": "number"
            }
         },
         "required": [
            "sigfr"
         ],
         "title": "GAUSS",
         "type": "object"
      },
      "JONSWAP": {
         "additionalProperties": false,
         "description": "Jonswap spectral shape.\n\n.. code-block:: text\n\n    JONSWAP [gamma]\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.spectrum import JONSWAP\n    shape = JONSWAP(gamma=3.3)\n    print(shape.render())",
         "properties": {
            "model_type": {
               "default": "jonswap",
               "description": "Model type discriminator",
               "enum": [
                  "jonswap",
                  "JONSWAP"
               ],
               "title": "Model Type",
               "type": "string"
            },
            "gamma": {
               "default": 3.3,
               "description": "Peak enhancement parameter of the JONSWAP spectrum.",
               "exclusiveMinimum": 0.0,
               "title": "Gamma",
               "type": "number"
            }
         },
         "title": "JONSWAP",
         "type": "object"
      },
      "PM": {
         "additionalProperties": false,
         "description": "Pearson-Moskowitz spectral shape.\n\n.. code-block:: text\n\n    PM\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.spectrum import PM\n    shape = PM()\n    print(shape.render())",
         "properties": {
            "model_type": {
               "default": "pm",
               "description": "Model type discriminator",
               "enum": [
                  "pm",
                  "PM"
               ],
               "title": "Model Type",
               "type": "string"
            }
         },
         "title": "PM",
         "type": "object"
      },
      "TMA": {
         "additionalProperties": false,
         "description": "TMA spectral shape.\n\n.. code-block:: text\n\n    TMA [gamma] [d]\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.spectrum import TMA\n    shape = TMA(gamma=2.0, d=18)\n    print(shape.render())",
         "properties": {
            "model_type": {
               "default": "tma",
               "description": "Model type discriminator",
               "enum": [
                  "tma",
                  "TMA"
               ],
               "title": "Model Type",
               "type": "string"
            },
            "gamma": {
               "default": 3.3,
               "description": "Peak enhancement parameter of the JONSWAP spectrum.",
               "exclusiveMinimum": 0.0,
               "title": "Gamma",
               "type": "number"
            },
            "d": {
               "description": "The reference depth at the wave maker in meters.",
               "exclusiveMinimum": 0.0,
               "title": "D",
               "type": "number"
            }
         },
         "required": [
            "d"
         ],
         "title": "TMA",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Fields:
field dspr_type: Literal['power', 'degrees'] = 'power'#

The type of directional spreading

field model_type: Literal['shapespec', 'SHAPESPEC'] = 'shapespec'#

Model type discriminator

field per_type: Literal['peak', 'mean'] = 'peak'#

The type of characteristic wave period

field shape: JONSWAP | PM | GAUSS | BIN | TMA [Optional]#

The spectral shape

cmd() str[source]#