rompy.swan.components.output.NGRID#

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

Output locations for a nested grid.

NGRID 'sname' [xpn] [ypn] [alpn] [xlenn] [ylenn] [mxn] [myn]

If the user wishes to carry out nested SWAN runs, a separate coarse-grid SWAN run is required. With this optional command NGRID, the user defines in the present coarse-grid run, a set of output locations along the boundary of the subsequent nested computational grid. The set of output locations thus defined is of the type NGRID.

Note

Command NESTOUT is required after this command NGRID to generate some data for the (subsequent) nested run.

Note

Cannot be used in 1D-mode.

Examples

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

In [2]: loc = NGRID(
   ...:     sname="outnest",
   ...:     grid=dict(xp=173, yp=-40, xlen=2, ylen=2, mx=19, my=19),
   ...: )
   ...: 

In [3]: print(loc.render())
NGRID sname='outnest' xpn=173.0 ypn=-40.0 alpn=0.0 xlenn=2.0 ylenn=2.0 mxn=19 myn=19

Show JSON schema
{
   "title": "NGRID",
   "description": "Output locations for a nested grid.\n\n.. code-block:: text\n\n    NGRID 'sname' [xpn] [ypn] [alpn] [xlenn] [ylenn] [mxn] [myn]\n\nIf the user wishes to carry out nested SWAN runs, a separate coarse-grid SWAN run\nis required. With this optional command `NGRID`, the user defines in the present\ncoarse-grid run, a set of output locations along the boundary of the subsequent\nnested computational grid. The set of output locations thus defined is of the type\nNGRID.\n\nNote\n----\nCommand `NESTOUT` is required after this command `NGRID` to generate some data for\nthe (subsequent) nested run.\n\nNote\n----\nCannot be used in 1D-mode.\n\nExamples\n--------\n\n.. ipython:: python\n    :okwarning:\n\n    from rompy.swan.components.output import NGRID\n    loc = NGRID(\n        sname=\"outnest\",\n        grid=dict(xp=173, yp=-40, xlen=2, ylen=2, mx=19, my=19),\n    )\n    print(loc.render())",
   "type": "object",
   "properties": {
      "model_type": {
         "default": "ngrid",
         "description": "Model type discriminator",
         "enum": [
            "ngrid",
            "NGRID"
         ],
         "title": "Model Type",
         "type": "string"
      },
      "sname": {
         "description": "Name of the set of output locations defined by this command",
         "maxLength": 8,
         "title": "Sname",
         "type": "string"
      },
      "grid": {
         "$ref": "#/$defs/GRIDREGULAR",
         "description": "NGRID grid definition"
      }
   },
   "$defs": {
      "GRIDREGULAR": {
         "additionalProperties": false,
         "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())",
         "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"
            }
         },
         "required": [
            "xp",
            "yp",
            "xlen",
            "ylen",
            "mx",
            "my"
         ],
         "title": "GRIDREGULAR",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "sname",
      "grid"
   ]
}

Fields:
Validators:
field grid: GRIDREGULAR [Required]#

NGRID grid definition

Validated by:
field model_type: Literal['ngrid', 'NGRID'] = 'ngrid'#

Model type discriminator

cmd() str[source]#

Command file string for this component.

validator grid_suffix  »  grid[source]#