rompy.swan.components.output.TABLE#
- pydantic model rompy.swan.components.output.TABLE[source]#
Write spatial distributions.
TABLE 'sname' ->HEADER|NOHEADER|INDEXED 'fname' < output > & (OUTPUT [tbegblk] [deltblk]) SEC|MIN|HR|DAY
With this optional command the user indicates that for each location of the output location set ‘sname’ (see commands POINTS, CURVE, FRAME or GROUP) one or more variables should be written to a file. The keywords HEADER and NOHEADER determine the appearance of the table; the filename determines the destination of the data.
Note
HEADER: output is written in fixed format to file with headers giving name of variable and unit per column (numbers too large to be written will be shown as ****. The number of header lines is 4.
NOHEADER: output is written in floating point format to file and has no headers.
INDEXED: output compatible with GIS tools such as ARCVIEW, ARCINFO, etc. The user should give two TABLE commands, one to produce one file with XP and YP as output quantities, the other with HS, RTM01 or other output quantities.
Examples
In [1]: from rompy.swan.components.output import TABLE In [2]: table = TABLE( ...: sname="outpts", ...: format="noheader", ...: fname="./output_table.nc", ...: output=["hsign", "hswell", "dir", "tps", "tm01", "watlev", "qp"], ...: times=dict(tbeg="2012-01-01T00:00:00", delt="PT30M", dfmt="min"), ...: ) ...: In [3]: print(table.render()) TABLE sname='outpts' NOHEADER fname='./output_table.nc' & HSIGN & HSWELL & DIR & TPS & TM01 & WATLEV & QP & OUTPUT tbegtbl=20120101.000000 delttbl=30.0 MIN
Show JSON schema
{ "title": "TABLE", "description": "Write spatial distributions.\n\n.. code-block:: text\n\n TABLE 'sname' ->HEADER|NOHEADER|INDEXED 'fname' < output > &\n (OUTPUT [tbegblk] [deltblk]) SEC|MIN|HR|DAY\n\nWith this optional command the user indicates that for each location of the output\nlocation set 'sname' (see commands `POINTS`, `CURVE`, `FRAME` or `GROUP`) one or\nmore variables should be written to a file. The keywords `HEADER` and `NOHEADER`\ndetermine the appearance of the table; the filename determines the destination of\nthe data.\n\nNote\n----\n**HEADER**:\noutput is written in fixed format to file with headers giving name of variable\nand unit per column (numbers too large to be written will be shown as `****`.\nThe number of header lines is 4.\n\n**NOHEADER**:\noutput is written in floating point format to file and has no headers.\n\n**INDEXED**:\noutput compatible with GIS tools such as ARCVIEW, ARCINFO, etc. The user should\ngive two TABLE commands, one to produce one file with `XP` and `YP` as output\nquantities, the other with `HS`, `RTM01` or other output quantities.\n\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.components.output import TABLE\n table = TABLE(\n sname=\"outpts\",\n format=\"noheader\",\n fname=\"./output_table.nc\",\n output=[\"hsign\", \"hswell\", \"dir\", \"tps\", \"tm01\", \"watlev\", \"qp\"],\n times=dict(tbeg=\"2012-01-01T00:00:00\", delt=\"PT30M\", dfmt=\"min\"),\n )\n print(table.render())", "type": "object", "properties": { "model_type": { "default": "table", "description": "Model type discriminator", "enum": [ "table", "TABLE" ], "title": "Model Type", "type": "string" }, "sname": { "description": "Name of the set of output locations in which the output is to be written", "maxLength": 8, "title": "Sname", "type": "string" }, "fname": { "description": "Name of the data file where the output is written to The file format is defined by the file extension, use `.mat` for MATLAB binary (single precision) or `.nc` for netCDF format. If any other extension is used the ASCII format is assumed", "title": "Fname", "type": "string" }, "times": { "anyOf": [ { "$ref": "#/$defs/TimeRangeOpen" }, { "type": "null" } ], "default": null, "description": "Time specification if the user requires output at various times. If this option is not specified data will be written for the last time step of the computation" }, "format": { "anyOf": [ { "enum": [ "header", "noheader", "indexed" ], "type": "string" }, { "type": "null" } ], "default": null, "description": "Indicate if the table should be written to a file as a HEADER, NOHEADER or INDEXED table format (SWAN default: HEADER)", "title": "Format" }, "output": { "description": "The output variables to output to block file", "items": { "$ref": "#/$defs/BlockOptions" }, "minItems": 1, "title": "Output", "type": "array" } }, "$defs": { "BlockOptions": { "description": "Valid options for block output parameters.\n\nAttributes\n----------\nHSIGN: \"hsign\"\n Significant wave height (in m).\nHSWELL: \"hswell\"\n Swell wave height (in m).\nDIR: \"dir\"\n Mean wave direction (in degrees).\nDPM: \"dpm\"\n Mean wave direction at the peak frequency (in degrees).\nPDIR: \"pdir\"\n Peak wave direction (in degrees).\nTDIR: \"tdir\"\n Direction of energy transport (in degrees).\nTM01: \"tm01\"\n Mean absolute wave period (in s).\nRTM01: \"rtm01\"\n Mean relative wave period (in s).\nRTP: \"rtp\"\n Peak period of the (relative frequency) variance density spectrum (in s).\nTPS: \"tps\"\n Smoothed peak period (in s).\nPER: \"per\"\n Mean absolute wave period (in s).\nRPER: \"rper\"\n Mean relative wave period (in s).\nTMM10: \"tmm10\"\n Mean absolute wave period (in s).\nRTMM10: \"rtmm10\"\n Mean relative wave period (in s).\nTM02: \"tm02\"\n Mean absolute zero-crossing period (in s).\nFSPR: \"fspr\"\n The normalised width of the frequency spectrum.\nDSPR: \"dspr\"\n Directional spreading of the waves (in degrees).\nQP: \"qp\"\n Peakedness of the wave spectrum (dimensionless).\nDEPTH: \"depth\"\n Water depth (in m).\nWATLEV: \"watlev\"\n Water level (in m).\nBOTLEV: \"botlev\"\n Bottom level (in m).\nVEL: \"vel\"\n Current velocity (vector; in m/s).\nFRCOEF: \"frcoef\"\n Friction coefficient (equal to `cfw` or `kn` in command `FRICTION`).\nWIND: \"wind\"\n Wind velocity (vector; in m/s).\nAICE: \"aice\"\n Ice concentration (as a fraction from 0 to 1).\nPROPAGAT: \"propagat\"\n Sum of PROPXY, PROPTHETA and PROPSIGMA (in W/m2 or m2/s).\nPROPXY: \"propxy\"\n Energy propagation in geographic space; sum of x- and y-direction\n (in W/m2 or m2/s).\nPROPTHETA: \"proptheta\"\n Energy propagation in theta space (in W/m2 or m2/s).\nPROPSIGMA: \"propsigma\"\n Energy propagation in sigma space (in W/m2 or m2/s).\nGENERAT: \"generat\"\n Total energy generation (in W/m2 or m2/s).\nGENWIND: \"genwind\"\n Energy generation due to wind (in W/m2 or m2/s).\nREDIST: \"redist\"\n Total energy redistribution (in W/m2 or m2/s).\nREDQUAD: \"redquad\"\n Energy redistribution due to quadruplets (in W/m2 or m2/s).\nREDTRIAD: \"redtriad\"\n Energy redistribution due to triads (in W/m2 or m2/s).\nDISSIP: \"dissip\"\n Total energy dissipation (in W/m2 or m2/s).\nDISBOT: \"disbot\"\n Energy dissipation due to bottom friction (in W/m2 or m2/s).\nDISSURF: \"dissurf\"\n Energy dissipation due to surf breaking (in W/m2 or m2/s).\nDISWCAP: \"diswcap\"\n Energy dissipation due to whitecapping (in W/m2 or m2/s).\nDISSWELL: \"disswell\"\n Energy dissipation due to swell dissipation (in W/m2 or m2/s).\nDISVEG: \"disveg\"\n Energy dissipation due to vegetation (in W/m2 or m2/s).\nDISMUD: \"dismud\"\n Energy dissipation due to mud (in W/m2 or m2/s).\nDISICE: \"disice\"\n Energy dissipation due to sea ice (in W/m2 or m2/s).\nRADSTR: \"radstr\"\n Energy transfer between waves and currents due to radiation stress\n (in W/m2 or m2/s).\nQB: \"qb\"\n Fraction of breaking waves due to depth-induced breaking.\nTRANSP: \"transp\"\n Transport of energy (vector; in W/m2 or m2/s).\nFORCE: \"force\"\n Wave-induced force per unit surface area (vector; in N/m2).\nUBOT: \"ubot\"\n The rms-value of the maxima of the orbital velocity near the bottom (in m/s).\nURMS: \"urms\"\n The rms-value of the orbital velocity near the bottom (in m/s).\nTMBOT: \"tmbot\"\n The bottom wave period (in s).\nWLENGTH: \"wlength\"\n Average wave length (in m).\nLWAVP: \"lwavp\"\n Peak wave length (in m).\nSTEEPNESS: \"steepness\"\n Average wave steepness (dimensionless).\nBFI: \"bfi\"\n Benjamin-Feir index (dimensionless).\nNPLANTS: \"nplants\"\n Number of plants per square meter.\nDHSIGN: \"dhsign\"\n Difference in significant wave height from the last two iterations (in m).\nDRTM01: \"drtm01\"\n Difference in average wave period (RTM01) from the last two iterations (in s).\nLEAK: \"leak\"\n Numerical loss of energy equal to `cthetaE(omega,theta)` across boundaries.\nTIME: \"time\"\n Full date-time string as part of line used in TABLE only.\nTSEC: \"tsec\"\n Time in seconds with respect to a reference time (see command QUANTITY).\nXP: \"xp\"\n The x-coordinate in the problem coordinate system of the output location.\nYP: \"yp\"\n The y-coordinate in the problem coordinate system of the output location.\nDIST: \"dist\"\n If output has been requested along a curve then the distance along the curve\n can be obtained with the command TABLE. DIST is the distance along the curve\n measured from teh first point on the curve to the output location on the curve\n in meters (also in the case of spherical coordinates).\nSETUP: \"setup\"\n Set-up due to waves (in m).\nPTHSIGN: \"pthsign\"\n Watershed partitions of the significant wave height (in m).\nPTRTP: \"ptrtp\"\n Watershed partitions of the relative peak period (in s).\nPTWLEN: \"ptwlen\"\n Watershed partitions of the average wave length (in m).\nPTDIR: \"ptdir\"\n Watershed partitions of the peak wave direction (in degrees).\nPTDSPR: \"ptdspr\"\n Watershed partitions of the directional spreading (in degrees).\nPTWFRAC: \"ptwfrac\"\n Watershed partitions of the wind fraction (dimensionless).\nPTSTEEPNE: \"ptsteepne\"\n Watershed partition of the wave steepness (dimensionless).\nPARTITION: \"partition\"\n The raw spectral partition for wave system tracking post-processing.\n\nNote\n----\nEnergy given in W/m2 or m2/s depending on command SET.\n\nNote\n----\nUBOT and URMS required command `FRICTION` to be used. If friction is ignored in the\ncomputation, then one should use the command `FRICTION` with the value of the\nfriction set to zero (e.g., `FRICTION COLLINS 0`).", "enum": [ "hsign", "hswell", "dir", "dpm", "pdir", "tdir", "tm01", "rtm01", "rtp", "tps", "per", "rper", "tmm10", "rtmm10", "tm02", "fspr", "dspr", "qp", "depth", "watlev", "botlev", "vel", "frcoef", "wind", "aice", "propagat", "propxy", "proptheta", "propsigma", "generat", "genwind", "redist", "redquad", "redtriad", "dissip", "disbot", "dissurf", "diswcap", "disswell", "disveg", "dismud", "disice", "radstr", "qb", "transp", "force", "ubot", "urms", "tmbot", "wlength", "lwavp", "steepness", "bfi", "nplants", "dhsign", "drtm01", "leak", "time", "tsec", "xp", "yp", "dist", "setup", "pthsign", "ptrtp", "ptwlen", "ptdir", "ptdspr", "ptwfrac", "ptsteepne", "partition" ], "title": "BlockOptions", "type": "string" }, "TimeRangeOpen": { "additionalProperties": false, "description": "Regular times with an open boundary.\n\n.. code-block:: text\n\n [tbeg] [delt] SEC|MIN|HR|DAY\n\nTime is rendered in one of the following formats:\n\n* 1: ISO-notation 19870530.153000\n* 2: (as in HP compiler) '30-May-87 15:30:00'\n* 3: (as in Lahey compiler) 05/30/87.15:30:00\n* 4: 15:30:00\n* 5: 87/05/30 15:30:00'\n* 6: as in WAM 8705301530\n\nNote\n----\nThe `tbeg` field can be specified as:\n\n* existing datetime object\n* int or float, assumed as Unix time, i.e. seconds (if >= -2e10 or <= 2e10) or\n milliseconds (if < -2e10 or > 2e10) since 1 January 1970.\n* ISO 8601 time string.\n\nNote\n----\nThe `tdelta` field can be specified as:\n\n* existing timedelta object\n* int or float, assumed as seconds\n* ISO 8601 duration string, following formats work:\n\n * `[-][DD ][HH:MM]SS[.ffffff]`\n * `[\u00b1]P[DD]DT[HH]H[MM]M[SS]S` (ISO 8601 format for timedelta)\n\nNote\n----\nDefault values for the time specification fields are provided for the case where\nthe user wants to set times dynamically after instantiating this subcomponent.\n\nExamples\n--------\n\n.. ipython:: python\n :okwarning:\n\n from rompy.swan.subcomponents.time import TimeRangeOpen\n from datetime import datetime, timedelta\n times = TimeRangeOpen(\n tbeg=datetime(1990, 1, 1), delt=timedelta(minutes=30), dfmt=\"min\"\n )\n print(times.render())\n times = TimeRangeOpen(\n tbeg=\"2012-01-01T00:00:00\", delt=\"PT1H\", tfmt=2, dfmt=\"hr\", suffix=\"blk\"\n )\n print(times.render())", "properties": { "model_type": { "default": "open", "description": "Model type discriminator", "enum": [ "open", "OPEN" ], "title": "Model Type", "type": "string" }, "tbeg": { "default": "1970-01-01T00:00:00", "description": "Start time", "format": "date-time", "title": "Tbeg", "type": "string" }, "delt": { "default": "PT1H", "description": "Time interval", "format": "duration", "title": "Delt", "type": "string" }, "tfmt": { "anyOf": [ { "enum": [ 1, 2, 3, 4, 5, 6 ], "type": "integer" }, { "type": "string" } ], "default": 1, "description": "Format to render time specification", "title": "Tfmt" }, "dfmt": { "default": "sec", "description": "Format to render time interval specification", "enum": [ "sec", "min", "hr", "day" ], "title": "Dfmt", "type": "string" }, "suffix": { "default": "", "description": "Suffix to prepend to argument names when rendering", "title": "Suffix", "type": "string" } }, "title": "TimeRangeOpen", "type": "object" } }, "additionalProperties": false, "required": [ "sname", "fname", "output" ] }
- Fields:
- Validators:
- field format: Literal['header', 'noheader', 'indexed'] | None = None#
Indicate if the table should be written to a file as a HEADER, NOHEADER or INDEXED table format (SWAN default: HEADER)
- Validated by:
- field model_type: Literal['table', 'TABLE'] = 'table'#
Model type discriminator
- Validated by:
- field output: list[BlockOptions] [Required]#
The output variables to output to block file
- Constraints:
min_length = 1
- Validated by:
- property suffix: str#