rompy.swan.subcomponents.boundary.SEGMENT#
- pydantic model rompy.swan.subcomponents.boundary.SEGMENT[source]#
Boundary over a segment defined from points.
SEGMENT XY < [x] [y] > SEGMENT IJ < [i] [j] >
The segment is defined either by means of a series of points in terms of problem coordinates (XY) or by means of a series of points in terms of grid indices (IJ). The points do not have to include all or coincide with actual grid points.
Examples
In [259]: from rompy.swan.subcomponents.boundary import SEGMENT In [260]: seg = SEGMENT( .....: points=dict( .....: model_type="xy", .....: x=[172, 172, 172, 172.5, 173], .....: y=[-41, -40.5, -40, -40, -40], .....: fmt="0.2f", .....: ), .....: ) .....: In [261]: print(seg.render()) SEGMENT XY 172.00 -41.00 172.00 -40.50 172.00 -40.00 172.50 -40.00 173.00 -40.00 In [262]: seg = SEGMENT( .....: points=dict( .....: model_type="ij", .....: i=[0, 0, 5], .....: j=[0, 19, 19], .....: ), .....: ) .....: In [263]: print(seg.render()) SEGMENT IJ i=0 j=0 i=0 j=19 i=5 j=19
Show JSON schema
{ "title": "SEGMENT", "description": "Boundary over a segment defined from points.\n\n.. code-block:: text\n\n SEGMENT XY < [x] [y] >\n SEGMENT IJ < [i] [j] >\n\nThe segment is defined either by means of a series of points in terms of problem\ncoordinates (`XY`) or by means of a series of points in terms of grid indices\n(`IJ`). The points do not have to include all or coincide with actual grid points.\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.boundary import SEGMENT\n seg = SEGMENT(\n points=dict(\n model_type=\"xy\",\n x=[172, 172, 172, 172.5, 173],\n y=[-41, -40.5, -40, -40, -40],\n fmt=\"0.2f\",\n ),\n )\n print(seg.render())\n seg = SEGMENT(\n points=dict(\n model_type=\"ij\",\n i=[0, 0, 5],\n j=[0, 19, 19],\n ),\n )\n print(seg.render())", "type": "object", "properties": { "model_type": { "default": "segment", "description": "Model type discriminator", "enum": [ "segment", "SEGMENT" ], "title": "Model Type", "type": "string" }, "points": { "description": "Points to define the segment", "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" } }, "$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:
- field model_type: Literal['segment', 'SEGMENT'] = 'segment'#
Model type discriminator