Output#
Functions are available to write wavespectra datasets to disk in a number of different
file types. Output functions are defined in modules within the wavespectra.output
subpackage, for example, wavespectra.output.swan.to_swan. They are accessed
as methods in the SpecDataset accessor, for instance:
In [1]: dset.spec.to_octopus("_static/octopusfile.oct")
In [2]: !head -n 20 _static/octopusfile.oct
Forecast valid for 01-Dec-2014 00:00:00
nfreqs,25
ndir,24
nrecs,9
Latitude,19.950001
Longitude,92.099998
Depth,106.59
CCYYMM,DDHHmm,LPoint,WD,WS,ETot,TZ,VMD,ETotSe,TZSe,VMDSe,ETotSw,TZSw,VMDSw,Mo1,Mo2,HSig,DomDr,AngSpr,Tau
201412,'010000,spec_20141201_00z,25,5.10,0.1426,7.86,205.8,0.0432,4.42,207.7,0.1050,11.03,204.0,0.00440,0.00078,0.7552,209,40,0
freq,0.0411800,0.0452980,0.0498278,0.0548106,0.0602916,0.0663208,0.0729529,0.0802482,0.0882730,0.0971003,0.1068103,0.1174914,0.1292405,0.1421645,0.1563810,0.1720191,0.1892210,0.2081431,0.2289574,0.2518532,0.2770385,0.3047423,0.3352166,0.3687383,0.4056121,anspec
0,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000002,0.0000026,0.0000109,0.0000369,0.0000839,0.0001605,0.0001651,0.0000985,0.0000640,0.0006226,
15,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000001,0.0000018,0.0000056,0.0000060,0.0000025,0.0000051,0.0000198,0.0000840,0.0000546,0.0001795,
30,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000003,0.0000009,0.0000008,0.0000005,0.0000005,0.0000009,0.0000578,0.0000376,0.0000992,
45,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000001,0.0000002,0.0000002,0.0000002,0.0000205,0.0000134,0.0000346,
60,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000001,0.0000001,0.0000001,0.0000143,0.0000093,0.0000238,
75,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000088,0.0000057,0.0000146,
90,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000038,0.0000025,0.0000063,
105,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000006,0.0000004,0.0000010,
120,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,0.0000000,
The following conventions are expected for defining output functions:
Output functions must be defined in modules within the wavespectra.output subpackage.
Modules should be named as filetype.py, e.g.,
swan.py.Functions should be named as to_`filetype`, e.g.,
to_swan.Function must accept
selfas the first input argument so they can be plugged in as methods in theSpecDatasetaccessor class.
Available writers#
These output functions are currently available as methods of SpecDataset:
Write spectra in Funwave format. |
|
Write spectra in json format. |
|
Write spectra in netCDF format using wavespectra conventions. |
|
Save spectra in Octopus format. |
|
Writes the spectrum to an Orcaflex model |
|
Write spectra in SWAN ASCII format. |
|
Save spectra in native WW3 netCDF format. |