swanvectorvarspvariedgrid#
[swanvectorvariable] = swanvectorvarspvariedgrid(xgrid, ygrid, xpointgrid, ypointgrid, Vxgrid, Vygrid, savedata, outfilename, outfilelocation, CalcMethod)
Description#
Generate SWAN file for spatially varied vector variable from gridded input data
Inputs#
- xgrid
x (longitude) of output grid points as a [M*N] array
- ygrid
y (latitude) of output grid points as a [M*N] array
- xpointgrid
x (longitude) of the locations that vector variable is known in those locations as a [K*L] array
- ypointgrid
y (latitude) of the locations that vector variable is known in those locations as a [K*L] array
- Vxgrid
- Variable in x direction (x component of input variable) at (xpointgrid,ypointgrid) as a [K*L*P] arrayP is number of time steps for a time series
- Vygrid
- Variable in y direction (y component of input variable) at (xpointgrid,ypointgrid) as a [K*L*P] array in (Degree)P is number of time steps for a time series
- savedata=’no’;
- Define if save data in a file or not‘no’: does not save‘yes’: save data as ascii file
- outfilename=’swanwind.wnd’;
- Name of output file between ‘ ‘ mark, example: ‘swanwind.wnd’outfilename should have proper name and extension
- outfilelocation=pwd;
Location of output file between ‘ ‘ mark, example: ‘C:' in MATLAB, or ‘C:/’ in Python
- CalcMethod=’linear’;
- Interpolation method‘linear’: Use default or ‘linear’ method to interpolate‘nearest’: Use nearest neighbor method to interpolate
Outputs#
- swanvectorvariable
- Spatially varied vector variable data formated for SWANVector variable data at each time step is assigned into the grid points
Examples#
[xgrid,ygrid]=meshgrid(linspace(-91,-90,100),linspace(28,30,100));
[xpointgrid,ypointgrid]=meshgrid(linspace(-92,-89,100),linspace(27,31,100));
windvelxgrid=10+(12-10).*rand(100,100,4); %Data for 4 time steps
windvelygrid=1+(2-1).*rand(100,100,4); %Data for 4 time steps
savedata='no';
outfilename='swanwind.wnd';
outfilelocation=pwd;
CalcMethod='linear';
[swanvectorvariable]=swanvectorvarspvariedgrid(xgrid,ygrid,xpointgrid,ypointgrid,windvelxgrid,windvelygrid,savedata,outfilename,outfilelocation,CalcMethod);
[xgrid,ygrid]=meshgrid(linspace(-91,-90,100),linspace(28,30,100));
[xpointgrid,ypointgrid]=meshgrid(linspace(-92,-89,100),linspace(27,31,100));
windvelxgrid=10+(12-10).*rand(100,100); %Data for 1 time step
windvelygrid=1+(2-1).*rand(100,100); %Data for 1 time step
savedata='no';
outfilename='swanwind.wnd';
outfilelocation=pwd;
CalcMethod='linear';
[swanvectorvariable]=swanvectorvarspvariedgrid(xgrid,ygrid,xpointgrid,ypointgrid,windvelxgrid,windvelygrid,savedata,outfilename,outfilelocation,CalcMethod);
References#
Booij, N. R. R. C., Ris, R. C., & Holthuijsen, L. H. (1999). A third‐generation wave model for coastal regions: 1. Model description and validation. Journal of geophysical research: Oceans, 104(C4), 7649-7666.
SWAN Team. (2007). S WAN user manual. Delft University of Technology. The Netherlands.