rompy.swan.components.cgrid.CURVILINEAR#
- pydantic model rompy.swan.components.cgrid.CURVILINEAR[source]#
SWAN curvilinear computational grid.
CGRID CURVILINEAR [mxc] [myc] (EXCEPTION [xexc] [yexc]) ->CIRCLE|SECTOR [mdc] [flow] [fhigh] [msc] READGRID COORDINATES [fac] 'fname' [idla] [nhedf] [nhedvec] & FREE|FORMAT ('form'|[idfm])
This is a group component that includes a CGRID and a READGRID component.
Examples
In [21]: from rompy.swan.components.cgrid import CURVILINEAR In [22]: cgrid = CURVILINEAR( ....: mxc=199, ....: myc=199, ....: readcoord=dict(fname="./coords.txt"), ....: spectrum=dict(mdc=36, flow=0.04, fhigh=1.0), ....: ) ....: In [23]: print(cgrid.render()) CGRID CURVILINEAR mxc=199 myc=199 CIRCLE mdc=36 flow=0.04 fhigh=1.0 READGRID COORDINATES fac=1.0 fname='./coords.txt' idla=1 nhedf=0 nhedvec=0 FREE
Show JSON schema
{ "title": "CURVILINEAR", "description": "SWAN curvilinear computational grid.\n\n.. code-block:: text\n\n CGRID CURVILINEAR [mxc] [myc] (EXCEPTION [xexc] [yexc])\n ->CIRCLE|SECTOR [mdc] [flow] [fhigh] [msc]\n READGRID COORDINATES [fac] 'fname' [idla] [nhedf] [nhedvec] &\n FREE|FORMAT ('form'|[idfm])\n\nThis is a group component that includes a `CGRID` and a `READGRID` component.\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.components.cgrid import CURVILINEAR\n cgrid = CURVILINEAR(\n mxc=199,\n myc=199,\n readcoord=dict(fname=\"./coords.txt\"),\n spectrum=dict(mdc=36, flow=0.04, fhigh=1.0),\n )\n print(cgrid.render())", "type": "object", "properties": { "model_type": { "default": "curvilinear", "description": "Model type discriminator", "enum": [ "curvilinear", "CURVILINEAR" ], "title": "Model Type", "type": "string" }, "spectrum": { "$ref": "#/$defs/SPECTRUM", "description": "Spectrum subcomponent" }, "mxc": { "description": "Number of meshes in computational grid in \u03be-direction (this number is one less than the number of grid points in this domain).", "title": "Mxc", "type": "integer" }, "myc": { "description": "Number of meshes in computational grid in \u03b7-direction (this number is one less than the number of grid points in this domain).", "title": "Myc", "type": "integer" }, "xexc": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "the value which the user uses to indicate that a grid point is to be ignored in the computations (this value is provided by the user at the location of the x-coordinate considered in the file of the x-coordinates, see command READGRID COOR).", "title": "Xexc" }, "yexc": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "the value which the user uses to indicate that a grid point is to be ignored in the computations (this value is provided by the user at the location of the y-coordinate considered in the file of the y-coordinates, see command READGRID COOR).", "title": "Yexc" }, "readcoord": { "$ref": "#/$defs/READCOORD", "description": "Grid coordinates reader." } }, "$defs": { "IDLA": { "description": "Order of values in the input files.\n\nAttributes\n----------\nONE: 1\n SWAN reads the map from left to right starting in the upper-left-hand corner of\n the map. A new line in the map should start on a new line in the file.\nTWO: 2\n As `1` but a new line in the map need not start on a new line in the file.\nTHREE: 3\n SWAN reads the map from left to right starting in the lower-left-hand corner of\n the map. A new line in the map should start on a new line in the file.\nFOUR: 4\n As `3` but a new line in the map need not start on a new line in the file.\nFIVE: 5\n SWAN reads the map from top to bottom starting in the lower-left-hand corner of\n the map. A new column in the map should start on a new line in the file.\nSIX: 6\n As `5` but a new column in the map need not start on a new line in the file.\n\nNotes\n-----\nIt is assumed that the x-axis of the grid is pointing to the right and the y-axis\nupwards.", "enum": [ 1, 2, 3, 4, 5, 6 ], "title": "IDLA", "type": "integer" }, "READCOORD": { "additionalProperties": false, "description": "SWAN coordinates reader.\n\n.. code-block:: text\n\n READGRID COORDINATES [fac] 'fname' [idla] [nhedf] [nhedvec] &\n FREE|FORMAT ('form'|idfm)\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.readgrid import READCOORD\n readcoord = READCOORD(\n fac=1.0,\n fname=\"coords.txt\",\n idla=3,\n format=\"free\",\n )\n print(readcoord.render())", "properties": { "model_type": { "default": "readcoord", "description": "Model type discriminator", "enum": [ "readcoord", "READCOORD" ], "title": "Model Type", "type": "string" }, "grid_type": { "const": "coordinates", "default": "coordinates", "description": "Type of the SWAN grid file", "title": "Grid Type", "type": "string" }, "fac": { "default": 1.0, "description": "SWAN multiplies all values that are read from file by `fac`. For instance if the values are given in unit decimeter, one should make `fac=0.1` to obtain values in m. To change sign use a negative `fac`", "exclusiveMinimum": 0.0, "title": "Fac", "type": "number" }, "idla": { "$ref": "#/$defs/IDLA", "default": 1, "description": "Prescribes the order in which the values of bottom levels and other fields should be given in the file" }, "nhedf": { "default": 0, "description": "The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than `nhedf` because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see `nhedt` and `nhedvec`)", "minimum": 0, "title": "Nhedf", "type": "integer" }, "nhedvec": { "default": 0, "description": "For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)", "minimum": 0, "title": "Nhedvec", "type": "integer" }, "format": { "default": "free", "description": "File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)", "enum": [ "free", "fixed", "unformatted" ], "title": "Format", "type": "string" }, "form": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if `format='fixed'`, do not use it if `idfm` is specified", "title": "Form" }, "idfm": { "anyOf": [ { "enum": [ 1, 5, 6, 8 ], "type": "integer" }, { "type": "null" } ], "default": null, "description": "File format identifier, only used if `format='fixed'`", "title": "Idfm" }, "fname": { "description": "Name of the SWAN coordinates file", "title": "Fname", "type": "string" } }, "required": [ "fname" ], "title": "READCOORD", "type": "object" }, "SPECTRUM": { "additionalProperties": false, "description": "SWAN spectrum specification.\n\n.. code-block:: text\n\n ->CIRCLE|SECTOR ([dir1] [dir2]) [mdc] [flow] [fhigh] [msc]\n\nNotes\n-----\n\nDirections in the spectra are defined either as a CIRCLE or as a SECTOR. In the\ncase of a SECTOR, both `dir1` and `dir2` must be specified. In the case of a\nCIRCLE, neither `dir1` nor `dir2` should be specified.\n\nAt least two of `flow`, `fhigh` and `msc` must be specified in which case the\nthird parameter will be calculated by SWAN such that the frequency resolution\n`df/f = 0.1` (10% increments).\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.spectrum import SPECTRUM\n spec = SPECTRUM(mdc=36, flow=0.04, fhigh=1.0)\n print(spec.render())\n spec = SPECTRUM(mdc=36, dir1=0, dir2=180, flow=0.04, msc=31)\n print(spec.render())", "properties": { "model_type": { "default": "spectrum", "description": "Model type discriminator", "enum": [ "spectrum", "SPECTRUM" ], "title": "Model Type", "type": "string" }, "mdc": { "description": "Number of meshes in theta-space. In the case of CIRCLE, this is the number of subdivisions of the 360 degrees of a circle so `dtheta = [360]/[mdc]` is the spectral directional resolution. In the case of SECTOR, `dtheta = ([dir2] - [dir1])/[mdc]`. The minimum number of directional bins is 3 per directional quadrant.", "title": "Mdc", "type": "integer" }, "flow": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Lowest discrete frequency that is used in the calculation (in Hz).", "title": "Flow" }, "fhigh": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Highest discrete frequency that is used in the calculation (in Hz).", "title": "Fhigh" }, "msc": { "anyOf": [ { "minimum": 3, "type": "integer" }, { "type": "null" } ], "default": null, "description": "One less than the number of frequencies. This defines the grid resolution in frequency-space between the lowest discrete frequency `flow` and the highest discrete frequency `fhigh`. This resolution is not constant, since the frequencies are distributed logarithmical: `fi+1 = yfi` where `y` is a constant. The minimum number of frequencies is 4", "title": "Msc" }, "dir1": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "The direction of the right-hand boundary of the sector when looking outward from the sector (required for option SECTOR) in degrees.", "title": "Dir1" }, "dir2": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "The direction of the left-hand boundary of the sector when looking outward from the sector (required for option SECTOR) in degrees.", "title": "Dir2" } }, "required": [ "mdc" ], "title": "SPECTRUM", "type": "object" } }, "additionalProperties": false, "required": [ "spectrum", "mxc", "myc", "readcoord" ] }
- Fields:
- Validators:
xexc_and_yexc_or_neither
»all fields
- field model_type: Literal['curvilinear', 'CURVILINEAR'] = 'curvilinear'#
Model type discriminator
- Validated by:
- field mxc: int [Required]#
Number of meshes in computational grid in ξ-direction (this number is one less than the number of grid points in this domain).
- Validated by:
- field myc: int [Required]#
Number of meshes in computational grid in η-direction (this number is one less than the number of grid points in this domain).
- Validated by:
- field xexc: float | None = None#
the value which the user uses to indicate that a grid point is to be ignored in the computations (this value is provided by the user at the location of the x-coordinate considered in the file of the x-coordinates, see command READGRID COOR).
- Validated by:
- field yexc: float | None = None#
the value which the user uses to indicate that a grid point is to be ignored in the computations (this value is provided by the user at the location of the y-coordinate considered in the file of the y-coordinates, see command READGRID COOR).
- Validated by:
- property exception#
- property format_repr#