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 2da82f23 authored by Pierre Cazenave's avatar Pierre Cazenave

In cases where the requested constituent is not found in the POLPRED data,...

In cases where the requested constituent is not found in the POLPRED data, eliminate the NaN values from the relevant indices and return POLPRED data for the remaining constituents. It is worth noting that actually trying to write out the data returned by this with write_FVCOM_spectide.m will probably fail because the size of the list of constituents will differ from the size of the arrays of amplitude and phase returned by this script
parent d2663c1d
......@@ -79,7 +79,7 @@ pIndUse = nan(length(Mobj.Components), 2);
for i=1:length(Mobj.Components)
pPos = pInd(strcmp(Mobj.Components{i}, header.Harmonics));
if isempty(pPos)
warning('Supplied constituent (%s) is not present in the POLPRED data') %#ok<WNTAG>
warning('Supplied constituent (%s) is not present in the POLPRED data', Mobj.Components{i}) %#ok<WNTAG>
% Make index start at zero so the multiplication works, but
% compensate for that once the offset has been applied. Also add
......@@ -155,15 +155,18 @@ obc_lat = Mobj.lat(ObcNodes);
% Mobj).
distance = nan(size(obc_lon));
point = nan(size(distance));
amp = nan(length(obc_lon), length(pIndUse));
% Omit the NaNs in the indices from POLPRED when calculating the output
% array size.
amp = nan(length(obc_lon), length(pIndUse(~isnan(pIndUse(:, 1)), 1)));
phase = nan(size(amp));
for i=1:length(obc_lon)
radvec = sqrt((obc_lon(i)-data(:,2)).^2 + (obc_lat(i)-data(:,1)).^2);
[distance(i), point(i)] = min(radvec);
% Get the amplitude and phase for each constituent (in order of
% Mobj.Components).
amp(i, :) = data(point(i), pIndUse(:, 1));
phase(i, :) = data(point(i), pIndUse(:, 2));
% Mobj.Components). Check for and omit NaNs here (for missing tidal
% constituents in the supplied list and what's given in POLPRED).
amp(i, :) = data(point(i), pIndUse(~isnan(pIndUse(:, 1)), 1));
phase(i, :) = data(point(i), pIndUse(~isnan(pIndUse(:, 1)), 2));
% Check for and warn about NaNs (-999.9 in POLPRED data).
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