rompy.swan.components.output.TEST#

pydantic model rompy.swan.components.output.TEST[source]#

Write intermediate results.

TEST [itest] [itrace] POINTS XY|IJ (PAR 'fname') (S1D 'fname') (S2D 'fname')

Note

The 6 source terms written due to the presence of the keyword S1D or S2D are: wind input, whitecapping, bottom friction, breaking, 3- and 4- wave interactions.

Examples

In [1]: from rompy.swan.components.output import TEST

In [2]: test = TEST(
   ...:     itest=10,
   ...:     points=dict(model_type="ij", i=[0, 0], j=[10, 20]),
   ...:     fname_par="integral_parameters.test",
   ...:     fname_s1d="1d_variance_density.test",
   ...:     fname_s2d="2d_variance_density.test",
   ...: )
   ...: 

In [3]: print(test.render())
TEST itest=10 POINTS IJ &
    i=0 j=10 &
    i=0 j=20 &
    PAR fname='integral_parameters.test' S1D fname='1d_variance_density.test' S2D fname='2d_variance_density.test'

In [4]: import numpy as np

In [5]: test = TEST(
   ...:     points=dict(
   ...:         model_type="xy",
   ...:         x=np.linspace(172.5, 174.0, 25),
   ...:         y=25*[-38],
   ...:     ),
   ...:     fname_s2d="2d_variance_density.test",
   ...: )
   ...: 

In [6]: print(test.render())
TEST POINTS XY &
    172.50000000 -38.00000000 &
    172.56250000 -38.00000000 &
    172.62500000 -38.00000000 &
    172.68750000 -38.00000000 &
    172.75000000 -38.00000000 &
    172.81250000 -38.00000000 &
    172.87500000 -38.00000000 &
    172.93750000 -38.00000000 &
    173.00000000 -38.00000000 &
    173.06250000 -38.00000000 &
    173.12500000 -38.00000000 &
    173.18750000 -38.00000000 &
    173.25000000 -38.00000000 &
    173.31250000 -38.00000000 &
    173.37500000 -38.00000000 &
    173.43750000 -38.00000000 &
    173.50000000 -38.00000000 &
    173.56250000 -38.00000000 &
    173.62500000 -38.00000000 &
    173.68750000 -38.00000000 &
    173.75000000 -38.00000000 &
    173.81250000 -38.00000000 &
    173.87500000 -38.00000000 &
    173.93750000 -38.00000000 &
    174.00000000 -38.00000000 &
    S2D fname='2d_variance_density.test'

TODO: Support k in POINTS IJ.

