Commit 3aa7aff1 authored by Pierre Cazenave's avatar Pierre Cazenave

Add global history variable to the NetCDFs which includes the routine used to...

Add global history variable to the NetCDFs which includes the routine used to generate the file and a reference to the fvcom-toolbox
parent ce302241
......@@ -127,7 +127,7 @@ nc = netcdf.create(tsOBCFile, 'clobber');
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'type','FVCOM RIVER FORCING FILE')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'title','simple open boundary hydrography test')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'type','FVCOM TIME SERIES OBC TS FILE')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','generated using the fvcom-toolbox')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','File generated using example_FVCOM_tsobc.m from the MATLAB fvcom-toolbox')
% define dimensions
......
function write_FVCOM_elevtide(Mobj,MJD,ElevationFile,MyTitle)
% Write an FVCOM surface elevation time series forcing file
%
% write_FVCOM_elevtide(Mobj,MJD,ElevationFile,MyTitle)
% write_FVCOM_elevtide(Mobj, MJD, ElevationFile, MyTitle)
%
% DESCRIPTION:
% Write an FVCOM NetCDF surface elevation forcing file
%
% INPUT:
% Mobj = Matlab mesh object.
% 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.
% Mobj = Matlab mesh object.
% 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.
%
% OUTPUT:
% ElevationFile, A NetCDF FVCOM surface elevations tide forcing file
%
% EXAMPLE USAGE
% write_FVCOM_elevtide(Mobj,MJD,ElevationFile,MyTitle)
% write_FVCOM_elevtide(Mobj, MJD, '/tmp/elevtide.nc, 'Shelf tides')
%
% Author(s):
% Pierre Cazenave (Plymouth Marine Laboratory)
......@@ -25,15 +25,15 @@ function write_FVCOM_elevtide(Mobj,MJD,ElevationFile,MyTitle)
%
% Revision history
% 2012-08-08 (PWC) First version.
% 2012-11-14 (PWC) 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.
% 2012-11-14 (PWC) 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.
% 2012-12-04 (KJT) Updated to use surface elevation and open boundary
% nodes from Mobj.
%
%==============================================================================
%==========================================================================
global ftbverbose
global ftbverbose
report = false;
if(ftbverbose); report = true; end
subname = 'write_FVCOM_elevtide';
......@@ -47,9 +47,9 @@ tmpObcNodes = Mobj.obc_nodes';
% code.
ObcNodes = tmpObcNodes(tmpObcNodes~=0)';
%------------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Sanity check on input and dimensions
%------------------------------------------------------------------------------
%--------------------------------------------------------------------------
nTimes = numel(MJD);
if(report); fprintf('Number of time steps %d\n',nTimes); end
......@@ -66,16 +66,16 @@ if nObcs ~= chk1 || nTimes ~= chk2
end
%%
%------------------------------------------------------------------------------
%--------------------------------------------------------------------------
% Dump the file
%------------------------------------------------------------------------------
%--------------------------------------------------------------------------
nc=netcdf.create(ElevationFile,'clobber');
% define global attributes
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'type','FVCOM TIME SERIES ELEVATION FORCING FILE')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'title',MyTitle)
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','FILE CREATED using write_FVCOM_elevtide')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','File created using write_FVCOM_elevtide from the MATLAB fvcom-toolbox')
% define dimensions
nobc_dimid=netcdf.defDim(nc,'nobc',nObcs);
......
......@@ -55,6 +55,7 @@ fprintf('Size of T/S array: \n',ksl);
nc = netcdf.create(filename,'clobber');
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'title',mytitle)
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','File created with the write_FVCOM_obs_TS.m from the MATLAB fvcom-toolbox')
% define dimensions
ksl_dimid=netcdf.defDim(nc,'ksl',ksl);
......
......@@ -84,7 +84,7 @@ for i=1:nComponents
end
end
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'components',ComponentsOut)
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','FILE CREATED using write_FVCOM_spectide')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','File created using write_FVCOM_spectide.m from the MATLAB fvcom-toolbox')
% define dimensions
one_dimid=netcdf.defDim(nc,'one',1);
......
......@@ -173,7 +173,7 @@ nc = netcdf.create(tsOBCFile, 'clobber');
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'type','FVCOM RIVER FORCING FILE')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'title','simple open boundary hydrography test')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'type','FVCOM TIME SERIES OBC TS FILE')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','generated using the fvcom-toolbox')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','File generated using write_FVCOM_tsobc.m from the MATLAB fvcom-toolbox')
% define dimensions
......
......@@ -61,7 +61,7 @@ netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'references','http://fvcom.smas
% netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'source','single-point time-dependent surface forcing')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'source','fvcom grid (unstructured) surface forcing')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'institution','Plymouth Marine Laboratory')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','Generated using the fvcom-toolbox')
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history','File generated using the write_FVCOM_wind_ts_speed.m from the MATLAB fvcom-toolbox')
% dimensions
nele_dimid=netcdf.defDim(nc,'nele',nElems);
......
......@@ -65,6 +65,7 @@ end;
nc = netcdf.create(filename,'clobber');
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'title',mytitle)
netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history', 'File created using write_FVCOM_z0.m from the MATLAB fvcom-toolbox')
% dimensions
nele_dimid=netcdf.defDim(nc,'nele',nElems);
......
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