Commit 1e87475b authored by Ricardo Torres's avatar Ricardo Torres 💬

Merge branch 'dev' of gitlab.ecosystem-modelling.pml.ac.uk:fvcom/fvcom-toolbox into dev

parents 298328fb ee5a8724
......@@ -206,7 +206,7 @@ for v = 1:length(fields)
for j = 1:nz
if j == zidx + 1
if ftbverbose
fprintf(' skipping remaining coarse data layers (%d) as their depths are below the FVCOM open boundary depths\n', nz - zidx - 1)
fprintf(' skipping remaining coarse data layers (%d) as their depths are below the FVCOM open boundary depths\n', nz - zidx)
end
continue
elseif j > zidx
......@@ -464,7 +464,7 @@ for v = 1:length(fields)
% Get the temperature and salinity values for this node and
% interpolate down the water column (from HYCOM to FVCOM).
if ~isnan(norm_tpz)
if any(~isnan(norm_tpz))
fvtempz(pp, :) = interp1(norm_tpz, itempz(pp, ~mm), tfz, 'pchip', 'extrap');
%figure(800);
......
......@@ -99,7 +99,7 @@ end
nml.NML_NETCDF.NC_SALT_TEMP = 'F';
nml.NML_NETCDF.NC_TURBULENCE = 'F';
nml.NML_NETCDF.NC_AVERAGE_VEL = 'T';
nml.NML_NETCDF.NC_VERTICAL_VEL = 'F';
nml.NML_NETCDF.NC_VERTICAL_VEL = 'T';
nml.NML_NETCDF.NC_WIND_VEL = 'F';
nml.NML_NETCDF.NC_WIND_STRESS = 'F';
nml.NML_NETCDF.NC_EVAP_PRECIP = 'F';
......
function [h] = read_fvcom_bath(bathfile)
function [h] = read_fvcom_bath(bathfile)
% Read fvcom bathymetry file
% Read fvcom bathymetry file
%
% [h] = function read_fvcom_bath(bathfile)
%
% DESCRIPTION:
% Read FVCOM Bathymetry file
% Read FVCOM Bathymetry file
%
% INPUT [keyword pairs]:
% 'bathfile' = fvcom bathymetry file
% INPUT:
% bathfile = fvcom bathymetry file
%
% OUTPUT:
% h = bathymetry vector
......@@ -16,13 +16,15 @@ function [h] = read_fvcom_bath(bathfile)
% EXAMPLE USAGE
% Mobj = read_fvcom_bath('tst_dep.dat')
%
% Author(s):
% Author(s):
% Geoff Cowles (University of Massachusetts Dartmouth)
% Rory O'Hara Murray (Marine Scotland Science)
% Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history
% 2014-11-19 Remove loops to speed up reading in the file.
%
% 2017-04-11 Minor clean up of the code.
%
%==============================================================================
global ftbverbose
......@@ -34,25 +36,24 @@ end
%------------------------------------------------------------------------------
% read in the FVCOM bathymetry data
%------------------------------------------------------------------------------
fid = fopen(bathfile,'r');
if(fid < 0)
error(['file: ' bathfile ' does not exist']);
end;
fid = fopen(bathfile, 'r');
assert(fid > 0, 'file: %s does not exist', bathfile);
C = textscan(fid, '%s %s %s %d', 1);
Nverts = C{4};
h = zeros(Nverts,1);
fprintf('reading bathymetry file\n');
fprintf('# nodes %d\n',Nverts);
if ftbverbose
fprintf('reading bathymetry file\n');
fprintf('# nodes %d\n',Nverts);
end
C = textscan(fid,' %f %f %f',Nverts);
h = C{3};
fprintf('min depth %f max depth %f\n',min(h),max(h));
fprintf('bathymetry reading complete\n');
fclose(fid);
if ftbverbose
fprintf('min depth %f max depth %f\n',min(h),max(h));
fprintf('bathymetry reading complete\n');
end
if(ftbverbose)
fprintf(['end : ' subname '\n'])
end;
if ftbverbose
fprintf('end : %s\n', subname)
end
......@@ -359,7 +359,7 @@ if have_strings
Mobj.have_strings = have_strings;
Mobj.read_obc_nodes = read_obc_nodes;
else
Mobj.have_strings;
Mobj.have_strings = false;
end
if exist('addCoriolis', 'var') && addCoriolis
Mobj.have_cor = true;
......
......@@ -19,6 +19,7 @@ function res = write_model_nml(conf, nml, fmt)
% Revision history
% 2017-01-12 First version.
% 2017-02-03 Fix output directory variable use.
% 2017-08-01 Remove tabs from the namelists.
if ~( exist(conf.fvcom_model, 'dir') )
mkdir(conf.fvcom_model);
......@@ -40,13 +41,13 @@ for nn = 1:length(nml_blocks)
var_value = nml.(nml_blocks{nn}).(nml_vars{vv});
if ischar(var_value)
if any(strcmp(var_value, {'T','F'}))
formatstr = ' %s\t = %s';
formatstr = ' %s = %s';
else
formatstr=[' %s\t = ', '''', '%s', ''''];
formatstr=[' %s = ', '''', '%s', ''''];
end
else
formatstr= [' %s\t = ', repmat([fmt.(nml_blocks{nn}).(nml_vars{vv}).format, ','], 1, length(var_value))];
formatstr= [' %s = ', repmat([fmt.(nml_blocks{nn}).(nml_vars{vv}).format, ','], 1, length(var_value))];
end
line = sprintf(formatstr, nml_vars{vv}, var_value);
fprintf(fnml, '%s\n', line);
......
......@@ -2,7 +2,7 @@ function write_SMS_2dm(file, tri, x, y, z, bnd)
% Output an SMS 2dm ASCII file from the triangulation given by tri, x and
% y.
%
% write_SMS_2dm(tri, x, y)
% write_SMS_2dm('file.2dm', tri, x, y)
%
% DESCRIPTION:
% Create an ASCII file in the SMS 2dm format of the triangulation in tri,
......@@ -28,6 +28,7 @@ function write_SMS_2dm(file, tri, x, y, z, bnd)
% Revision history:
% 2013-03-11 First version.
% 2017-01-27 Change the arguments to use a z value too.
% 2017-04-11 Update the help to be more useful.
%
%==========================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment