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

Change the boundary file generation code to expect Modified Julian Day (rather...

Change the boundary file generation code to expect Modified Julian Day (rather than doing the conversion blindly in the function). Also fold in the code from set_elevtide.m into this function as it was somewhat pointless having set_elevtide call write_FVCOM_elevtide
parent c4d7001d
function write_FVCOM_elevtide(ObcNodes,JulianTime,SurfaceElevation,ElevationFile,MyTitle)
function write_FVCOM_elevtide(Mobj,MJD,ElevationFile,MyTitle)
% Write an FVCOM surface elevation time series forcing file
% function write_FVCOM_elevtide(ObcNodes,JulianTime,SurfaceElevation,SpectralFile,MyTitle)
% write_FVCOM_elevtide(ObcNodes,JulianTime,ElevationFile,MyTitle)
% Write an FVCOM NetCDF surface elevation forcing file
% ObcNodes = list of open boundary nodes of size [nObcs]
% JulianTime = list of modified Julian Dates of size [times] (but
% defined as unlimited in the NetCDF file.
% SurfaceElevation = list of surface elevation values of size [nObcs,
% times]
% ElevationFile = name of NetCDF file
% MyTitle = case title, written as global attribute of NetCDF
% file
% ObcNodes = list of open boundary nodes of size [nObcs].
% MJD = list of modified Modified Julian Dates of size
% [times] (defined as unlimited in the NetCDF file).
% ElevationFile = name of NetCDF file.
% MyTitle = casename title, written as global attribute of
% NetCDF file.
% ElevationFile, A NetCDF FVCOM surface elevations tide forcing file
......@@ -28,25 +25,39 @@ function write_FVCOM_elevtide(ObcNodes,JulianTime,SurfaceElevation,ElevationFile
% Revision history
% 2012-08-08 First version.
% 2012-11-14 Updated to expect Modified Julian Day rather than doing the
% conversion in here. Also put the pieces in set_elevtide in here to
% simplify the process of writing out an elevation input file.
global ftbverbose
report = false;
if(ftbverbose); report = true; end;
if(ftbverbose); report = true; end
subname = 'write_FVCOM_elevtide';
if(report); fprintf('\n'); end;
if(report); fprintf(['begin : ' subname '\n']); end;
if(report); fprintf('\n'); end
if(report); fprintf(['begin : ' subname '\n']); end
cnt = 0;
ObcNodes = nan(1,sum(Mobj.nObcNodes));
for ob=1:Mobj.nObs
nObcs = Mobj.nObcNodes(ob);
for j=1:nObcs
cnt = cnt + 1;
ObcNodes(cnt) = Mobj.obc_nodes(ob,j); % set open boundary nodes
% Sanity check on input and dimensions
nTimes = numel(JulianTime);
if(report); fprintf('Number of time steps %d\n',nTimes); end;
nTimes = numel(MJD);
if(report); fprintf('Number of time steps %d\n',nTimes); end
nObcs = numel(ObcNodes);
if(report); fprintf('Number of Open Boundary Nodes %d\n',nObcs); end;
if(report); fprintf('Number of Open Boundary Nodes %d\n',nObcs); end
[chk1,chk2] = size(SurfaceElevation);
[chk1, chk2] = size(Mobj.surfaceElevation);
if nObcs ~= chk1 || nTimes ~= chk2
fprintf('Surface elevation dimensions do not match time series and number of boundary nodes.\n')
fprintf('Surface elevation nodes and time sizes: (%d, %d)\n', chk1, chk2)
......@@ -70,7 +81,7 @@ netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','FILE CREATED using w
% define dimensions
% define variables and attributes
......@@ -108,15 +119,15 @@ netcdf.endDef(nc);
% write data
netcdf.putVar(nc,time_varid,0,nTimes,JulianTime - 678942);
netcdf.putVar(nc,itime_varid,floor(JulianTime - 678942));
netcdf.putVar(nc,itime2_varid,0,nTimes,mod(JulianTime - 678942,1)*24*3600*1000);
nStringOut = char();
for i=1:nTimes
nStringOut = [nStringOut, sprintf('%04i/%02i/%02i %02i:%02i:%02i ',datevec(JulianTime(i)))];
nStringOut = [nStringOut, sprintf('%04i/%02i/%02i %02i:%02i:%02i ',datevec(MJD(i)))];
% close file
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