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.

Commit 7b3cfce0 authored by Pierre Cazenave's avatar Pierre Cazenave

Two things:

1. Remove the totally unnecessary loop iterating through the vertical levels on the vertical interpolation secion. No idea what that was doing there.

2. Change the interpolation of the vertical profiles to scale the POLCOMS depths to the current FVCOM node's depth range. This means the full profile structure is maintained in the interpolated profiles but that it is squashed or stretched to fit the scaled depths. This also means the surface and seabed value are fully captured.
parent e35c6705
...@@ -46,6 +46,12 @@ function Mobj = get_POLCOMS_tsobc(Mobj, ts) ...@@ -46,6 +46,12 @@ function Mobj = get_POLCOMS_tsobc(Mobj, ts)
% %
% Revision history % Revision history
% 2013-02-07 First version. % 2013-02-07 First version.
% 2013-02-27 Change the vertical interpolation to be scaled within the
% POLCOMS-ERSEM depth range for the current node. The net result is that
% the vertical profiles are squashed or stretched to fit within the
% FVCOM depths. This means the full profile structure is maintained in
% the resulting FVCOM boundary input despite the differing depths at the
% FVCOM boundary node.
% %
%========================================================================== %==========================================================================
...@@ -178,35 +184,47 @@ for t = 1:nt ...@@ -178,35 +184,47 @@ for t = 1:nt
% Now we've interpolated in space, we can interpolate the z-values % Now we've interpolated in space, we can interpolate the z-values
% to the sigma depths. % to the sigma depths.
oNodes = Mobj.obc_nodes(Mobj.obc_nodes ~= 0); oNodes = Mobj.obc_nodes(Mobj.obc_nodes ~= 0);
for zi = 1:fz
% Preallocate the output arrays
% Preallocate the output arrays fvtempz = nan(nf, fz);
fvtempz = nan(nf, fz); fvsalz = nan(nf, fz);
fvsalz = nan(nf, fz);
for pp = 1:nf
for pp = 1:nf % Get the FVCOM depths at this node
% Get the FVCOM depths at this node tfz = Mobj.siglayz(oNodes(pp), :);
tfz = Mobj.siglayz(oNodes(pp), :); % Now get the interpolated PML POLCOMS-ERSEM depth at this node
% Now get the interpolated PML POLCOMS-ERSEM depth at this node tpz = idepthz(pp, :);
tpz = idepthz(pp, :);
% To ensure we get the full vertical expression of the vertical
% Get the temperature and salinity values for this node and % profiles, we need to normalise the POLCOMS-ERSEM and FVCOM
% interpolate down the water column (from PML POLCOMS-ERSEM to % depths to the same range. This is because in instances where
% FVCOM). I had originally planned to use csaps for the % FVCOM depths are shallower (e.g. in coastal regions), if we
% vertical interplation/subsampling at each location. However, % don't normalise the depths, we end up truncating the vertical
% the demo of csaps in the MATLAB documentation makes the % profile. This approach ensures we always use the full
% interpolation look horrible (shaving off extremes). interp1 % vertical profile, but we're potentially squeezing it into a
% provides a range of interpolation schemes, of which pchip % smaller depth.
% seems to do a decent job of the interpolation (at least A = max(tpz);
% qualitatively). B = min(tpz);
if ~isnan(tpz) C = max(tfz);
fvtempz(pp, :) = interp1(tpz, itempz(pp, :), tfz, 'linear', 'extrap'); D = min(tfz);
fvsalz(pp, :) = interp1(tpz, isalz(pp, :), tfz, 'linear', 'extrap'); norm_tpz = (((D - C) * (tpz - A)) / (B - A)) + C;
else
warning('Should never see this... ') % because we test for NaNs when fetching the values. % Get the temperature and salinity values for this node and
warning('FVCOM boundary node at %f, %f is outside the PML POLCOMS-ERSEM domain. Skipping.', fvlon(pp), fvlat(pp)) % interpolate down the water column (from PML POLCOMS-ERSEM to
continue % FVCOM). I had originally planned to use csaps for the
end % vertical interplation/subsampling at each location. However,
% the demo of csaps in the MATLAB documentation makes the
% interpolation look horrible (shaving off extremes). interp1
% provides a range of interpolation schemes, of which pchip
% seems to do a decent job of the interpolation (at least
% qualitatively).
if ~isnan(tpz)
fvtempz(pp, :) = interp1(norm_tpz, itempz(pp, :), tfz, 'linear', 'extrap');
fvsalz(pp, :) = interp1(norm_tpz, isalz(pp, :), tfz, 'linear', 'extrap');
else
warning('Should never see this... ') % because we test for NaNs when fetching the values.
warning('FVCOM boundary node at %f, %f is outside the PML POLCOMS-ERSEM domain. Skipping.', fvlon(pp), fvlat(pp))
continue
end end
end end
......
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