Due to a shift in policy, from 0900 GMT on Wednesday 14th July 2021, we will be disabling ssh access to the server for external users. External users who wish to continue to access code repositories on the server will need to switch to using https. This can be accomplished in the following way: 1) On the repo on gitlab, use the clone dialogue and select ‘Clone with HTTPS’ to get the address of the repo; 2) From within the checkout of your repo run: $ git remote set-url origin HTTPS_ADDRESS. Here, replace HTTPS_ADDRESS with the address you have just copied from GitLab. Pulls and pushes will now require you to enter a username and password rather than using a ssh key. If you would prefer not to enter a password each time, you might consider caching your login credentials.

write_SMS_cst.m 1.63 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
function write_SMS_cst(file, x, y)
% Export a set of points to a CST file which can be imported into SMS.
% 
% write_SMS_cst(file, x, y)
% 
% DESCRIPTION:
%   Create an ASCII file in the CST format recognised by SMS from the
%   coordinates specified in (x, y). If x and y are cell arrays, the
%   coordinates in each cell array are treated as different arcs in the CST
%   file (e.g. if you have multiple open boundaries you would like in a
%   single CST file).
% 
% INPUT:
%   file - file name to save to.
%   x, y - coordinate pairs for the open boundary.
% 
% OUTPUT:
%   file - ASCII file in SMS CST format.
% 
% EXAMPLE USAGE:
21
%   write_SMS_cst(file, x, y)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
% 
% Author(s):
%   Pierre Cazenave (Plymouth Marine Laboratory)
% 
% Revision history:
%   2013-03-11 First version.
% 
%==========================================================================

subname = 'write_SMS_cst';

global ftbverbose
if ftbverbose
    fprintf('\n'); fprintf(['begin : ' subname '\n']);
end

f = fopen(file, 'w');
if f < 0
    error('Unable to open output file (check permissions?)')
end

if iscell(x) && iscell(y)
    nb = length(x);
else
    nb = 1;
end

% Header
fprintf(f, 'COAST\n');
fprintf(f, '%i\n', nb);

for bb = 1:nb % each boundary
    if iscell(x) && iscell(y)
        np = length(x{bb});
        xx = x{bb};
        yy = y{bb};
    else
        np = length(x);
        xx = x;
        yy = y;
    end

    % The current arc's header
    fprintf(f, '%i\t0.0\n', np);
    
    % All the positions
    for i=1:length(xx);
        fprintf(f, '\t%.6f\t%.6f\t0.0\n', xx(i), yy(i));
    end

end
    
fclose(f);

if ftbverbose
    fprintf('end   : %s \n', subname)
end