Show JSON schema
{
   "title": "TEST",
   "description": "Write intermediate results.\n\n.. code-block:: text\n\n    TEST [itest] [itrace] POINTS XY|IJ (PAR 'fname') (S1D 'fname') (S2D 'fname')\n\nNote\n----\nThe 6 source terms written due to the presence of the keyword S1D or S2D are: wind\ninput, whitecapping, bottom friction, breaking, 3- and 4- wave interactions.\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.components.output import TEST\n    test = TEST(\n        itest=10,\n        points=dict(model_type=\"ij\", i=[0, 0], j=[10, 20]),\n        fname_par=\"integral_parameters.test\",\n        fname_s1d=\"1d_variance_density.test\",\n        fname_s2d=\"2d_variance_density.test\",\n    )\n    print(test.render())\n    import numpy as np\n    test = TEST(\n        points=dict(\n            model_type=\"xy\",\n            x=np.linspace(172.5, 174.0, 25),\n            y=25*[-38],\n        ),\n        fname_s2d=\"2d_variance_density.test\",\n    )\n    print(test.render())\n\nTODO: Support `k` in POINTS IJ.",
   "type": "object",
   "properties": {
      "model_type": {
         "default": "test",
         "description": "Model type discriminator",
         "enum": [
            "test",
            "TEST"
         ],
         "title": "Model Type",
         "type": "string"
      },
      "itest": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The level of test output, for values under 100 the amount is usually reasonable, for values above 200 it can be very large. Values of up to 50 can be interpreted by the user (SWAN default: 1)",
         "title": "Itest"
      },
      "itrace": {
         "anyOf": [
            {
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "SWAN writes a message (name of subroutine) to the PRINT file at the first `itrace` entries of each subroutine (SWAN default: 0)",
         "title": "Itrace"
      },
      "points": {
         "description": "Points where detailed print output is produced (max of 50 points)",
         "discriminator": {
            "mapping": {
               "IJ": "#/$defs/IJ",
               "XY": "#/$defs/XY",
               "ij": "#/$defs/IJ",
               "xy": "#/$defs/XY"
            },
            "propertyName": "model_type"
         },
         "oneOf": [
            {
               "$ref": "#/$defs/XY"
            },
            {
               "$ref": "#/$defs/IJ"
            }
         ],
         "title": "Points"
      },
      "fname_par": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Name of the file where the integral parameters are written to",
         "title": "Fname Par"
      },
      "fname_s1d": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Name of the file where the 1D variance density and 6 source terms are written to",
         "title": "Fname S1D"
      },
      "fname_s2d": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "Name of the file where the 2D variance density and 6 source terms are written to",
         "title": "Fname S2D"
      }
   },
   "$defs": {
      "IJ": {
         "additionalProperties": false,
         "description": "Points in grid indices coordinates.\n\n.. code-block:: text\n\n    < [x] [y] >\n\nNote\n----\nCoordinates should be given in m when Cartesian coordinates are used or degrees\nwhen Spherical coordinates are used (see command `COORD`).\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.base import IJ\n    points = IJ(i=[0, 0, 5], j=[0, 19, 19])\n    print(points.render())",
         "properties": {
            "model_type": {
               "default": "ij",
               "description": "Model type discriminator",
               "enum": [
                  "ij",
                  "IJ"
               ],
               "title": "Model Type",
               "type": "string"
            },
            "i": {
               "description": "i-index values",
               "items": {
                  "type": "integer"
               },
               "title": "I",
               "type": "array"
            },
            "j": {
               "description": "j-index values",
               "items": {
                  "type": "integer"
               },
               "title": "J",
               "type": "array"
            }
         },
         "required": [
            "i",
            "j"
         ],
         "title": "IJ",
         "type": "object"
      },
      "XY": {
         "additionalProperties": false,
         "description": "Points in problem coordinates.\n\n.. code-block:: text\n\n    < [x] [y] >\n\nNote\n----\nCoordinates should be given in m when Cartesian coordinates are used or degrees\nwhen Spherical coordinates are used (see command `COORD`).\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.base import XY\n    points = XY(\n        x=[172, 172, 172, 172.5, 173],\n        y=[-41, -40.5, -40, -40, -40],\n        fmt=\"0.2f\",\n    )\n    print(points.render())",
         "properties": {
            "model_type": {
               "default": "xy",
               "description": "Model type discriminator",
               "enum": [
                  "xy",
                  "XY"
               ],
               "title": "Model Type",
               "type": "string"
            },
            "x": {
               "description": "Problem x-coordinate values",
               "items": {
                  "type": "number"
               },
               "title": "X",
               "type": "array"
            },
            "y": {
               "description": "Problem y-coordinate values",
               "items": {
                  "type": "number"
               },
               "title": "Y",
               "type": "array"
            },
            "fmt": {
               "default": "0.8f",
               "description": "The format to render floats values",
               "title": "Fmt",
               "type": "string"
            }
         },
         "required": [
            "x",
            "y"
         ],
         "title": "XY",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "points"
   ]
}

Fields:
Validators:
field fname_par: str | None = None#

Name of the file where the integral parameters are written to

Validated by:
field fname_s1d: str | None = None#

Name of the file where the 1D variance density and 6 source terms are written to

Validated by:
field fname_s2d: str | None = None#

Name of the file where the 2D variance density and 6 source terms are written to

Validated by:
field itest: int | None = None#

The level of test output, for values under 100 the amount is usually reasonable, for values above 200 it can be very large. Values of up to 50 can be interpreted by the user (SWAN default: 1)

Validated by:
field itrace: int | None = None#

SWAN writes a message (name of subroutine) to the PRINT file at the first itrace entries of each subroutine (SWAN default: 0)

Validated by:
field model_type: Literal['test', 'TEST'] = 'test'#

Model type discriminator

Validated by:
field points: XY | IJ [Required]#

Points where detailed print output is produced (max of 50 points)

Validated by:
validator at_least_one  »  all fields[source]#

Warns if no test file is being specified.

cmd() str[source]#

Command file string for this component.

validator validate_points  »  points[source]#