rompy.swan.subcomponents.readgrid.GRIDREGULAR#

pydantic model rompy.swan.subcomponents.readgrid.GRIDREGULAR[source]#

SWAN Regular Grid subcomponent.

xp yp alp xlen ylen mx my

Note

The direction of the x-axis alp must be 0 in case of spherical coordinates

Note

All coordinates and distances should be given in m when Cartesian coordinates are used or degrees when Spherical coordinates are used (see command COORD).

Examples

In [91]: from rompy.swan.subcomponents.readgrid import GRIDREGULAR

In [92]: kwargs = dict(xp=173, yp=-40, alp=0, xlen=2, ylen=2, mx=199, my=199)

In [93]: grid = GRIDREGULAR(suffix="c", **kwargs)

In [94]: print(grid.render())
xpc=173.0 ypc=-40.0 alpc=0.0 xlenc=2.0 ylenc=2.0 mxc=199 myc=199

In [95]: grid = GRIDREGULAR(suffix="inp", **kwargs)

In [96]: print(grid.render())
xpinp=173.0 ypinp=-40.0 alpinp=0.0 xleninp=2.0 yleninp=2.0 mxinp=199 myinp=199

Show JSON schema
{
   "title": "GRIDREGULAR",
   "description": "SWAN Regular Grid subcomponent.\n\n.. code-block:: text\n\n    xp yp alp xlen ylen mx my\n\nNote\n----\nThe direction of the x-axis `alp` must be 0 in case of spherical coordinates\n\nNote\n----\nAll coordinates and distances should be given in m when Cartesian coordinates are\nused or degrees when Spherical coordinates are used (see command COORD).\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.subcomponents.readgrid import GRIDREGULAR\n    kwargs = dict(xp=173, yp=-40, alp=0, xlen=2, ylen=2, mx=199, my=199)\n    grid = GRIDREGULAR(suffix=\"c\", **kwargs)\n    print(grid.render())\n    grid = GRIDREGULAR(suffix=\"inp\", **kwargs)\n    print(grid.render())",
   "type": "object",
   "properties": {
      "model_type": {
         "default": "gridregular",
         "description": "Model type discriminator",
         "enum": [
            "gridregular",
            "GRIDREGULAR"
         ],
         "title": "Model Type",
         "type": "string"
      },
      "xp": {
         "description": "The x-coordinate of the origin in problem coordinates",
         "title": "Xp",
         "type": "number"
      },
      "yp": {
         "description": "The y-coordinate of the origin in problem coordinates",
         "title": "Yp",
         "type": "number"
      },
      "alp": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": 0.0,
         "description": "Direction of the xaxis in degrees",
         "title": "Alp"
      },
      "xlen": {
         "description": "Length of the computational grid in the x-direction",
         "title": "Xlen",
         "type": "number"
      },
      "ylen": {
         "description": "Length of the computational grid in the y-direction",
         "title": "Ylen",
         "type": "number"
      },
      "mx": {
         "description": "Number of meshes in computational grid in x-direction (this number is one less than the number of grid points in this domain)",
         "title": "Mx",
         "type": "integer"
      },
      "my": {
         "description": "Number of meshes in computational grid in y-direction (this number is one less than the number of grid points in this domain)",
         "title": "My",
         "type": "integer"
      },
      "suffix": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": "",
         "description": "Suffix for rendering with each output grid parameter.",
         "title": "Suffix"
      }
   },
   "additionalProperties": false,
   "required": [
      "xp",
      "yp",
      "xlen",
      "ylen",
      "mx",
      "my"
   ]
}

Fields:
field alp: float | None = 0.0#

Direction of the xaxis in degrees

field model_type: Literal['gridregular', 'GRIDREGULAR'] = 'gridregular'#

Model type discriminator

field mx: int [Required]#

Number of meshes in computational grid in x-direction (this number is one less than the number of grid points in this domain)

field my: int [Required]#

Number of meshes in computational grid in y-direction (this number is one less than the number of grid points in this domain)

field suffix: str | None = ''#

Suffix for rendering with each output grid parameter.

field xlen: float [Required]#

Length of the computational grid in the x-direction

field xp: float [Required]#

The x-coordinate of the origin in problem coordinates

field ylen: float [Required]#

Length of the computational grid in the y-direction

field yp: float [Required]#

The y-coordinate of the origin in problem coordinates

cmd() str[source]#

Command file string for this subcomponent.

property dx#

Grid spacing in x-direction.

property dy#

Grid spacing in y-direction.