Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_residual.html b/doc/fvcom_postproc/do_residual.html index 847deb9..a74287b 100644 --- a/doc/fvcom_postproc/do_residual.html +++ b/doc/fvcom_postproc/do_residual.html @@ -114,6 +114,6 @@ This function is called by: 0061 % Calculate direction and magnitude. 0062 rDir=atan2(uDiff,vDiff)*(180/pi); % in degrees. 0063 rMag=sqrt(uDiff.^2+vDiff.^2)/tideDuration; % in units/s. -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_residual_plot.html b/doc/fvcom_postproc/do_residual_plot.html index a6bcf0f..09d9940 100644 --- a/doc/fvcom_postproc/do_residual_plot.html +++ b/doc/fvcom_postproc/do_residual_plot.html @@ -121,6 +121,6 @@ This function is called by: 0076 end 0077 end 0078 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_surface_plot.html b/doc/fvcom_postproc/do_surface_plot.html index 5593a4c..6f20397 100644 --- a/doc/fvcom_postproc/do_surface_plot.html +++ b/doc/fvcom_postproc/do_surface_plot.html @@ -168,6 +168,6 @@ This function is called by: 0094 0095 return 0096 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_surface_plotMatlabMap.html b/doc/fvcom_postproc/do_surface_plotMatlabMap.html index 43dce49..f4620d6 100644 --- a/doc/fvcom_postproc/do_surface_plotMatlabMap.html +++ b/doc/fvcom_postproc/do_surface_plotMatlabMap.html @@ -150,90 +150,89 @@ This function is called by: 0076 if isfield (plotOPTS,'PlotoutS') && ~isempty(plotOPTS.PlotoutS(plotOPTS.figure).handles) 0077 else 0078 % coast=load(plotOPTS.coastline_file); -0079 geoshow(plotOPTS.coastline_file,'Color','black') -0080 -0081 end -0082 -0083 end -0084 %------------------------------------------------------------------------------ -0085 % Generate maps at a give level -0086 %------------------------------------------------------------------------------ -0087 mstruct = gcm; +0079 geoshow(plotOPTS.coastline_file,'Facecolor',[0.7 .7 .7]) +0080 end +0081 +0082 end +0083 %------------------------------------------------------------------------------ +0084 % Generate maps at a give level +0085 %------------------------------------------------------------------------------ +0086 mstruct = gcm; +0087 0088 -0089 -0090 [X, Y] = mfwdtran(mstruct,plotOPTS.mesh.lat, plotOPTS.mesh.lon); -0091 -0092 aa=plotOPTS.Time_record; -0093 fprintf('Time step %i of %i\n',aa,length(FVCOM.Time_record)); -0094 %plot map -0095 hold on -0096 ND=ndims(FVCOM.(plotOPTS.var_plot)) -0097 switch ND -0098 case 2 -0099 Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... -0100 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),'edgecolor','interp','facecolor','interp'); -0101 -0102 case 3 -0103 Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... -0104 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp'); -0105 end -0106 caxis(plotOPTS.clims) -0107 colorbar h -0108 % check if mesh elements are required -0109 if plotOPTS.do_mesh -0110 %plot vertices -0111 Plots(plotOPTS.figure).mesh=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... -0112 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on -0113 -0114 end -0115 % setm(gca,'MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon]) -0116 tightmap -0117 %----------------------------------------------------------------------- -0118 % Only in my case it needs adding 6 because proj automatically determines a -0119 % reference long in strides of 6deg while m_map doesn't -0120 %------------------------------------------------------------------------ -0121 pause(plotOPTS.pause) -0122 % if aa~=length(plotOPTS.Time_record) -0123 % delete(Plots(plotOPTS.figure).handles(:)) -0124 % end -0125 -0126 % end -0127 +0089 [X, Y] = mfwdtran(mstruct,plotOPTS.mesh.lat, plotOPTS.mesh.lon); +0090 +0091 aa=plotOPTS.Time_record; +0092 fprintf('Time step %i of %i\n',aa,length(FVCOM.Time_record)); +0093 %plot map +0094 hold on +0095 ND=ndims(FVCOM.(plotOPTS.var_plot)) +0096 switch ND +0097 case 2 +0098 Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... +0099 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),'edgecolor','interp','facecolor','interp'); +0100 +0101 case 3 +0102 Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... +0103 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp'); +0104 end +0105 caxis(plotOPTS.clims) +0106 colorbar('peer',gca,'EastOutside') +0107 % check if mesh elements are required +0108 if plotOPTS.do_mesh +0109 %plot vertices +0110 Plots(plotOPTS.figure).mesh=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,... +0111 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on +0112 +0113 end +0114 % setm(gca,'MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon]) +0115 tightmap +0116 %----------------------------------------------------------------------- +0117 % Only in my case it needs adding 6 because proj automatically determines a +0118 % reference long in strides of 6deg while m_map doesn't +0119 %------------------------------------------------------------------------ +0120 pause(plotOPTS.pause) +0121 % if aa~=length(plotOPTS.Time_record) +0122 % delete(Plots(plotOPTS.figure).handles(:)) +0123 % end +0124 +0125 % end +0126 +0127 0128 0129 0130 0131 0132 -0133 -0134 % fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record)); -0135 % %plot map -0136 % hold on -0137 % Plots(plotOPTS.figure).handles=patch('Vertices',[lat,lon],'Faces',plotOPTS.mesh.tri,... -0138 % 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp'); -0139 % -0140 % caxis(plotOPTS.clims) -0141 % colorbar -0142 % % check if mesh elements are required -0143 % if plotOPTS.do_mesh -0144 % %plot vertices -0145 % Plots(plotOPTS.figure).mesh=patch('Vertices',[lon,lat],'Faces',plotOPTS.mesh.tri,... -0146 % 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on -0147 % -0148 % end -0149 % setm(gca,'MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon]) -0150 % %----------------------------------------------------------------------- -0151 % % Only in my case it needs adding 6 because proj automatically determines a -0152 % % reference long in strides of 6deg while m_map doesn't -0153 % %------------------------------------------------------------------------ -0154 % pause(.2) -0155 % if aa~=length(plotOPTS.Time_record) -0156 % delete(Plots(plotOPTS.figure).handles(:)) -0157 % end -0158 % -0159 % end -0160 % -0161 return -0162 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0133 % fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record)); +0134 % %plot map +0135 % hold on +0136 % Plots(plotOPTS.figure).handles=patch('Vertices',[lat,lon],'Faces',plotOPTS.mesh.tri,... +0137 % 'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp'); +0138 % +0139 % caxis(plotOPTS.clims) +0140 % colorbar +0141 % % check if mesh elements are required +0142 % if plotOPTS.do_mesh +0143 % %plot vertices +0144 % Plots(plotOPTS.figure).mesh=patch('Vertices',[lon,lat],'Faces',plotOPTS.mesh.tri,... +0145 % 'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on +0146 % +0147 % end +0148 % setm(gca,'MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon]) +0149 % %----------------------------------------------------------------------- +0150 % % Only in my case it needs adding 6 because proj automatically determines a +0151 % % reference long in strides of 6deg while m_map doesn't +0152 % %------------------------------------------------------------------------ +0153 % pause(.2) +0154 % if aa~=length(plotOPTS.Time_record) +0155 % delete(Plots(plotOPTS.figure).handles(:)) +0156 % end +0157 % +0158 % end +0159 % +0160 return +0161 +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_surface_plotVel.html b/doc/fvcom_postproc/do_surface_plotVel.html index d4efc89..4d9c648 100644 --- a/doc/fvcom_postproc/do_surface_plotVel.html +++ b/doc/fvcom_postproc/do_surface_plotVel.html @@ -110,6 +110,6 @@ This function is called by: 0066 0067 return 0068 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_surface_plotVelMatlabMap.html b/doc/fvcom_postproc/do_surface_plotVelMatlabMap.html index f0508dc..12dc68e 100644 --- a/doc/fvcom_postproc/do_surface_plotVelMatlabMap.html +++ b/doc/fvcom_postproc/do_surface_plotVelMatlabMap.html @@ -118,6 +118,6 @@ This function is called by: 0074 0075 return 0076 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_transect_plot.html b/doc/fvcom_postproc/do_transect_plot.html index 0b60979..2dc0fe8 100644 --- a/doc/fvcom_postproc/do_transect_plot.html +++ b/doc/fvcom_postproc/do_transect_plot.html @@ -186,6 +186,6 @@ This function is called by: 0111 plot(X,Y,'r','LineWidth',2.5) 0112 end 0113 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_vector_plot.html b/doc/fvcom_postproc/do_vector_plot.html index 30b76e8..dcf574b 100644 --- a/doc/fvcom_postproc/do_vector_plot.html +++ b/doc/fvcom_postproc/do_vector_plot.html @@ -194,6 +194,6 @@ This function is called by: 0120 delete(Plots(plotOPTS.figure).handles(:)) 0121 end 0122 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_vector_plot_MatlabMap.html b/doc/fvcom_postproc/do_vector_plot_MatlabMap.html index ef10b60..9f7320c 100644 --- a/doc/fvcom_postproc/do_vector_plot_MatlabMap.html +++ b/doc/fvcom_postproc/do_vector_plot_MatlabMap.html @@ -238,6 +238,6 @@ This function is called by: 0164 % delete(Plots(plotOPTS.figure).handles(:)) 0165 % end 0166 % end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/do_vector_plot_MatlabMapC.html b/doc/fvcom_postproc/do_vector_plot_MatlabMapC.html index 5a780c0..1ccdb87 100644 --- a/doc/fvcom_postproc/do_vector_plot_MatlabMapC.html +++ b/doc/fvcom_postproc/do_vector_plot_MatlabMapC.html @@ -224,6 +224,6 @@ This function is called by: 0150 % delete(Plots(plotOPTS.figure).handles(:)) 0151 % end 0152 % end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/example_surface_plot.html b/doc/fvcom_postproc/example_surface_plot.html index c63f3e1..83c945e 100644 --- a/doc/fvcom_postproc/example_surface_plot.html +++ b/doc/fvcom_postproc/example_surface_plot.html @@ -184,6 +184,6 @@ This function is called by: 0120 % vector plots requires correct lat and lon for u and v positions: FVCOM.xc 0121 % and FVCOM.yc. Remember to extract them 0122 PLotoutV=do_vector_plot(plotOPTS,FVCOM) -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/graph.dot b/doc/fvcom_postproc/graph.dot index 6afec88..0bdded8 100644 --- a/doc/fvcom_postproc/graph.dot +++ b/doc/fvcom_postproc/graph.dot @@ -16,4 +16,5 @@ digraph m2html { do_vector_plot_MatlabMap [URL="do_vector_plot_MatlabMap.html"]; do_vector_plot_MatlabMapC [URL="do_vector_plot_MatlabMapC.html"]; example_surface_plot [URL="example_surface_plot.html"]; + show_max_CFL [URL="show_max_CFL.html"]; } \ No newline at end of file diff --git a/doc/fvcom_postproc/graph.html b/doc/fvcom_postproc/graph.html index a07096f..dee112f 100644 --- a/doc/fvcom_postproc/graph.html +++ b/doc/fvcom_postproc/graph.html @@ -34,6 +34,6 @@ -
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/index.html b/doc/fvcom_postproc/index.html index 9d1afc5..cc8d5c9 100755 --- a/doc/fvcom_postproc/index.html +++ b/doc/fvcom_postproc/index.html @@ -19,7 +19,7 @@

## Matlab files in this directory:

-
 README README for FVCOM_postproc do_residual DO_RESIDUAL Takes the u and v vectors of a model output and calculates do_residual_plot Take the output of do_residual and plot as a vector figure. Summarises a do_surface_plot do_surface_plotMatlabMap do_surface_plotVel reads image and plots tracks or stations do_surface_plotVelMatlabMap reads image and plots tracks or stations do_transect_plot do_vector_plot do_vector_plot_MatlabMap do_vector_plot_MatlabMapC example_surface_plot Sample script to extract and generate m_map contours of tracer variables
+ READMEREADME for FVCOM_postproc  do_residualDO_RESIDUAL Takes the u and v vectors of a model output and calculates  do_residual_plotTake the output of do_residual and plot as a vector figure. Summarises a  do_surface_plot  do_surface_plotMatlabMap  do_surface_plotVelreads image and plots tracks or stations  do_surface_plotVelMatlabMapreads image and plots tracks or stations  do_transect_plot  do_vector_plot  do_vector_plot_MatlabMap  do_vector_plot_MatlabMapC  example_surface_plotSample script to extract and generate m_map contours of tracer variables  show_max_CFLSHOW_MAX-CFL Function to find the max CFL encountered in each mesh element during an FVCOM model

## Subsequent directories:

@@ -29,6 +29,6 @@
-
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_postproc/show_max_CFL.html b/doc/fvcom_postproc/show_max_CFL.html new file mode 100644 index 0000000..6f8bca5 --- /dev/null +++ b/doc/fvcom_postproc/show_max_CFL.html @@ -0,0 +1,242 @@ + + + + Description of show_max_CFL + + + + + + + + + +
Home > fvcom_postproc > show_max_CFL.m
+ + + +

# show_max_CFL +

+ +

## PURPOSE

+
SHOW_MAX-CFL Function to find the max CFL encountered in each mesh element during an FVCOM model
+ +

## SYNOPSIS

+
function [ maxCFLs, fighandle ] = show_max_CFL(grdFile, depFile, ncFile, extTS, coordtype, fig_flag)
+ +

## DESCRIPTION

+
```SHOW_MAX-CFL Function to find the max CFL encountered in each mesh element during an FVCOM model
+run. NB need enough RAM to load all u, v and zeta data from the given
+ncFile.
+   Inputs: grdFile, depFile: casename_grd.dat and casename_dep.dat files
+                              from an FVCOM model
+           ncFile : Output from FVCOM. Must include u, v, and zeta.
+           extTS : External timestep at which to calculate CFL, in
+                   seconds.
+           coordtype: 'lonlat' or 'cartesian'. If cartesian, coordinates
+                  should be in metres. If lonlat, they should be in
+                  degrees.
+           fig_flag: Should a figure be plotted? true or false.```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + +

+ + +

## SOURCE CODE

+
```0001 function [ maxCFLs, fighandle ] = show_max_CFL(grdFile, depFile, ncFile, extTS, coordtype, fig_flag)
+0002 %SHOW_MAX-CFL Function to find the max CFL encountered in each mesh element during an FVCOM model
+0003 %run. NB need enough RAM to load all u, v and zeta data from the given
+0004 %ncFile.
+0005 %   Inputs: grdFile, depFile: casename_grd.dat and casename_dep.dat files
+0006 %                              from an FVCOM model
+0007 %           ncFile : Output from FVCOM. Must include u, v, and zeta.
+0008 %           extTS : External timestep at which to calculate CFL, in
+0009 %                   seconds.
+0010 %           coordtype: 'lonlat' or 'cartesian'. If cartesian, coordinates
+0011 %                  should be in metres. If lonlat, they should be in
+0012 %                  degrees.
+0013 %           fig_flag: Should a figure be plotted? true or false.
+0014 %
+0015
+0016 % The formulation of CFL used here is taken from the MIKE 3 manual
+0017
+0018 % Simon Waldman (Marine Scotland Science / Heriot-Watt University), March 2018
+0019
+0020 %% Check inputs
+0021
+0022 assert( nargin == 6, 'Wrong number of arguments.');
+0023 assert( exist(grdFile, 'file')==2, 'Cannot find file %s', grdFile );
+0024 assert( exist(depFile, 'file')==2, 'Cannot find file %s', depFile );
+0025 assert( exist(ncFile, 'file')==2, 'Cannot find file %s', ncFile );
+0026 assert( ischar(coordtype), 'Coord type must be ''lonlat'' or ''cartesian''.' );
+0027 assert( islogical( fig_flag ), 'fig_flag should be logical.' );
+0028
+0029 switch coordtype
+0030     case 'lonlat'
+0031         lonlat=true;
+0032     case 'latlon'
+0033         lonlat=true;
+0034     case 'cartesian'
+0035         lonlat=false;
+0036     otherwise
+0037         error('Coord type must be ''lonlat'' or ''cartesian''.');
+0038 end
+0039
+0040 % does the ncFile have velocities & water levels?
+0041
+0042 info = ncinfo(ncFile);
+0043 assert( any(strcmp('u', {info.Variables.Name})) && any(strcmp('v', {info.Variables.Name})) && ...
+0044     any(strcmp('zeta', {info.Variables.Name})), 'netCDF file must include the fields u, v and zeta.' );
+0045
+0046 %% Do the stuff.
+0047
+0049 M = read_fvcom_mesh( grdFile ); %NB this function puts lon and lat in the x and y fields.
+0050 M.h = read_fvcom_bath( depFile );
+0051 % calculate element depths from mean of nodes
+0052 M.hc = mean(M.h(M.tri),2);
+0053
+0060
+0061 g = 9.81;
+0062
+0063 NumTS = size(U, 3);
+0064 NumEl = size(U, 1);
+0065
+0066 % Find water depths for each element at each TS. First calculate this for
+0067 % nodes, then average them for elements.
+0068 disp('Calculating depths...');
+0069 NodeDepths = repmat(M.h, 1, NumTS) + Z; %repmat because Z has a time dimension, M.h doesn't.
+0070 for n = 1:3
+0071     tmp(:,:,n) = NodeDepths(M.tri(:,n), :);
+0072 end
+0073 ElDepths = mean(tmp, 3); %this has dimensions of element x TS.
+0074 clear Z NodeDepths tmp; %save some memory
+0075
+0076 % Find minimum characteristic length for each element. This is approximated by the
+0077 % minimum edge length. It could be shorter with really long thin triangles,
+0078 % but the 30 degree internal angle minimum for FVCOM means we shouldn't have those.
+0079
+0080 disp('Calculating triangle sizes...');
+0081 CharLen = nan(NumEl, 1);
+0082 for e = 1:NumEl %for each element
+0083     xv = M.x(M.tri(e,:)); %vertices.
+0084     yv = M.y(M.tri(e,:));
+0085     %close the triangle by copying the first vertex to the end
+0086     xv(4) = xv(1);
+0087     yv(4) = yv(1);
+0088     %find the edge lengths
+0089     if lonlat
+0090         for a = 1:3
+0091             edges(a) = haversine(yv(a), xv(a), yv(a+1), xv(a+1));
+0092         end
+0093     else
+0094         edges = sqrt( diff(xv).^2 + diff(yv).^2 );
+0095     end
+0096     CharLen(e) = min(edges);
+0097 end
+0098
+0099 % For each element and TS, find the layer with the highest U and V magnitudes.
+0100 % Technically doing this with each component rather than the vector magnitude
+0101 % is wrong, but it'll usually be close and where wrong, it'll overestimate the CFL, so it's safe.
+0102 maxU = squeeze(max(abs(U), [], 2));
+0103 maxV = squeeze(max(abs(V), [], 2));
+0104
+0105 % Find CFL for each element at each TS
+0106 CFL = ( 2 .* sqrt( g .* ElDepths ) + maxU + maxV ) .* repmat( (extTS ./ CharLen), 1, NumTS );
+0107 %This is based on equation 6.1 on pg 33 of the MIKE hydrodynamic module
+0108 %manual (modified for using a single characteristic length rather than
+0109 %deltaX/deltaY)
+0110
+0111 % find the max over time for each element
+0112 MaxCFL = max(CFL, [], 2);
+0113
+0114 [val, I] = max(MaxCFL);
+0115 fprintf('Max CFL reached with an external timestep of %.2f secs is approx. %.3f, in Element %i.\n', extTS, val, I);
+0116
+0117 % find how long the timestep probably could go. We set the CFL to 0.8 and
+0118 % apply the same formula backwards.
+0119 TargetCFL = 0.8;
+0120 MaxTSs = repmat( (TargetCFL .* CharLen), 1, NumTS ) ./ ( 2 .* sqrt( g .* ElDepths ) + maxU + maxV );
+0121 %that's still per element per TS. We care about what the smallest is.
+0122 OverallMaxTS = min(min(MaxTSs));
+0123
+0124 fprintf('Max external timestep to reach CFL of %.1f with this mesh would be approx. %.2f seconds.\n', TargetCFL, OverallMaxTS );
+0125
+0126 % Optionally, plot figure of this
+0127 if fig_flag
+0128     CFLfig = figure;
+0129     p = patch();
+0130     p.Vertices = [M.x M.y];
+0131     p.Faces = M.tri;
+0132     p.CData = MaxCFL;
+0133     p.FaceColor = 'flat';
+0134     %p.EdgeColor = [0 0 0];
+0135     p.EdgeColor = 'none';
+0136     p.EdgeAlpha = 0.1;
+0137     p.LineWidth = 0.1;
+0138     cb = colorbar;
+0139     colormap(parula);
+0140     caxis([0 max(MaxCFL)]);
+0141     ylabel(cb, 'Max CFL encountered.');
+0142     axis equal;
+0143
+0144     % add to the plot markers for the worst n elements
+0145     n = 10; %number of cells to highlight
+0146     [ ~, WorstEls ] = sort(MaxCFL, 'descend');
+0147     WorstElsX = mean(M.x(M.tri(WorstEls(1:n),:)), 2); %finding element centroid coords.
+0148     WorstElsY = mean(M.y(M.tri(WorstEls(1:n),:)), 2);
+0149     hold on;
+0150     plot(WorstElsX, WorstElsY, 'or');
+0151     fprintf('Red circles on plot show the %i mesh elements with the highest CFL.\n', n);
+0152 end
+0153
+0154 %return values
+0155 maxCFLs = MaxCFL;
+0156 fighandle = CFLfig;
+0157
+0158 end
+0159
+0160
+0161
+0162 function [distm]=haversine(lat1,lon1,lat2,lon2)
+0163 % Haversine function to calculate first order distance measurement. Assumes
+0164 % spherical Earth surface. Lifted from:
+0165 %
+0166 % http://www.mathworks.com/matlabcentral/fileexchange/27785
+0167
+0168 % Could be done more accurately with Mapping Toolbox tools, but don't want
+0169 % to require that, and we don't need amazing accuracy.
+0170
+0175 R = 6371000;                    % Earth's mean radius in metres
+0176 delta_lat = lat2 - lat1;        % difference in latitude
+0177 delta_lon = lon2 - lon1;        % difference in longitude
+0178 a = sin(delta_lat/2)^2 + cos(lat1) * cos(lat2) * ...
+0179     sin(delta_lon/2)^2;
+0180 c = 2 * atan2(sqrt(a), sqrt(1-a));
+0181 distm = R * c;                     % distance in metres
+0182 end```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/fvcom_prepro/README.html b/doc/fvcom_prepro/README.html index 6d86037..59d111d 100755 --- a/doc/fvcom_prepro/README.html +++ b/doc/fvcom_prepro/README.html @@ -83,6 +83,6 @@ This function is called by: 0019 % Revision history 0020 % 0021 %============================================================================== -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_coriolis.html b/doc/fvcom_prepro/add_coriolis.html index b8fccbc..bc5aa48 100755 --- a/doc/fvcom_prepro/add_coriolis.html +++ b/doc/fvcom_prepro/add_coriolis.html @@ -144,6 +144,6 @@ This function is called by: 0074 0075 0076 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_obc_nodes_graphic.html b/doc/fvcom_prepro/add_obc_nodes_graphic.html index 99f6c87..b6ba6af 100755 --- a/doc/fvcom_prepro/add_obc_nodes_graphic.html +++ b/doc/fvcom_prepro/add_obc_nodes_graphic.html @@ -160,6 +160,6 @@ This function is called by: 0088 fprintf(['end : ' subname '\n']) 0089 end; 0090 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_obc_nodes_list.html b/doc/fvcom_prepro/add_obc_nodes_list.html index e75c367..00ed24a 100755 --- a/doc/fvcom_prepro/add_obc_nodes_list.html +++ b/doc/fvcom_prepro/add_obc_nodes_list.html @@ -149,7 +149,7 @@ This function is called by: 0062 [~, Nidx] = unique(Nodelist); 0063 Nodelist = Nodelist(sort(Nidx)); 0064 -0065 assert(max(Nodelist) < Mobj.nVerts, 'Your open boundary node number exceed the total number of nodes in the domain\n') +0065 assert(max(Nodelist) <= Mobj.nVerts, 'Your open boundary node number (%d) exceeds the total number of nodes in the domain (%d)', max(Nodelist), Mobj.nVerts) 0066 0067 %-------------------------------------------------------------------------- 0068 % Plot the mesh @@ -189,6 +189,6 @@ This function is called by: 0102 fprintf('\nend : %s\n', subname) 0103 end 0104 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_river_nodes_graphic.html b/doc/fvcom_prepro/add_river_nodes_graphic.html index 2b9cfc7..9ff4ceb 100755 --- a/doc/fvcom_prepro/add_river_nodes_graphic.html +++ b/doc/fvcom_prepro/add_river_nodes_graphic.html @@ -166,6 +166,6 @@ This function is called by: 0094 fprintf(['end : ' subname '\n']) 0095 end; 0096 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_river_nodes_list.html b/doc/fvcom_prepro/add_river_nodes_list.html index eed457f..7e57380 100755 --- a/doc/fvcom_prepro/add_river_nodes_list.html +++ b/doc/fvcom_prepro/add_river_nodes_list.html @@ -175,6 +175,6 @@ This function is called by: 0096 fprintf(['end : ' subname '\n']) 0097 end 0098 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_sigma_forDT.html b/doc/fvcom_prepro/add_sigma_forDT.html index 3788098..6326665 100755 --- a/doc/fvcom_prepro/add_sigma_forDT.html +++ b/doc/fvcom_prepro/add_sigma_forDT.html @@ -91,6 +91,6 @@ This function is called by: 0045 nc = close(nc); 0046 0047 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_sponge_nodes.html b/doc/fvcom_prepro/add_sponge_nodes.html index 914daaa..b2f5bcd 100755 --- a/doc/fvcom_prepro/add_sponge_nodes.html +++ b/doc/fvcom_prepro/add_sponge_nodes.html @@ -157,6 +157,6 @@ This function is called by: 0085 0086 fprintf(['end : ' subname '\n']) 0087 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_stations_list.html b/doc/fvcom_prepro/add_stations_list.html index 3df52d2..62951e5 100644 --- a/doc/fvcom_prepro/add_stations_list.html +++ b/doc/fvcom_prepro/add_stations_list.html @@ -206,6 +206,6 @@ This function is called by: 0114 if ftbverbose 0115 fprintf('end : %s\n', subname) 0116 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_var_FVCOM_river.html b/doc/fvcom_prepro/add_var_FVCOM_river.html index fdd5fd0..5fb5529 100755 --- a/doc/fvcom_prepro/add_var_FVCOM_river.html +++ b/doc/fvcom_prepro/add_var_FVCOM_river.html @@ -182,6 +182,6 @@ This function is called by: 0106 fprintf('end : %s\n', subname) 0107 end 0108 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/add_weights_FVCOM_nested_forcing.html b/doc/fvcom_prepro/add_weights_FVCOM_nested_forcing.html index 02a5292..a21e24a 100644 --- a/doc/fvcom_prepro/add_weights_FVCOM_nested_forcing.html +++ b/doc/fvcom_prepro/add_weights_FVCOM_nested_forcing.html @@ -222,7 +222,7 @@ This function is called by: 0141 0142 0143 netcdf.putVar(nc2read, cweights_varid, nest.weight_cell); -0144 netcdf.putVar(nc2read, nweights_varid, nest.weight_node'); +0144 netcdf.putVar(nc2read, nweights_varid, nest.weight_node); 0145 catch e 0146 fprintf(e.message) 0147 error('Adding variable %s failed - does the variable already exist?', 'weight_cell') @@ -235,6 +235,6 @@ This function is called by: 0154 if ftbverbose 0155 fprintf('end : %s\n', subname) 0156 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/calc_sponge_radius.html b/doc/fvcom_prepro/calc_sponge_radius.html index fd2fb7c..df5ced5 100644 --- a/doc/fvcom_prepro/calc_sponge_radius.html +++ b/doc/fvcom_prepro/calc_sponge_radius.html @@ -170,6 +170,6 @@ This function is called by: 0094 fprintf(['end : ' subname '\n']) 0095 end 0096 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/change_shallow_bathy.html b/doc/fvcom_prepro/change_shallow_bathy.html new file mode 100644 index 0000000..cab3b47 --- /dev/null +++ b/doc/fvcom_prepro/change_shallow_bathy.html @@ -0,0 +1,132 @@ + + + + Description of change_shallow_bathy + + + + + + + + + +
Home > fvcom_prepro > change_shallow_bathy.m
+ + + +

# change_shallow_bathy +

+ +

## PURPOSE

+
Deepens shallow nodes by setting a minimum depth and making nodes that
+ +

## SYNOPSIS

+
function M = change_shallow_bathy(M, min_depth)
+ +

## DESCRIPTION

+
``` Deepens shallow nodes by setting a minimum depth and making nodes that
+ are too shallow the mean of the surrouding deep nodes. Loop until all
+ nodes are deeper than the minuimum depth required.
+
+ function [M]=change_shallow_bathy(M, min_depth)
+
+ DESCRIPTION:
+
+ INPUT:
+  M         = Mesh object
+  min_depth = the minimum depth of nodes
+
+ OUTPUT:
+  Nested  Mesh object with altered bathymetry.
+
+ EXAMPLE USAGE:
+
+
+ Author(s):
+   Rory O'Hara Murray (Marine Scotland Science)
+
+ Revision history:
+ 2014 sometime - first version
+
+==========================================================================```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function M  = change_shallow_bathy(M, min_depth)
+0002 % Deepens shallow nodes by setting a minimum depth and making nodes that
+0003 % are too shallow the mean of the surrouding deep nodes. Loop until all
+0004 % nodes are deeper than the minuimum depth required.
+0005 %
+0006 % function [M]=change_shallow_bathy(M, min_depth)
+0007 %
+0008 % DESCRIPTION:
+0009 %
+0010 % INPUT:
+0011 %  M         = Mesh object
+0012 %  min_depth = the minimum depth of nodes
+0013 %
+0014 % OUTPUT:
+0015 %  Nested  Mesh object with altered bathymetry.
+0016 %
+0017 % EXAMPLE USAGE:
+0018 %
+0019 %
+0020 % Author(s):
+0021 %   Rory O'Hara Murray (Marine Scotland Science)
+0022 %
+0023 % Revision history:
+0024 % 2014 sometime - first version
+0025 %
+0026 %==========================================================================
+0027
+0028 count = 0;
+0029 h=-99; % just to start
+0030
+0031 while sum(h==-99)>0
+0032     count=count+1;
+0033     disp(['iteration # ' num2str(count)])
+0034     I = M.h<=min_depth;         % find shallow nodes as depth is +ve down.
+0035     If = find(I);
+0036     h = [];
+0037
+0038     % loop through all shallow nodes with depth<=min_depth
+0039     for ii=1:length(If)
+0040
+0041         % find elements surrounding the shallow node
+0042         test = [];
+0043         for jj=1:3
+0044             test = [test; find(M.tri(:,jj)==If(ii))];
+0045         end
+0046         % find nodes for all these elements surrounding the shallow node
+0047         % (the surrounding nodes)
+0048         nodes = unique(M.tri(test,:));
+0049
+0050         htmp = M.h(nodes);
+0051         bla = htmp>min_depth;       % find the nodes that are deeper than min_depth
+0052         if sum(bla)>0
+0053             h(ii) = mean(htmp(bla));% make the shallow node the mean of the surrounding nodes deeper than min_depth
+0054         else
+0055             h(ii) = -99;  % id no deep surroundign nodes then make it -99 and try again.
+0056         end
+0057     end
+0058     M.h(I) = h;  % save changes to the Mobj array.
+0059 end
+0060
+0061 end```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/fvcom_prepro/create_nesting_nodes.html b/doc/fvcom_prepro/create_nesting_nodes.html index c9552bc..ee38ccd 100644 --- a/doc/fvcom_prepro/create_nesting_nodes.html +++ b/doc/fvcom_prepro/create_nesting_nodes.html @@ -202,6 +202,6 @@ This function is called by: 0131 fclose(fid); 0132 0133 disp('finished creating nesting file'); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/elems2nodes.html b/doc/fvcom_prepro/elems2nodes.html index fe66bc7..0d3a6e8 100755 --- a/doc/fvcom_prepro/elems2nodes.html +++ b/doc/fvcom_prepro/elems2nodes.html @@ -123,6 +123,6 @@ This function is called by: 0057 0058 %fprintf(['end : ' subname '\n']) 0059 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/estimate_ts.html b/doc/fvcom_prepro/estimate_ts.html index 33f1d73..2f6653a 100755 --- a/doc/fvcom_prepro/estimate_ts.html +++ b/doc/fvcom_prepro/estimate_ts.html @@ -180,6 +180,6 @@ This function is called by: 0105 c = 2 * atan2(sqrt(a), sqrt(1-a)); 0106 km = R * c; % distance in metres 0107 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/extract_mesoscale.html b/doc/fvcom_prepro/extract_mesoscale.html index 30d0457..c4f05b8 100644 --- a/doc/fvcom_prepro/extract_mesoscale.html +++ b/doc/fvcom_prepro/extract_mesoscale.html @@ -138,6 +138,6 @@ This function is called by: 0069 % end 0070 0071 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/find_nearest_pt.html b/doc/fvcom_prepro/find_nearest_pt.html index 3ca12ca..ff33d3a 100755 --- a/doc/fvcom_prepro/find_nearest_pt.html +++ b/doc/fvcom_prepro/find_nearest_pt.html @@ -143,6 +143,6 @@ This function is called by: 0068 % end 0069 0070 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/fix_river_nodes.html b/doc/fvcom_prepro/fix_river_nodes.html index 34d63fa..6ea360c 100644 --- a/doc/fvcom_prepro/fix_river_nodes.html +++ b/doc/fvcom_prepro/fix_river_nodes.html @@ -608,6 +608,6 @@ This function is called by: 0467 if ftbverbose 0468 fprintf('Minimum river depth is: %.2f (positive down)\n', min(Mobj.h(Mobj.river_nodes))) 0469 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/gen_semistructured_mesh.html b/doc/fvcom_prepro/gen_semistructured_mesh.html index 9fcf31b..4603c3a 100755 --- a/doc/fvcom_prepro/gen_semistructured_mesh.html +++ b/doc/fvcom_prepro/gen_semistructured_mesh.html @@ -211,6 +211,6 @@ This function is called by: 0140 fprintf(['end : ' subname '\n']) 0141 0142 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/gen_unstructured_mesh.html b/doc/fvcom_prepro/gen_unstructured_mesh.html index 1278df8..6a5a5ec 100644 --- a/doc/fvcom_prepro/gen_unstructured_mesh.html +++ b/doc/fvcom_prepro/gen_unstructured_mesh.html @@ -194,6 +194,6 @@ This function is called by: 0121 %write_dtank('junk.dtascii',Mobj); 0122 0123 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_AMM.html b/doc/fvcom_prepro/get_AMM.html index 2aa1328..5cd91cc 100644 --- a/doc/fvcom_prepro/get_AMM.html +++ b/doc/fvcom_prepro/get_AMM.html @@ -162,6 +162,6 @@ This function is called by: 0091 if(ftbverbose); 0092 fprintf(['end : ' subname '\n']); 0093 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_CFS_forcing.html b/doc/fvcom_prepro/get_CFS_forcing.html index 7b2b8e7..f4027df 100644 --- a/doc/fvcom_prepro/get_CFS_forcing.html +++ b/doc/fvcom_prepro/get_CFS_forcing.html @@ -752,6 +752,6 @@ This function is called by: 0647 fprintf('end : %s\n', subname) 0648 end 0649 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_EA_river_climatology.html b/doc/fvcom_prepro/get_EA_river_climatology.html index fe468ab..1cb7f67 100644 --- a/doc/fvcom_prepro/get_EA_river_climatology.html +++ b/doc/fvcom_prepro/get_EA_river_climatology.html @@ -252,6 +252,6 @@ This function is called by: 0170 if ftbverbose 0171 fprintf('end : %s \n', subname) 0172 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_EHYPE_rivers.html b/doc/fvcom_prepro/get_EHYPE_rivers.html index 6a22678..14e301d 100644 --- a/doc/fvcom_prepro/get_EHYPE_rivers.html +++ b/doc/fvcom_prepro/get_EHYPE_rivers.html @@ -662,6 +662,6 @@ This function is called by: 0538 % axis([min(Mobj.lon), max(Mobj.lon), min(Mobj.lat), max(Mobj.lat)]) 0539 % legend('EHYPE nodes', 'Grid boundary', 'Land nodes', 'Selected nodes', 'Location', 'NorthOutside', 'Orientation', 'Horizontal') 0540 % legend('BoxOff') -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_ERA_forcing.html b/doc/fvcom_prepro/get_ERA_forcing.html index 1fedbd7..38cd47e 100644 --- a/doc/fvcom_prepro/get_ERA_forcing.html +++ b/doc/fvcom_prepro/get_ERA_forcing.html @@ -211,6 +211,6 @@ This function is called by: 0133 if ftbverbose 0134 fprintf('end : %s \n', subname) 0135 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_FVCOM_rivers.html b/doc/fvcom_prepro/get_FVCOM_rivers.html index 252ce9b..f731e73 100644 --- a/doc/fvcom_prepro/get_FVCOM_rivers.html +++ b/doc/fvcom_prepro/get_FVCOM_rivers.html @@ -405,6 +405,6 @@ This function is called by: 0293 if ftbverbose 0294 fprintf(['end : ' subname '\n']) 0295 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_HYCOM_forcing.html b/doc/fvcom_prepro/get_HYCOM_forcing.html index 0d31e50..ac06041 100644 --- a/doc/fvcom_prepro/get_HYCOM_forcing.html +++ b/doc/fvcom_prepro/get_HYCOM_forcing.html @@ -605,6 +605,6 @@ This function is called by: 0484 error('Date is outside of the known spacetime continuum. See help TARDIS.') 0485 end 0486 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_HYCOM_tsobc.html b/doc/fvcom_prepro/get_HYCOM_tsobc.html index c4163e5..d5b03a5 100644 --- a/doc/fvcom_prepro/get_HYCOM_tsobc.html +++ b/doc/fvcom_prepro/get_HYCOM_tsobc.html @@ -178,6 +178,6 @@ This function is called by: 0069 % This is just a wrapper around the more generic interp_coarse_to_obc 0070 % function. This is to maintain backwards compatibility. 0071 Mobj = interp_coarse_to_obc(Mobj, hycom, varlist); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_MetUM_pp.html b/doc/fvcom_prepro/get_MetUM_pp.html index 5e7e8a9..b2a2008 100644 --- a/doc/fvcom_prepro/get_MetUM_pp.html +++ b/doc/fvcom_prepro/get_MetUM_pp.html @@ -402,6 +402,6 @@ This function is called by: 0299 if ftbverbose 0300 fprintf('end : %s \n', subname) 0301 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_NAE2_forcing.html b/doc/fvcom_prepro/get_NAE2_forcing.html index 468e5b6..e49585b 100644 --- a/doc/fvcom_prepro/get_NAE2_forcing.html +++ b/doc/fvcom_prepro/get_NAE2_forcing.html @@ -462,6 +462,6 @@ This function is called by: 0383 if(ftbverbose); 0384 fprintf(['end : ' subname '\n']); 0385 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_NCEP_forcing.html b/doc/fvcom_prepro/get_NCEP_forcing.html index 26d013b..36e8288 100644 --- a/doc/fvcom_prepro/get_NCEP_forcing.html +++ b/doc/fvcom_prepro/get_NCEP_forcing.html @@ -975,6 +975,6 @@ This function is called by: 0813 end 0814 0815 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_NEMO_rivers.html b/doc/fvcom_prepro/get_NEMO_rivers.html index 9929e71..91df824 100644 --- a/doc/fvcom_prepro/get_NEMO_rivers.html +++ b/doc/fvcom_prepro/get_NEMO_rivers.html @@ -616,6 +616,6 @@ This function is called by: 0490 fv_nr - skipped, fv_nr, skipped) 0491 fprintf('end : %s \n', subname) 0492 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_meanflow.html b/doc/fvcom_prepro/get_POLCOMS_meanflow.html index b4ed8af..d375881 100644 --- a/doc/fvcom_prepro/get_POLCOMS_meanflow.html +++ b/doc/fvcom_prepro/get_POLCOMS_meanflow.html @@ -487,6 +487,6 @@ This function is called by: 0380 % pause(0.1) 0381 % end 0382 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_netCDF.html b/doc/fvcom_prepro/get_POLCOMS_netCDF.html index ffcb163..90a3592 100644 --- a/doc/fvcom_prepro/get_POLCOMS_netCDF.html +++ b/doc/fvcom_prepro/get_POLCOMS_netCDF.html @@ -78,7 +78,7 @@ This function calls: This function is called by:
+
• get_POLCOMS_meanflow Read mean flow from the PML POLCOMS-ERSEM NetCDF AMM model output files
• get_POLCOMS_tsobc Read temperature and salinity from the PML POLCOMS-ERSEM NetCDF model
• get_POLCOMS_tsobc_gcoms Read temperature and salinity from the PML POLCOMS-ERSEM NetCDF model
• @@ -228,6 +228,6 @@ This function is called by: 0142 if ftbverbose 0143 fprintf(['end : ' subname '\n']) 0144 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_river_discharge.html b/doc/fvcom_prepro/get_POLCOMS_river_discharge.html index da2c377..ad81d58 100644 --- a/doc/fvcom_prepro/get_POLCOMS_river_discharge.html +++ b/doc/fvcom_prepro/get_POLCOMS_river_discharge.html @@ -139,6 +139,6 @@ This function is called by: 0067 if ftbverbose 0068 fprintf(['end : ' subname '\n']) 0069 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_river_positions.html b/doc/fvcom_prepro/get_POLCOMS_river_positions.html index d898712..7220324 100644 --- a/doc/fvcom_prepro/get_POLCOMS_river_positions.html +++ b/doc/fvcom_prepro/get_POLCOMS_river_positions.html @@ -200,6 +200,6 @@ This function is called by: 0129 if ftbverbose 0130 fprintf(['end : ' subname '\n']) 0131 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_sigma.html b/doc/fvcom_prepro/get_POLCOMS_sigma.html index 8489d83..8c41d36 100644 --- a/doc/fvcom_prepro/get_POLCOMS_sigma.html +++ b/doc/fvcom_prepro/get_POLCOMS_sigma.html @@ -151,6 +151,6 @@ This function is called by: 0069 if ftbverbose 0070 fprintf(['end : ' subname '\n']) 0071 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_tsobc.html b/doc/fvcom_prepro/get_POLCOMS_tsobc.html index e772f15..8107429 100644 --- a/doc/fvcom_prepro/get_POLCOMS_tsobc.html +++ b/doc/fvcom_prepro/get_POLCOMS_tsobc.html @@ -453,6 +453,6 @@ This function is called by: 0348 % plot(lon(yidx, xidx), lat(yidx, xidx), 'rs') % polcoms is all backwards 0349 % plot(Mobj.lon(oNodes(nn)), Mobj.lat(oNodes(nn)), 'wo') 0350 % colorbar -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_tsobc_NOCL.html b/doc/fvcom_prepro/get_POLCOMS_tsobc_NOCL.html index 09569d7..2dfe32c 100644 --- a/doc/fvcom_prepro/get_POLCOMS_tsobc_NOCL.html +++ b/doc/fvcom_prepro/get_POLCOMS_tsobc_NOCL.html @@ -453,6 +453,6 @@ This function is called by: 0346 if ftbverbose 0347 fprintf(['end : ' subname '\n']) 0348 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_tsobc_gcoms.html b/doc/fvcom_prepro/get_POLCOMS_tsobc_gcoms.html index 437dafe..b7fcdb0 100644 --- a/doc/fvcom_prepro/get_POLCOMS_tsobc_gcoms.html +++ b/doc/fvcom_prepro/get_POLCOMS_tsobc_gcoms.html @@ -399,6 +399,6 @@ This function is called by: 0307 matlabpool close 0308 end 0309 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLCOMS_tsrestart_NOCL.html b/doc/fvcom_prepro/get_POLCOMS_tsrestart_NOCL.html index 1032d7d..2a93ead 100644 --- a/doc/fvcom_prepro/get_POLCOMS_tsrestart_NOCL.html +++ b/doc/fvcom_prepro/get_POLCOMS_tsrestart_NOCL.html @@ -323,6 +323,6 @@ This function is called by: 0229 if ftbverbose 0230 fprintf(['end : ' subname '\n']) 0231 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_POLPRED_spectide.html b/doc/fvcom_prepro/get_POLPRED_spectide.html index 5853020..8edd70d 100644 --- a/doc/fvcom_prepro/get_POLPRED_spectide.html +++ b/doc/fvcom_prepro/get_POLPRED_spectide.html @@ -266,6 +266,6 @@ This function is called by: 0190 % hold on 0191 % plot(data(point,2), data(point,1), 'rx') 0192 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_cs3x.html b/doc/fvcom_prepro/get_cs3x.html index d0ce354..8acbebb 100644 --- a/doc/fvcom_prepro/get_cs3x.html +++ b/doc/fvcom_prepro/get_cs3x.html @@ -235,6 +235,6 @@ This function is called by: 0162 if(ftbverbose); 0163 fprintf(['end : ' subname '\n']); 0164 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/get_zeta_xtide.html b/doc/fvcom_prepro/get_zeta_xtide.html index 44107cb..9f9d9d4 100755 --- a/doc/fvcom_prepro/get_zeta_xtide.html +++ b/doc/fvcom_prepro/get_zeta_xtide.html @@ -137,6 +137,6 @@ This function is called by: 0069 0070 0071 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/graph.dot b/doc/fvcom_prepro/graph.dot index 543c9ab..b74045a 100644 --- a/doc/fvcom_prepro/graph.dot +++ b/doc/fvcom_prepro/graph.dot @@ -15,7 +15,6 @@ digraph m2html { get_POLCOMS_tsrestart_NOCL -> get_POLCOMS_sigma; hybrid_coordinate -> hybrid_coordinate; hybrid_coordinate -> nodes2elems; - interp_POLCOMS2FVCOM -> get_POLCOMS_netCDF; interp_coarse_to_obc -> nodes2elems; make_model_nml_generic -> make_default_nml; make_model_nml_generic -> write_model_nml; @@ -45,6 +44,7 @@ digraph m2html { add_var_FVCOM_river [URL="add_var_FVCOM_river.html"]; add_weights_FVCOM_nested_forcing [URL="add_weights_FVCOM_nested_forcing.html"]; calc_sponge_radius [URL="calc_sponge_radius.html"]; + change_shallow_bathy [URL="change_shallow_bathy.html"]; create_nesting_nodes [URL="create_nesting_nodes.html"]; elems2nodes [URL="elems2nodes.html"]; estimate_ts [URL="estimate_ts.html"]; @@ -82,8 +82,8 @@ digraph m2html { inCell [URL="inCell.html"]; init_lag [URL="init_lag.html"]; interp_HYCOM2FVCOM [URL="interp_HYCOM2FVCOM.html"]; + interp_NEMO2FVCOM [URL="interp_NEMO2FVCOM.html"]; interp_POLCOMS2FVCOM [URL="interp_POLCOMS2FVCOM.html"]; - interp_POLCOMS2FVCOMv1 [URL="interp_POLCOMS2FVCOMv1.html"]; interp_coarse_to_obc [URL="interp_coarse_to_obc.html"]; interp_sst_assimilation [URL="interp_sst_assimilation.html"]; make_blank_mesh [URL="make_blank_mesh.html"]; diff --git a/doc/fvcom_prepro/graph.html b/doc/fvcom_prepro/graph.html index a026a92..bc1a364 100644 --- a/doc/fvcom_prepro/graph.html +++ b/doc/fvcom_prepro/graph.html @@ -136,6 +136,6 @@ -
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/hybrid_coordinate.html b/doc/fvcom_prepro/hybrid_coordinate.html index 26ef0b6..17b401c 100644 --- a/doc/fvcom_prepro/hybrid_coordinate.html +++ b/doc/fvcom_prepro/hybrid_coordinate.html @@ -217,12 +217,12 @@ This function is called by: 0109 % Add the thicknesses with a loop. 0110 fprintf(fout, 'ZKU = '); 0111 for ii = 1:length(ZKU) -0112 fprintf(fout, '%4.1f', ZKU(ii)); +0112 fprintf(fout, '%4.1f ', ZKU(ii)); 0113 end 0114 fprintf(fout, '\n'); 0115 fprintf(fout, 'ZKL = '); 0116 for ii = 1:length(ZKL) -0117 fprintf(fout, '%4.1f', ZKL(ii)); +0117 fprintf(fout, '%4.1f ', ZKL(ii)); 0118 end 0119 fprintf(fout,'\n'); 0120 fclose(fout); @@ -263,7 +263,7 @@ This function is called by: 0155 Mobj.siglayz = repmat(Mobj.h, 1, nlev-1) .* Mobj.siglay; 0156 Mobj.siglevzc = repmat(Mobj.hc, 1, nlev) .* Mobj.siglevc; 0157 Mobj.siglayzc = repmat(Mobj.hc, 1, nlev-1) .* Mobj.siglayc; -0158 +0158 Mobj.Hmin = Hmin; 0159 if ftbverbose 0160 fprintf('done.\n') 0161 fprintf('end : %s\n', subname) @@ -377,6 +377,6 @@ This function is called by: 0269 plot(y,ones(size(y)).*-Hmin) 0270 fprintf('Calculated minimum depth: %.2f\n', Hmin) 0271 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/inCell.html b/doc/fvcom_prepro/inCell.html index 2e2449b..f0589a9 100755 --- a/doc/fvcom_prepro/inCell.html +++ b/doc/fvcom_prepro/inCell.html @@ -119,6 +119,6 @@ This function is called by: 0052 0053 % didn't find cell, just return nearest cell 0054 %cell = ind(1); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/index.html b/doc/fvcom_prepro/index.html index 82b1a52..8f51da6 100755 --- a/doc/fvcom_prepro/index.html +++ b/doc/fvcom_prepro/index.html @@ -19,7 +19,7 @@

## Matlab files in this directory:

-
-
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/init_lag.html b/doc/fvcom_prepro/init_lag.html index 6ec8f30..7ba6e69 100644 --- a/doc/fvcom_prepro/init_lag.html +++ b/doc/fvcom_prepro/init_lag.html @@ -208,6 +208,6 @@ This function is called by: 0126 netcdf.close(nc); 0127 0128 if ftbverbose; fprintf('end : %s\n', subname); end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/interp_HYCOM2FVCOM.html b/doc/fvcom_prepro/interp_HYCOM2FVCOM.html index 3529b56..6f16463 100644 --- a/doc/fvcom_prepro/interp_HYCOM2FVCOM.html +++ b/doc/fvcom_prepro/interp_HYCOM2FVCOM.html @@ -429,6 +429,6 @@ This function is called by: 0322 % hold on 0323 % plot(lon(ri, ci), lat(ri, ci), 'ko', 'MarkerFaceColor', 'w') 0324 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/interp_NEMO2FVCOM.html b/doc/fvcom_prepro/interp_NEMO2FVCOM.html new file mode 100644 index 0000000..2bb6089 --- /dev/null +++ b/doc/fvcom_prepro/interp_NEMO2FVCOM.html @@ -0,0 +1,417 @@ + + + + Description of interp_NEMO2FVCOM + + + + + + + + + +
Home > fvcom_prepro > interp_NEMO2FVCOM.m
+ + + +

# interp_NEMO2FVCOM +

+ +

## PURPOSE

+
Use an FVCOM restart file to seed a model run with spatially varying
+ +

## SYNOPSIS

+
function Mobj = interp_NEMO2FVCOM(Mobj, nemo, start_date, varlist)
+ +

## DESCRIPTION

+
``` Use an FVCOM restart file to seed a model run with spatially varying
+ versions of otherwise constant variables.
+
+ function interp_NEMO2FVCOM(Mobj, nemo, start_date, varlist)
+
+ DESCRIPTION:
+    FVCOM does not yet support spatially varying initial conditions. To
+    avoid having to run a model for a long time in order for temperature
+    and salinity to settle within the model from the atmospheric and
+    boundary forcing, we can use a restart file to cheat. For this, we
+    need variables interpolated onto the unstructured grid. The
+    interpolated data can then be written out with write_FVCOM_restart.m.
+
+ INPUT:
+   Mobj        = MATLAB mesh structure which must contain:
+                   - Mobj.lon, Mobj.lat and/or Mobj.lonc, Mobj.latc - node
+                   or element centre coordinates (long/lat). Dependent on
+                   the variable being interpolated (u and v need lonc,
+                   latc whilst temperature and salinity need lat and lon).
+                   - Mobj.siglayz - sigma layer depths for all model
+                   nodes.
+                   - Mobj.ts_times - Modified Julian Day times for the
+                   model run.
+   nemo        = Struct output from some other function. Must include
+                 fields:
+                   - nemo.lon, nemo.lat - rectangular arrays.
+                   - nemo.Depth - NEMO depth levels.
+   start_date  = Gregorian start date array (YYYY, MM, DD, hh, mm, ss).
+   varlist     = cell array of fields to use from the NEMO struct.
+
+ OUTPUT:
+   Mobj.restart = struct whose field names are the variables which have
+   been interpolated (e.g. Mobj.restart.temperature for NEMO
+   temperature).
+
+ EXAMPLE USAGE
+   interp_NEMO2FVCOM(Mobj, nemo, [2006, 01, 01, 00, 00, 00], ...
+       {'lon', 'lat', 'time', 'temperature', 'salinity'})
+
+ Author(s):
+   Ricardo Torres (Plymouth Marine Laboratory)
+   Pierre Cazenave (Plymouth Marine Laboratory)
+
+ Revision history
+   2018-05-23 First version based on interp_HYCOMS2FVCOM.m.
+
+==========================================================================```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function Mobj = interp_NEMO2FVCOM(Mobj, nemo, start_date, varlist)
+0002 % Use an FVCOM restart file to seed a model run with spatially varying
+0003 % versions of otherwise constant variables.
+0004 %
+0005 % function interp_NEMO2FVCOM(Mobj, nemo, start_date, varlist)
+0006 %
+0007 % DESCRIPTION:
+0008 %    FVCOM does not yet support spatially varying initial conditions. To
+0009 %    avoid having to run a model for a long time in order for temperature
+0010 %    and salinity to settle within the model from the atmospheric and
+0011 %    boundary forcing, we can use a restart file to cheat. For this, we
+0012 %    need variables interpolated onto the unstructured grid. The
+0013 %    interpolated data can then be written out with write_FVCOM_restart.m.
+0014 %
+0015 % INPUT:
+0016 %   Mobj        = MATLAB mesh structure which must contain:
+0017 %                   - Mobj.lon, Mobj.lat and/or Mobj.lonc, Mobj.latc - node
+0018 %                   or element centre coordinates (long/lat). Dependent on
+0019 %                   the variable being interpolated (u and v need lonc,
+0020 %                   latc whilst temperature and salinity need lat and lon).
+0021 %                   - Mobj.siglayz - sigma layer depths for all model
+0022 %                   nodes.
+0023 %                   - Mobj.ts_times - Modified Julian Day times for the
+0024 %                   model run.
+0025 %   nemo        = Struct output from some other function. Must include
+0026 %                 fields:
+0027 %                   - nemo.lon, nemo.lat - rectangular arrays.
+0028 %                   - nemo.Depth - NEMO depth levels.
+0029 %   start_date  = Gregorian start date array (YYYY, MM, DD, hh, mm, ss).
+0030 %   varlist     = cell array of fields to use from the NEMO struct.
+0031 %
+0032 % OUTPUT:
+0033 %   Mobj.restart = struct whose field names are the variables which have
+0034 %   been interpolated (e.g. Mobj.restart.temperature for NEMO
+0035 %   temperature).
+0036 %
+0037 % EXAMPLE USAGE
+0038 %   interp_NEMO2FVCOM(Mobj, nemo, [2006, 01, 01, 00, 00, 00], ...
+0039 %       {'lon', 'lat', 'time', 'temperature', 'salinity'})
+0040 %
+0041 % Author(s):
+0042 %   Ricardo Torres (Plymouth Marine Laboratory)
+0043 %   Pierre Cazenave (Plymouth Marine Laboratory)
+0044 %
+0045 % Revision history
+0046 %   2018-05-23 First version based on interp_HYCOMS2FVCOM.m.
+0047 %
+0048 %==========================================================================
+0049
+0050 subname = 'interp_NEMO2FVCOM';
+0051
+0052 global ftbverbose
+0053 if ftbverbose
+0054     fprintf('\nbegin : %s\n', subname)
+0055 end
+0056
+0057 if nargin == 0
+0058     error('Not enough input arguments. See HELP %s', subname)
+0059 end
+0060
+0061 % Run jobs on multiple workers if we have that functionality. Not sure if
+0062 % it's necessary, but check we have the Parallel Toolbox first.
+0063 wasOpened = false;
+0065     % We have the Parallel Computing Toolbox, so launch a bunch of workers.
+0066     % New version for MATLAB 2014a (I think) onwards.
+0067     if isempty(gcp('nocreate'))
+0068         pool = parpool('local');
+0069         wasOpened = true;
+0070     end
+0071 end
+0072
+0073 % Given our input time (in start_date), find the nearest time index for
+0074 % the NEMO data.
+0075 stime = greg2mjulian(start_date(1), start_date(2), ...
+0076     start_date(3), start_date(4), ...
+0077     start_date(5), start_date(6));
+0078 [~, tidx] = min(abs(nemo.time - stime));
+0079
+0080 for vv = 1:length(varlist)
+0081
+0082     currvar = varlist{vv};
+0083
+0084     switch currvar
+0085         case {'lon', 'lat', 'longitude', 'latitude', 't_1', 'time', 'Depth', 'MT'}
+0086             continue
+0087
+0088         otherwise
+0089             %--------------------------------------------------------------
+0090             % Interpolate the regularly gridded data onto the FVCOM grid
+0091             % (vertical grid first).
+0092             %--------------------------------------------------------------
+0093
+0094             tic
+0095
+0096             % Set up all the constants which are based on the model and
+0097             % data grids.
+0098             [~, fz] = size(Mobj.siglayz);
+0099             if strcmpi(currvar, 'u') || strcmpi(currvar, 'v')
+0100                 plon = nemo.lon(:);
+0101                 plat = nemo.lat(:);
+0102                 flon = Mobj.lonc;
+0103                 flat = Mobj.latc;
+0104                 fn = numel(flon);
+0105                 fvtemp = nan(fn, fz);
+0106             else
+0107                 plon = nemo.lon(:);
+0108                 plat = nemo.lat(:);
+0109                 flon = Mobj.lon;
+0110                 flat = Mobj.lat;
+0111                 fn = numel(flon);
+0112                 fvtemp = nan(fn, fz);
+0113             end
+0114
+0115             if ftbverbose
+0116                 fprintf('%s : interpolate %s ... ', subname, currvar)
+0117             end
+0118
+0119             % Calculate resolution of parent coarse model
+0120             hdx = max([max(diff(plon(:, 1))), max(diff(plat(1, :)))]);
+0121
+0122             xlimits = [min(flon) - 3 * hdx, max(flon) + 3 * hdx];
+0123             ylimits = [min(flat) - 3 * hdx, max(flat) + 3 * hdx];
+0124             xidxgood = find(nemo.lon<xlimits(2) & nemo.lon>xlimits(1) & nemo.lat<ylimits(2) & nemo.lat>ylimits(1));
+0125
+0126             hdepth = nemo.Depth;
+0127
+0128             % Do not interpolate 2D variables in depth.
+0129             if ~ismatrix(nemo.(currvar))
+0130                 hyinterp.(currvar) = grid_vert_interp(Mobj, ...
+0131                     nemo.lon, nemo.lat, ...
+0132                     squeeze(nemo.(currvar)(:, :, :, tidx)), ...
+0134                     [flon, flat]);
+0135
+0136                 %----------------------------------------------------------
+0137                 % Now we have vertically interpolated data, we can
+0138                 % interpolate each sigma layer onto the FVCOM unstructured
+0139                 % grid ready to write out to NetCDF. We'll use the
+0140                 % triangular interpolation in MATLAB with the natural
+0141                 % method (gives pretty good results, at least
+0142                 % qualitatively).
+0143                 %----------------------------------------------------------
+0144
+0145                 if ftbverbose
+0146                     fprintf('horizontally... ')
+0147                 end
+0148
+0149                 hytempz = hyinterp.(currvar);
+0150
+0151                 parfor zi = 1:fz
+0152                     % Get the current depth layer's data and mask out the
+0153                     % NaN values.
+0154                     hytempzcurrent = hytempz(:, :, zi);
+0155
+0156                     % Strip out NaNs so we can extrapolate with
+0157                     % TriScatteredInterp.
+0162                     % Set up the interpolation object and interpolate the
+0163                     % current variable to the FVCOM unstructured grid.
+0164                     ft = scatteredInterpolant(plonclean, platclean, ...
+0165                         hytempzclean, 'natural', 'none');
+0166                     fvtemp(:, zi) = ft(flon, flat);
+0167                 end
+0168             else
+0169                 % Remove points outside our area of interest and
+0170                 % interpolate this non-depth-resolved data.
+0171                 datatmp = nemo.(currvar)(xidxgood);
+0172                 plon = nemo.lon(xidxgood);
+0173                 plat = nemo.lat(xidxgood);
+0174                 % Strip out NaNs so we can extrapolate with
+0175                 % TriScatteredInterp.
+0180
+0181                 ft = scatteredInterpolant(plonclean, platclean, ...
+0182                     hytempzclean, 'natural', 'none');
+0183                 fvtemp = ft(flon, flat);
+0184             end
+0185
+0186             % Unfortunately, TriScatteredInterp won't extrapolate,
+0187             % returning instead NaNs outside the original data's extents.
+0188             % So, for each NaN position, find the nearest non-NaN value and
+0189             % use that instead. The order in which the NaN-nodes are found
+0190             % will determine the spatial pattern of the extrapolation.
+0191
+0192             % We can assume that all layers will have NaNs in the same
+0193             % place (horizontally), so just use the surface layer (1) for
+0194             % the identification of NaNs. Also store the finite values so
+0195             % we can find the nearest real value to the current NaN node
+0196             % and use its temperature and salinity values.
+0197             fvidx = 1:fn;
+0198             fvnanidx = fvidx(isnan(fvtemp(:, 1)));
+0199             fvfinidx = fvidx(~isnan(fvtemp(:, 1)));
+0200             if isfield(Mobj,'dist')
+0201                 [~,idx2coast]=sort(Mobj.dist(fvnanidx),'descend');
+0202                 fvnanidx = fvnanidx(idx2coast);
+0203             end
+0204             for ni = 1:length(fvnanidx)
+0205                 % Find the nearest non-nan data (temp, salinity, u or v)
+0206                 % value.
+0207                 xx = flon(fvnanidx(ni));
+0208                 yy = flat(fvnanidx(ni));
+0209
+0210                 [~, di] = min(sqrt((flon(fvfinidx) - xx).^2 + (flat(fvfinidx) - yy).^2));
+0211                 fvtemp(fvnanidx(ni), :) = fvtemp(fvfinidx(di), :);
+0212                 fvfinidx = fvidx(~isnan(fvtemp(:, 1)));
+0213
+0214             end
+0215
+0216             clear plon plat flon flat ptempz
+0217
+0218             Mobj.restart.(currvar) = fvtemp;
+0219
+0220             te = toc;
+0221
+0222             if ftbverbose
+0223                 fprintf('done. (elapsed time = %.2f seconds)\n', te)
+0224             end
+0225
+0226     end
+0227 end
+0228
+0229 % Close the MATLAB pool if we opened it.
+0230 if wasOpened
+0231     pool.delete
+0232 end
+0233
+0234 if ftbverbose
+0235     fprintf('end   : %s\n', subname)
+0236 end
+0237
+0238 %% Debugging figure
+0239
+0240 % close all
+0241 %
+0242 % ri = 85; % column index
+0243 % ci = 95; % row index
+0244 %
+0245 % [~, idx] = min(sqrt((Mobj.lon - lon(ri, ci)).^2 + (Mobj.lat - lat(ri, ci)).^2));
+0246 %
+0247 % % Vertical profiles
+0248 % figure
+0249 % clf
+0250 %
+0251 % % The top row shows the temperature/salinity values as plotted against
+0252 % % index (i.e. position in the array). I had thought POLCOMS stored its data
+0253 % % from seabed to sea surface, but looking at the NetCDF files in ncview,
+0254 % % it's clear that the data are in fact stored surface to seabed (like
+0255 % % FVCOM). As such, the two plots in the top row should be upside down (i.e.
+0256 % % surface values at the bottom of the plot). The two lower rows should have
+0257 % % three lines which all match: the raw POLCOMS data, the POLCOMS data for
+0258 % % the current time step (i.e. that in 'temperature' and 'salinity') and the
+0259 % % interpolated FVCOM data against depth.
+0260 % %
+0261 % % Also worth noting, the pc.* have the rows and columns flipped, so
+0262 % % (ci, ri) in pc.* and (ri, ci) in 'temperature', 'salinity' and
+0263 % % 'depth'. Needless to say, the two lines in the lower plots should
+0264 % % overlap.
+0265 %
+0266 % subplot(2,2,1)
+0267 % plot(squeeze(pc.ETWD(ci, ri, :, tidx)), 1:size(depth, 3), 'rx:')
+0268 % xlabel('Temperature (^{\circ}C)')
+0269 % ylabel('Array index')
+0270 % title('Array Temperature')
+0271 %
+0272 % subplot(2,2,2)
+0273 % plot(squeeze(pc.x1XD(ci, ri, :, tidx)), 1:size(depth, 3), 'rx:')
+0274 % xlabel('Salinity')
+0275 % ylabel('Array index')
+0276 % title('Array Salinity')
+0277 %
+0278 % subplot(2,2,3)
+0279 % % Although POLCOMS stores its temperature values from seabed to surface,
+0280 % % the depths are stored surface to seabed. Nice. Flip the
+0281 % % temperature/salinity data accordingly. The lines here should match one
+0282 % % another.
+0283 % plot(squeeze(pc.ETWD(ci, ri, :, tidx)), squeeze(pc.depth(ci, ri, :, tidx)), 'rx-')
+0284 % hold on
+0285 % plot(squeeze(temperature(ri, ci, :)), squeeze(depth(ri, ci, :)), '.:')
+0286 % % Add the equivalent interpolated FVCOM data point
+0287 % plot(fvtemp(idx, :), Mobj.siglayz(idx, :), 'g.-')
+0288 % xlabel('Temperature (^{\circ}C)')
+0289 % ylabel('Depth (m)')
+0290 % title('Depth Temperature')
+0291 % legend('pc', 'temp', 'fvcom', 'location', 'north')
+0292 % legend('boxoff')
+0293 %
+0294 % subplot(2,2,4)
+0295 % % Although POLCOMS stores its temperature values from seabed to surface,
+0296 % % the depths are stored surface to seabed. Nice. Flip the
+0297 % % temperature/salinity data accordingly. The lines here should match one
+0298 % % another.
+0299 % plot(squeeze(pc.x1XD(ci, ri, :, tidx)), squeeze(pc.depth(ci, ri, :, tidx)), 'rx-')
+0300 % hold on
+0301 % plot(squeeze(salinity(ri, ci, :)), squeeze(depth(ri, ci, :)), '.:')
+0302 % % Add the equivalent interpolated FVCOM data point
+0303 % plot(fvsalt(idx, :), Mobj.siglayz(idx, :), 'g.-')
+0304 % xlabel('Salinity')
+0305 % ylabel('Depth (m)')
+0306 % title('Depth Salinity')
+0307 % legend('pc', 'salt', 'fvcom', 'location', 'north')
+0308 % legend('boxoff')
+0309 %
+0310 % %% Plot the sample location
+0311 % figure
+0312 % dx = mean(diff(pc.lon));
+0313 % dy = mean(diff(pc.lat));
+0314 % z = depth(:, :, end); % water depth (bottom layer depth)
+0315 % z(mask) = 0; % clear out nonsense values
+0316 % pcolor(lon - (dx / 2), lat - (dy / 2), z)
+0318 % axis('equal', 'tight')
+0319 % daspect([1.5, 1, 1])
+0320 % colorbar
+0321 % caxis([-150, 0])
+0322 % hold on
+0323 % plot(lon(ri, ci), lat(ri, ci), 'ko', 'MarkerFaceColor', 'w')
+0324```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/fvcom_prepro/interp_POLCOMS2FVCOM.html b/doc/fvcom_prepro/interp_POLCOMS2FVCOM.html index de8b1ee..73fa891 100644 --- a/doc/fvcom_prepro/interp_POLCOMS2FVCOM.html +++ b/doc/fvcom_prepro/interp_POLCOMS2FVCOM.html @@ -24,13 +24,13 @@
Use an FVCOM restart file to seed a model run with spatially varying

## SYNOPSIS

-
function Mobj = interp_POLCOMS2FVCOM(Mobj, ts, start_date, varlist)
+
function Mobj = interp_POLCOMS2FVCOMv1(Mobj, hycom, start_date, varlist)

## DESCRIPTION

``` Use an FVCOM restart file to seed a model run with spatially varying
versions of otherwise constant variables.

- function interp_POLCOMS2FVCOM(Mobj, ts, start_date, varlist)
+ function interp_HYCOM2FVCOM(Mobj, hycom, start_date, varlist)

DESCRIPTION:
FVCOM does not yet support spatially varying temperature and salinity
@@ -44,39 +44,45 @@

INPUT:
Mobj        = MATLAB mesh structure which must contain:
+                   - Mobj.lon, Mobj.lat and/or Mobj.lonc, Mobj.latc - node
+                   or element centre coordinates (long/lat). Dependent on
+                   the variable being interpolated (u and v need lonc,
+                   latc whilst temperature and salinity need lat and lon).
- Mobj.siglayz - sigma layer depths for all model
nodes.
-                   - Mobj.lon, Mobj.lat - node coordinates (long/lat)
-                   - Mobj.lonc, Mobj.latc - element coordinates (long/lat)
-   ts          = Cell array of POLCOMS AMM NetCDF file(s) in which 4D
-   variables of temperature and salinity (called 'ETWD' and 'x1XD') exist.
-   Its/their shape should be (y, x, sigma, time).
+                   - Mobj.ts_times - Modified Julian Day times for the
+                   model run.
+   hycom       = Struct output by get_HYCOM_forcing. Must include fields:
+                   - hycom.lon, hycom.lat - rectangular arrays.
+                   - hycom.Depth - HYCOM depth levels.
start_date  = Gregorian start date array (YYYY, MM, DD, hh, mm, ss).
-   varlist     = cell array of variables to extract from the NetCDF files.
+   varlist     = cell array of fields to use from the HYCOM struct.

OUTPUT:
Mobj.restart = struct whose field names are the variables which have
-   been interpolated (e.g. Mobj.restart.ETWD for POLCOMS daily mean
+   been interpolated (e.g. Mobj.restart.temperature for HYCOM
temperature).

EXAMPLE USAGE
-   interp_POLCOMS2FVCOM(Mobj, '/tmp/ts.nc', [2006, 01, 01, 00, 00, 00], ...
-       {'lon', 'lat', 'ETWD', 'x1XD', 'ucurD', 'vcurD', 'rholocalD', 'time'})
+   interp_HYCOM2FVCOM(Mobj, hycom, [2006, 01, 01, 00, 00, 00], ...
+       {'lon', 'lat', 'time', 'temperature', 'salinity'})

Author(s):
Pierre Cazenave (Plymouth Marine Laboratory)

Revision history
-   2013-02-08 First version.
-   2013-05-16 Add support for parallel for-loops (not mandatory, but
-   enabled if the Parallel Computing Toolbox is available).
-   2013-06-06 Fix the vertical ordering of the POLCOMS data. POLCOMS'
-   scalar values (temperature, salinity etc.) are stored seabed to
-   surface; its depths are stored surface to seabed; FVCOM stores
-   everything surface to seabed. As such, the POLCOMS scalar values need
-   to be flipped upside down to match everything else.
-   2013-07-30 Add density and u/v velocity components to the variables to
-   interpolate.
+   2013-09-10 First version based on interp_POLCOMS2FVCOM.m.
+   2013-12-10 Fix the identification of the time index in the HYCOM data
+   (use hycom.time instead of Mobj.ts_times). Also ignore a field name of
+   'MT' if supplied in varlist.
+   2014-04-28 Fix bug when interpolating velocity data due to incorrectly
+   sized preallocated array. Make the way the data to be interpolated onto
+   the element centres (i.e. the velocity data), as opposed to the element
+   nodes, more understandable. This is done by having a single block which
+   deals with setting up the variables dependent on the number of points
+   onto which to interpolate. Also update the parallel pool code to use
+   the new parpool function instead of matlabpool in anticipation of the
+   latter's eventual removal from MATLAB.

==========================================================================```
@@ -84,7 +90,7 @@

## CROSS-REFERENCE INFORMATION

This function calls:
+ This function is called by:
@@ -93,11 +99,11 @@ This function is called by:

## SOURCE CODE

-
```0001 function Mobj = interp_POLCOMS2FVCOM(Mobj, ts, start_date, varlist)
+0001 function Mobj = interp_POLCOMS2FVCOMv1(Mobj, hycom, start_date, varlist)
0002 % Use an FVCOM restart file to seed a model run with spatially varying
0003 % versions of otherwise constant variables.
0004 %
-0005 % function interp_POLCOMS2FVCOM(Mobj, ts, start_date, varlist)
+0005 % function interp_HYCOM2FVCOM(Mobj, hycom, start_date, varlist)
0006 %
0007 % DESCRIPTION:
0008 %    FVCOM does not yet support spatially varying temperature and salinity
@@ -111,313 +117,307 @@ This function is called by:
0016 %
0017 % INPUT:
0018 %   Mobj        = MATLAB mesh structure which must contain:
-0019 %                   - Mobj.siglayz - sigma layer depths for all model
-0020 %                   nodes.
-0021 %                   - Mobj.lon, Mobj.lat - node coordinates (long/lat)
-0022 %                   - Mobj.lonc, Mobj.latc - element coordinates (long/lat)
-0023 %   ts          = Cell array of POLCOMS AMM NetCDF file(s) in which 4D
-0024 %   variables of temperature and salinity (called 'ETWD' and 'x1XD') exist.
-0025 %   Its/their shape should be (y, x, sigma, time).
-0026 %   start_date  = Gregorian start date array (YYYY, MM, DD, hh, mm, ss).
-0027 %   varlist     = cell array of variables to extract from the NetCDF files.
-0028 %
-0029 % OUTPUT:
-0030 %   Mobj.restart = struct whose field names are the variables which have
-0031 %   been interpolated (e.g. Mobj.restart.ETWD for POLCOMS daily mean
-0032 %   temperature).
-0033 %
-0034 % EXAMPLE USAGE
-0035 %   interp_POLCOMS2FVCOM(Mobj, '/tmp/ts.nc', [2006, 01, 01, 00, 00, 00], ...
-0036 %       {'lon', 'lat', 'ETWD', 'x1XD', 'ucurD', 'vcurD', 'rholocalD', 'time'})
+0019 %                   - Mobj.lon, Mobj.lat and/or Mobj.lonc, Mobj.latc - node
+0020 %                   or element centre coordinates (long/lat). Dependent on
+0021 %                   the variable being interpolated (u and v need lonc,
+0022 %                   latc whilst temperature and salinity need lat and lon).
+0023 %                   - Mobj.siglayz - sigma layer depths for all model
+0024 %                   nodes.
+0025 %                   - Mobj.ts_times - Modified Julian Day times for the
+0026 %                   model run.
+0027 %   hycom       = Struct output by get_HYCOM_forcing. Must include fields:
+0028 %                   - hycom.lon, hycom.lat - rectangular arrays.
+0029 %                   - hycom.Depth - HYCOM depth levels.
+0030 %   start_date  = Gregorian start date array (YYYY, MM, DD, hh, mm, ss).
+0031 %   varlist     = cell array of fields to use from the HYCOM struct.
+0032 %
+0033 % OUTPUT:
+0034 %   Mobj.restart = struct whose field names are the variables which have
+0035 %   been interpolated (e.g. Mobj.restart.temperature for HYCOM
+0036 %   temperature).
0037 %
-0038 % Author(s):
-0039 %   Pierre Cazenave (Plymouth Marine Laboratory)
-0040 %
-0041 % Revision history
-0042 %   2013-02-08 First version.
-0043 %   2013-05-16 Add support for parallel for-loops (not mandatory, but
-0044 %   enabled if the Parallel Computing Toolbox is available).
-0045 %   2013-06-06 Fix the vertical ordering of the POLCOMS data. POLCOMS'
-0046 %   scalar values (temperature, salinity etc.) are stored seabed to
-0047 %   surface; its depths are stored surface to seabed; FVCOM stores
-0048 %   everything surface to seabed. As such, the POLCOMS scalar values need
-0049 %   to be flipped upside down to match everything else.
-0050 %   2013-07-30 Add density and u/v velocity components to the variables to
-0051 %   interpolate.
-0052 %
-0053 %==========================================================================
-0054
-0055 subname = 'interp_POLCOMS2FVCOM';
-0056
-0057 global ftbverbose;
-0058 if ftbverbose
-0059     fprintf('\nbegin : %s\n', subname)
-0060 end
-0061
-0062 % Run jobs on multiple workers if we have that functionality. Not sure if
-0063 % it's necessary, but check we have the Parallel Toolbox first.
-0064 wasOpened = false;
-0066     % We have the Parallel Computing Toolbox, so launch a bunch of workers.
-0067     if matlabpool('size') == 0
-0068         % Force pool to be local in case we have remote pools available.
-0069         matlabpool open local
-0070         wasOpened = true;
-0071     end
-0072 end
-0073
-0074 %--------------------------------------------------------------------------
-0075 % Extract the NetCDF data specified in varlist
-0076 %--------------------------------------------------------------------------
-0077
-0078 % Data format:
-0079 %
-0080 %   pc.ETWD.data and pc.x1XD.data are y, x, sigma, time
-0081 %
-0082 pc = get_POLCOMS_netCDF(ts, varlist);
+0038 % EXAMPLE USAGE
+0039 %   interp_HYCOM2FVCOM(Mobj, hycom, [2006, 01, 01, 00, 00, 00], ...
+0040 %       {'lon', 'lat', 'time', 'temperature', 'salinity'})
+0041 %
+0042 % Author(s):
+0043 %   Pierre Cazenave (Plymouth Marine Laboratory)
+0044 %
+0045 % Revision history
+0046 %   2013-09-10 First version based on interp_POLCOMS2FVCOM.m.
+0047 %   2013-12-10 Fix the identification of the time index in the HYCOM data
+0048 %   (use hycom.time instead of Mobj.ts_times). Also ignore a field name of
+0049 %   'MT' if supplied in varlist.
+0050 %   2014-04-28 Fix bug when interpolating velocity data due to incorrectly
+0051 %   sized preallocated array. Make the way the data to be interpolated onto
+0052 %   the element centres (i.e. the velocity data), as opposed to the element
+0053 %   nodes, more understandable. This is done by having a single block which
+0054 %   deals with setting up the variables dependent on the number of points
+0055 %   onto which to interpolate. Also update the parallel pool code to use
+0056 %   the new parpool function instead of matlabpool in anticipation of the
+0057 %   latter's eventual removal from MATLAB.
+0058 %
+0059 %==========================================================================
+0060
+0061 subname = 'interp_POLCOMS2FVCOMv1';
+0062
+0063 global ftbverbose;
+0064 if ftbverbose
+0065     fprintf('\nbegin : %s\n', subname)
+0066 end
+0067
+0068 if nargin == 0
+0069     error('Not enough input arguments. See HELP %s', subname)
+0070 end
+0071
+0072 % Run jobs on multiple workers if we have that functionality. Not sure if
+0073 % it's necessary, but check we have the Parallel Toolbox first.
+0074 wasOpened = false;
+0076     % We have the Parallel Computing Toolbox, so launch a bunch of workers.
+0077     % New version for MATLAB 2014a (I think) onwards.
+0078     if isempty(gcp('nocreate'))
+0079         pool = parpool('local');
+0080         wasOpened = true;
+0081     end
+0082 end
0083
-0084 % Number of sigma layers.
-0085 [fn, fz] = size(Mobj.siglayz);
-0086 fe = numel(Mobj.lonc);
-0087
-0088 % Make rectangular arrays for the nearest point lookup.
-0089 [lon, lat] = meshgrid(pc.lon.data, pc.lat.data);
+0084 % Given our input time (in start_date), find the nearest time index for
+0085 % the HYCOM data.
+0086 stime = greg2mjulian(start_date(1), start_date(2), ...
+0087     start_date(3), start_date(4), ...
+0088     start_date(5), start_date(6));
+0089 [~, tidx] = min(abs(hycom.time - stime));
0090
-0091 % Convert the current times to Modified Julian Day (this is a bit ugly).
-0092 pc.time.all = strtrim(regexp(pc.time.units, 'since', 'split'));
-0093 pc.time.datetime = strtrim(regexp(pc.time.all{end}, ' ', 'split'));
-0094 pc.time.ymd = str2double(strtrim(regexp(pc.time.datetime{1}, '-', 'split')));
-0095 pc.time.hms = str2double(strtrim(regexp(pc.time.datetime{2}, ':', 'split')));
-0096
-0097 Mobj.ts_times = greg2mjulian(...
-0098     pc.time.ymd(1), ...
-0099     pc.time.ymd(2), ...
-0100     pc.time.ymd(3), ...
-0101     pc.time.hms(1), ...
-0102     pc.time.hms(2), ...
-0103     pc.time.hms(3)) + (pc.time.data / 3600 / 24);
-0104
-0105 % Given our intput time (in start_date), find the nearest time
-0106 % index for the regularly gridded data.
-0107 stime = greg2mjulian(start_date(1), start_date(2), ...
-0108     start_date(3), start_date(4), ...
-0109     start_date(5), start_date(6));
-0110 [~, tidx] = min(abs(Mobj.ts_times - stime));
-0111
-0112 %--------------------------------------------------------------------------
-0113 % Interpolate the regularly gridded data onto the FVCOM grid (vertical grid
-0114 % first).
-0115 %--------------------------------------------------------------------------
-0116
-0117 if ftbverbose
-0118     fprintf('%s : interpolate POLCOMS onto FVCOM''s vertical grid... ', subname)
-0119 end
-0120
-0121 % Permute the arrays to be x by y rather than y by x.
-0122 temperature = permute(squeeze(pc.ETWD.data(:, :, :, tidx)), [2, 1, 3]);
-0123 salinity = permute(squeeze(pc.x1XD.data(:, :, :, tidx)), [2, 1, 3]);
-0124 density = permute(squeeze(pc.rholocalD.data(:, :, :, tidx)), [2, 1, 3]);
-0125 u = permute(squeeze(pc.ucurD.data(:, :, :, tidx)), [2, 1, 3]);
-0126 v = permute(squeeze(pc.vcurD.data(:, :, :, tidx)), [2, 1, 3]);
-0127 depth = permute(squeeze(pc.depth.data(:, :, :, tidx)), [2, 1, 3]);
-0128 mask = depth(:, :, end) >= 0; % land is positive.
-0129
-0130 pc.tempz = grid_vert_interp(Mobj, lon, lat, temperature, depth, mask);
-0131 pc.salz = grid_vert_interp(Mobj, lon, lat, salinity, depth, mask);
-0132 pc.denz = grid_vert_interp(Mobj, lon, lat, density, depth, mask);
-0133 pc.uvelz = grid_vert_interp(Mobj, lon, lat, u, depth, mask);
-0134 pc.vvelz = grid_vert_interp(Mobj, lon, lat, v, depth, mask);
+0091 for vv = 1:length(varlist);
+0092
+0093     currvar = varlist{vv};
+0094
+0095     switch currvar
+0096         case {'lon', 'lat', 'longitude', 'latitude', 't_1', 'time', 'Depth', 'MT'}
+0097             continue
+0098
+0099         otherwise
+0100
+0101             %--------------------------------------------------------------
+0102             % Interpolate the regularly gridded data onto the FVCOM grid
+0103             % (vertical grid first).
+0104             %--------------------------------------------------------------
+0105
+0106             % Set up all the constants which are based on the model and
+0107             % data grids.
+0108             [~, fz] = size(Mobj.siglayz);
+0109             if strcmpi(currvar, 'u') || strcmpi(currvar, 'v')
+0110                 plon = hycom.lon(:);
+0111                 plat = hycom.lat(:);
+0112                 flon = Mobj.lonc;
+0113                 flat = Mobj.latc;
+0114                 fn = numel(flon);
+0115                 fvtemp = nan(fn, fz);
+0116             else
+0117                 plon = hycom.lon(:);
+0118                 plat = hycom.lat(:);
+0119                 flon = Mobj.lon;
+0120                 flat = Mobj.lat;
+0121                 fn = numel(flon);
+0122                 fvtemp = nan(fn, fz);
+0123             end
+0124
+0125             if ftbverbose
+0126                 fprintf('%s : interpolate %s vertically... ', subname, currvar)
+0127             end
+0128
+0129             [hx, hy, ~, ~] = size(hycom.(currvar));
+0130             hdepth = hycom.Depth;
+0131             % Make a land mask of the HYCOM domain (based on the surface
+0132             % layer from the first time step).
+0133             landmask = isnan(hycom.(currvar)(:, :, 1, 1));
+0134
0135
-0136 if ftbverbose
-0137     fprintf('done.\n')
-0138 end
-0139
-0140 %--------------------------------------------------------------------------
-0141 % Now we have vertically interpolated data, we can interpolate each sigma
-0142 % layer onto the FVCOM unstructured grid ready to write out to NetCDF.
-0143 % We'll use the triangular interpolation in MATLAB with the natural method
-0144 % (gives pretty good results, at least qualitatively).
-0145 %--------------------------------------------------------------------------
-0146
-0147 if ftbverbose
-0148     fprintf('%s : interpolate POLCOMS onto FVCOM''s horizontal grid... ', subname)
-0149 end
-0150
-0151 fvtemp = nan(fn, fz);
-0152 fvsalt = nan(fn, fz);
-0153 fvdens = nan(fn, fz);
-0154 fvuvel = nan(fe, fz);
-0155 fvvvel = nan(fe, fz);
-0156
-0157 plon = lon(:);
-0158 plat = lat(:);
-0159 flon = Mobj.lon;
-0160 flat = Mobj.lat;
-0161 flonc = Mobj.lonc;
-0162 flatc = Mobj.latc;
-0163 ptempz = pc.tempz;
-0164 psalz = pc.salz;
-0165 pdenz = pc.denz;
-0166 puvelz = pc.uvelz;
-0167 pvvelz = pc.vvelz;
-0168
-0169 tic
-0170 parfor zi = 1:fz
-0171     % Set up the interpolation objects.
-0172     ft = TriScatteredInterp(plon, plat, reshape(ptempz(:, :, zi), [], 1), 'natural');
-0173     fs = TriScatteredInterp(plon, plat, reshape(psalz(:, :, zi), [], 1), 'natural');
-0174     fd = TriScatteredInterp(plon, plat, reshape(pdenz(:, :, zi), [], 1), 'natural');
-0175     fu = TriScatteredInterp(plon, plat, reshape(puvelz(:, :, zi), [], 1), 'natural');
-0176     fv = TriScatteredInterp(plon, plat, reshape(pvvelz(:, :, zi), [], 1), 'natural');
-0177     % Interpolate temperature and salinity onto the unstructured grid.
-0178     fvtemp(:, zi) = ft(flon, flat);
-0179     fvsalt(:, zi) = fs(flon, flat);
-0180     fvdens(:, zi) = fd(flon, flat);
-0181     fvuvel(:, zi) = fu(flonc, flatc);
-0182     fvvvel(:, zi) = fv(flonc, flatc);
-0183 end
-0184
-0185 clear plon plat flon flat flonc flatc ptempz psalz pdenz puvelz pvvelz
+0136             ftbverbose = false;
+0137             % flip data upside down
+0138             hdepth = flip(hdepth,3);
+0139             % CHECK HERE IF 2D OR 3D VARIABLE
+0140             if (ndims(hycom.(currvar))>2)
+0141             datain= squeeze(hycom.(currvar)(:, :, :, tidx));
+0142             datain = flip(datain,3);
+0143             % DO NOT INTERPOLATE 2D VARIABLES!!!
+0144
+0145             hyinterp.(currvar) = grid_vert_interp(Mobj, ...
+0146                 hycom.lon, hycom.lat, ...
+0147                 datain, ...
+0148                 hdepth, landmask, 'extrapolate', [flon, flat]);
+0149             ftbverbose = true;
+0150             %--------------------------------------------------------------
+0151             % Now we have vertically interpolated data, we can interpolate
+0152             % each sigma layer onto the FVCOM unstructured grid ready to
+0153             % write out to NetCDF. We'll use the triangular interpolation
+0154             % in MATLAB with the natural method (gives pretty good results,
+0155             % at least qualitatively).
+0156             %--------------------------------------------------------------
+0157
+0158             if ftbverbose
+0159                 fprintf('horizontally... ')
+0160             end
+0161
+0162             hytempz = hyinterp.(currvar);
+0163
+0164             tic
+0165             parfor zi = 1:fz
+0166                 % Get the current depth layer's data and mask out the NaN
+0167                 % values.
+0168                 hytempzcurrent = hytempz(:, :, zi);
+0169
+0170                 % Strip out NaNs so we can extrapolate with TriScatteredInterp.
+0175                 % Set up the interpolation object and interpolate the
+0176                 % current variable to the FVCOM unstructured grid.
+0177                 ft = scatteredInterpolant(plonclean, platclean, ...
+0178                     hytempzclean, 'natural', 'nearest');
+0179                 fvtemp(:, zi) = ft(flon, flat);
+0180             end
+0181             else
+0182                 ft = scatteredInterpolant(plon, plat, reshape(hycom.(currvar), [], 1), 'nearest','linear');
+0183                 fvtemp = ft(flon, flat);
+0184             ftbverbose = true;
+0185             end
0186
-0187 % Unfortunately, TriScatteredInterp won't extrapolate, returning instead
-0188 % NaNs outside the original data's extents. So, for each NaN position, find
-0189 % the nearest non-NaN value and use that instead. The order in which the
-0190 % NaN-nodes are found will determine the spatial pattern of the
-0191 % extrapolation.
+0187             % Unfortunately, TriScatteredInterp won't extrapolate,
+0188             % returning instead NaNs outside the original data's extents.
+0189             % So, for each NaN position, find the nearest non-NaN value and
+0190             % use that instead. The order in which the NaN-nodes are found
+0191             % will determine the spatial pattern of the extrapolation.
0192
-0193 % We can assume that all layers will have NaNs in the same place
-0194 % (horizontally), so just use the surface layer (1) for the identification
-0195 % of NaNs. Also store the finite values so we can find the nearest real
-0196 % value to the current NaN node and use its temperature and salinity
-0197 % values.
-0198 fvidx = 1:fn;
-0199 fvnanidx = fvidx(isnan(fvtemp(:, 1)));
-0200 fvfinidx = fvidx(~isnan(fvtemp(:, 1)));
+0193             % We can assume that all layers will have NaNs in the same
+0194             % place (horizontally), so just use the surface layer (1) for
+0195             % the identification of NaNs. Also store the finite values so
+0196             % we can find the nearest real value to the current NaN node
+0197             % and use its temperature and salinity values.
+0198             fvidx = 1:fn;
+0199             fvnanidx = fvidx(isnan(fvtemp(:, 1)));
+0200             fvfinidx = fvidx(~isnan(fvtemp(:, 1)));
0201
-0202 % Can't parallelise this one (easily). It shouldn't be a big part of the
-0203 % run time if your source data covers the domain sufficiently.
-0204 for ni = 1:length(fvnanidx)
-0205     % Current position
-0206     xx = Mobj.lon(fvnanidx(ni));
-0207     yy = Mobj.lat(fvnanidx(ni));
-0208     % Find the nearest non-nan temperature and salinity value.
-0209     [~, di] = min(sqrt((Mobj.lon(fvfinidx) - xx).^2 + (Mobj.lat(fvfinidx) - yy).^2));
-0210     % Replace the temperature and salinity values at all depths at the
-0211     % current NaN position with the closest non-nan value.
-0212     fvtemp(fvnanidx(ni), :) = fvtemp(fvfinidx(di), :);
-0213     fvsalt(fvnanidx(ni), :) = fvsalt(fvfinidx(di), :);
-0214     fvdens(fvnanidx(ni), :) = fvdens(fvfinidx(di), :);
-0215     fvuvel(fvnanidx(ni), :) = fvuvel(fvfinidx(di), :);
-0216     fvvvel(fvnanidx(ni), :) = fvvvel(fvfinidx(di), :);
-0217 end
-0218
-0219 if ftbverbose
-0220     fprintf('done.\n')
-0221     toc
+0202             for ni = 1:length(fvnanidx)
+0203                 % Find the nearest non-nan data (temp, salinity, u or v)
+0204                 % value.
+0205                 xx = flon(fvnanidx(ni));
+0206                 yy = flat(fvnanidx(ni));
+0207                 [~, di] = min(sqrt((flon(fvfinidx) - xx).^2 + (flat(fvfinidx) - yy).^2));
+0208                 fvtemp(fvnanidx(ni), :) = fvtemp(fvfinidx(di), :);
+0209             end
+0210
+0211             clear plon plat flon flat ptempz
+0212
+0213             Mobj.restart.(currvar) = fvtemp;
+0214
+0215             te = toc;
+0216
+0217             if ftbverbose
+0218                 fprintf('done. (elapsed time = %.2f seconds)\n', te)
+0219             end
+0220
+0221     end
0222 end
0223
-0224 Mobj.restart.temp = fvtemp;
-0225 Mobj.restart.salinity = fvsalt;
-0226 Mobj.restart.rho1 = fvdens;
-0227 Mobj.restart.u = fvuvel;
-0228 Mobj.restart.v = fvvvel;
-0229
-0230 % Close the MATLAB pool if we opened it.
-0231 if wasOpened
-0232     matlabpool close
-0233 end
+0224 % Close the MATLAB pool if we opened it.
+0225 if wasOpened
+0226     pool.delete
+0227 end
+0228
+0229 if ftbverbose
+0230     fprintf('end   : %s\n', subname)
+0231 end
+0232
+0233 %% Debugging figure
0234
-0235 if ftbverbose
-0236     fprintf('end   : %s\n', subname)
-0237 end
-0238
-0239 %% Debugging figure
-0240
-0241 % close all
-0242 %
-0243 % ri = 85; % column index
-0244 % ci = 95; % row index
+0235 % close all
+0236 %
+0237 % ri = 85; % column index
+0238 % ci = 95; % row index
+0239 %
+0240 % [~, idx] = min(sqrt((Mobj.lon - lon(ri, ci)).^2 + (Mobj.lat - lat(ri, ci)).^2));
+0241 %
+0242 % % Vertical profiles
+0243 % figure
+0244 % clf
0245 %
-0246 % [~, idx] = min(sqrt((Mobj.lon - lon(ri, ci)).^2 + (Mobj.lat - lat(ri, ci)).^2));
-0247 %
-0248 % % Vertical profiles
-0249 % figure
-0250 % clf
-0251 %
-0252 % % The top row shows the temperature/salinity values as plotted against
-0253 % % index (i.e. position in the array). I had thought POLCOMS stored its data
-0254 % % from seabed to sea surface, but looking at the NetCDF files in ncview,
-0255 % % it's clear that the data are in fact stored surface to seabed (like
-0256 % % FVCOM). As such, the two plots in the top row should be upside down (i.e.
-0257 % % surface values at the bottom of the plot). The two lower rows should have
-0258 % % three lines which all match: the raw POLCOMS data, the POLCOMS data for
-0259 % % the current time step (i.e. that in 'temperature' and 'salinity') and the
-0260 % % interpolated FVCOM data against depth.
-0261 % %
-0262 % % Also worth noting, the pc.*.data have the rows and columns flipped, so
-0263 % % (ci, ri) in pc.*.data and (ri, ci) in 'temperature', 'salinity' and
-0264 % % 'depth'. Needless to say, the two lines in the lower plots should
-0265 % % overlap.
+0246 % % The top row shows the temperature/salinity values as plotted against
+0247 % % index (i.e. position in the array). I had thought POLCOMS stored its data
+0248 % % from seabed to sea surface, but looking at the NetCDF files in ncview,
+0249 % % it's clear that the data are in fact stored surface to seabed (like
+0250 % % FVCOM). As such, the two plots in the top row should be upside down (i.e.
+0251 % % surface values at the bottom of the plot). The two lower rows should have
+0252 % % three lines which all match: the raw POLCOMS data, the POLCOMS data for
+0253 % % the current time step (i.e. that in 'temperature' and 'salinity') and the
+0254 % % interpolated FVCOM data against depth.
+0255 % %
+0256 % % Also worth noting, the pc.* have the rows and columns flipped, so
+0257 % % (ci, ri) in pc.* and (ri, ci) in 'temperature', 'salinity' and
+0258 % % 'depth'. Needless to say, the two lines in the lower plots should
+0259 % % overlap.
+0260 %
+0261 % subplot(2,2,1)
+0262 % plot(squeeze(pc.ETWD(ci, ri, :, tidx)), 1:size(depth, 3), 'rx:')
+0263 % xlabel('Temperature (^{\circ}C)')
+0264 % ylabel('Array index')
+0265 % title('Array Temperature')
0266 %
-0267 % subplot(2,2,1)
-0268 % plot(squeeze(pc.ETWD.data(ci, ri, :, tidx)), 1:size(depth, 3), 'rx:')
-0269 % xlabel('Temperature (^{\circ}C)')
+0267 % subplot(2,2,2)
+0268 % plot(squeeze(pc.x1XD(ci, ri, :, tidx)), 1:size(depth, 3), 'rx:')
+0269 % xlabel('Salinity')
0270 % ylabel('Array index')
-0271 % title('Array Temperature')
+0271 % title('Array Salinity')
0272 %
-0273 % subplot(2,2,2)
-0274 % plot(squeeze(pc.x1XD.data(ci, ri, :, tidx)), 1:size(depth, 3), 'rx:')
-0275 % xlabel('Salinity')
-0276 % ylabel('Array index')
-0277 % title('Array Salinity')
-0278 %
-0279 % subplot(2,2,3)
-0280 % % Although POLCOMS stores its temperature values from seabed to surface,
-0281 % % the depths are stored surface to seabed. Nice. Flip the
-0282 % % temperature/salinity data accordingly. The lines here should match one
-0283 % % another.
-0284 % plot(squeeze(pc.ETWD.data(ci, ri, :, tidx)), squeeze(pc.depth.data(ci, ri, :, tidx)), 'rx-')
-0285 % hold on
-0286 % plot(squeeze(temperature(ri, ci, :)), squeeze(depth(ri, ci, :)), '.:')
-0287 % % Add the equivalent interpolated FVCOM data point
-0288 % plot(fvtemp(idx, :), Mobj.siglayz(idx, :), 'g.-')
-0289 % xlabel('Temperature (^{\circ}C)')
-0290 % ylabel('Depth (m)')
-0291 % title('Depth Temperature')
-0292 % legend('pc', 'temp', 'fvcom', 'location', 'north')
-0293 % legend('boxoff')
-0294 %
-0295 % subplot(2,2,4)
-0296 % % Although POLCOMS stores its temperature values from seabed to surface,
-0297 % % the depths are stored surface to seabed. Nice. Flip the
-0298 % % temperature/salinity data accordingly. The lines here should match one
-0299 % % another.
-0300 % plot(squeeze(pc.x1XD.data(ci, ri, :, tidx)), squeeze(pc.depth.data(ci, ri, :, tidx)), 'rx-')
-0301 % hold on
-0302 % plot(squeeze(salinity(ri, ci, :)), squeeze(depth(ri, ci, :)), '.:')
-0303 % % Add the equivalent interpolated FVCOM data point
-0304 % plot(fvsalt(idx, :), Mobj.siglayz(idx, :), 'g.-')
-0305 % xlabel('Salinity')
-0306 % ylabel('Depth (m)')
-0307 % title('Depth Salinity')
-0308 % legend('pc', 'salt', 'fvcom', 'location', 'north')
-0309 % legend('boxoff')
-0310 %
-0311 % %% Plot the sample location
-0312 % figure
-0313 % dx = mean(diff(pc.lon.data));
-0314 % dy = mean(diff(pc.lat.data));
-0315 % z = depth(:, :, end); % water depth (bottom layer depth)
-0316 % z(mask) = 0; % clear out nonsense values
-0317 % pcolor(lon - (dx / 2), lat - (dy / 2), z)
-0319 % axis('equal', 'tight')
-0320 % daspect([1.5, 1, 1])
-0321 % colorbar
-0322 % caxis([-150, 0])
-0323 % hold on
-0324 % plot(lon(ri, ci), lat(ri, ci), 'ko', 'MarkerFaceColor', 'w')
-0325
-Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0273 % subplot(2,2,3)
+0274 % % Although POLCOMS stores its temperature values from seabed to surface,
+0275 % % the depths are stored surface to seabed. Nice. Flip the
+0276 % % temperature/salinity data accordingly. The lines here should match one
+0277 % % another.
+0278 % plot(squeeze(pc.ETWD(ci, ri, :, tidx)), squeeze(pc.depth(ci, ri, :, tidx)), 'rx-')
+0279 % hold on
+0280 % plot(squeeze(temperature(ri, ci, :)), squeeze(depth(ri, ci, :)), '.:')
+0281 % % Add the equivalent interpolated FVCOM data point
+0282 % plot(fvtemp(idx, :), Mobj.siglayz(idx, :), 'g.-')
+0283 % xlabel('Temperature (^{\circ}C)')
+0284 % ylabel('Depth (m)')
+0285 % title('Depth Temperature')
+0286 % legend('pc', 'temp', 'fvcom', 'location', 'north')
+0287 % legend('boxoff')
+0288 %
+0289 % subplot(2,2,4)
+0290 % % Although POLCOMS stores its temperature values from seabed to surface,
+0291 % % the depths are stored surface to seabed. Nice. Flip the
+0292 % % temperature/salinity data accordingly. The lines here should match one
+0293 % % another.
+0294 % plot(squeeze(pc.x1XD(ci, ri, :, tidx)), squeeze(pc.depth(ci, ri, :, tidx)), 'rx-')
+0295 % hold on
+0296 % plot(squeeze(salinity(ri, ci, :)), squeeze(depth(ri, ci, :)), '.:')
+0297 % % Add the equivalent interpolated FVCOM data point
+0298 % plot(fvsalt(idx, :), Mobj.siglayz(idx, :), 'g.-')
+0299 % xlabel('Salinity')
+0300 % ylabel('Depth (m)')
+0301 % title('Depth Salinity')
+0302 % legend('pc', 'salt', 'fvcom', 'location', 'north')
+0303 % legend('boxoff')
+0304 %
+0305 % %% Plot the sample location
+0306 % figure
+0307 % dx = mean(diff(pc.lon));
+0308 % dy = mean(diff(pc.lat));
+0309 % z = depth(:, :, end); % water depth (bottom layer depth)
+0310 % z(mask) = 0; % clear out nonsense values
+0311 % pcolor(lon - (dx / 2), lat - (dy / 2), z)
+0313 % axis('equal', 'tight')
+0314 % daspect([1.5, 1, 1])
+0315 % colorbar
+0316 % caxis([-150, 0])
+0317 % hold on
+0318 % plot(lon(ri, ci), lat(ri, ci), 'ko', 'MarkerFaceColor', 'w')
+0319```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/interp_coarse_to_obc.html b/doc/fvcom_prepro/interp_coarse_to_obc.html index 67bb9a5..ce25d6f 100644 --- a/doc/fvcom_prepro/interp_coarse_to_obc.html +++ b/doc/fvcom_prepro/interp_coarse_to_obc.html @@ -732,6 +732,6 @@ This function is called by: 0623 % plot(lon(xidx, yidx), lat(xidx, yidx), 'rs') % polcoms is all backwards 0624 % plot(Mobj.lon(oNodes(nn)), Mobj.lat(oNodes(nn)), 'wo') 0625 % colorbar -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/interp_sst_assimilation.html b/doc/fvcom_prepro/interp_sst_assimilation.html index c569384..8f1896c 100644 --- a/doc/fvcom_prepro/interp_sst_assimilation.html +++ b/doc/fvcom_prepro/interp_sst_assimilation.html @@ -305,6 +305,6 @@ This function is called by: 0224 if ftbverbose 0225 fprintf('end : %s \n', subname) 0226 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/make_blank_mesh.html b/doc/fvcom_prepro/make_blank_mesh.html index ed88363..b5ce9d6 100755 --- a/doc/fvcom_prepro/make_blank_mesh.html +++ b/doc/fvcom_prepro/make_blank_mesh.html @@ -126,6 +126,6 @@ This function is called by: 0060 end; 0061 0062 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/make_default_nml.html b/doc/fvcom_prepro/make_default_nml.html index 1d30346..7292c16 100644 --- a/doc/fvcom_prepro/make_default_nml.html +++ b/doc/fvcom_prepro/make_default_nml.html @@ -307,7 +307,7 @@ This function is called by: 0244 nml.NML_PHYSICS.BOTTOM_ROUGHNESS_MINIMUM = 0.0025; 0245 fmt.NML_PHYSICS.BOTTOM_ROUGHNESS_MINIMUM.format = '%e'; 0246 nml.NML_PHYSICS.BOTTOM_ROUGHNESS_LENGTHSCALE = -1.0; -0247 fmt.NML_PHYSICS.BOTTOM_ROUGHNESS_LENGTHSCALE.format = '%5.2f'; +0247 fmt.NML_PHYSICS.BOTTOM_ROUGHNESS_LENGTHSCALE.format = '%e'; 0248 nml.NML_PHYSICS.BOTTOM_ROUGHNESS_KIND = 'static'; 0249 nml.NML_PHYSICS.BOTTOM_ROUGHNESS_TYPE = 'orig'; 0250 nml.NML_PHYSICS.BOTTOM_ROUGHNESS_FILE = [conf.casename '_z0=0.005.nc']; @@ -659,6 +659,6 @@ This function is called by: 0596 fmt.NML_TS_OIASSIMILATION.TS_NSTEP_OI.format = '%u';% 0597 0598 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/make_model_nml_generic.html b/doc/fvcom_prepro/make_model_nml_generic.html index 68bc26c..8d45207 100644 --- a/doc/fvcom_prepro/make_model_nml_generic.html +++ b/doc/fvcom_prepro/make_model_nml_generic.html @@ -136,6 +136,6 @@ This function is called by: 0089 % START_DATE = '2046-02-01 00:00:00' 0090 % END_DATE = '2046-03-01 00:00:00' 0091 % %/ -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/modify_FVCOM_nested_forcing.html b/doc/fvcom_prepro/modify_FVCOM_nested_forcing.html index 511235b..8a9bc75 100644 --- a/doc/fvcom_prepro/modify_FVCOM_nested_forcing.html +++ b/doc/fvcom_prepro/modify_FVCOM_nested_forcing.html @@ -733,6 +733,6 @@ This function is called by: 0643 % netcdf.putAtt(nc, nweights_varid, 'type', 'data'); 0644 % end 0645 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/nodes2elems.html b/doc/fvcom_prepro/nodes2elems.html index fdffc7b..bfecc7c 100755 --- a/doc/fvcom_prepro/nodes2elems.html +++ b/doc/fvcom_prepro/nodes2elems.html @@ -123,6 +123,6 @@ This function is called by: 0054 if ftbverbose 0055 fprintf('end : %s \n', subname) 0056 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/plot_field.html b/doc/fvcom_prepro/plot_field.html index eaf4451..cc153df 100755 --- a/doc/fvcom_prepro/plot_field.html +++ b/doc/fvcom_prepro/plot_field.html @@ -236,6 +236,6 @@ This function is called by: 0160 end; 0161 0162 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_ERA_wind.html b/doc/fvcom_prepro/read_ERA_wind.html index f435443..ab27e1a 100644 --- a/doc/fvcom_prepro/read_ERA_wind.html +++ b/doc/fvcom_prepro/read_ERA_wind.html @@ -352,6 +352,6 @@ This function is called by: 0244 if ftbverbose 0245 fprintf('end : %s \n', subname) 0246 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_MetUM_forcing.html b/doc/fvcom_prepro/read_MetUM_forcing.html index 58771fe..db2da7d 100644 --- a/doc/fvcom_prepro/read_MetUM_forcing.html +++ b/doc/fvcom_prepro/read_MetUM_forcing.html @@ -386,6 +386,6 @@ This function is called by: 0284 mt = datenum(timeval, 'dd-mmm-yyyy:HH:MM:SS'); 0285 0286 fixedtime = datestr(mt + tt, 'yyyy-mm-dd HH:MM:SS'); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_NCEP_wind.html b/doc/fvcom_prepro/read_NCEP_wind.html index f927c46..3fff0e6 100644 --- a/doc/fvcom_prepro/read_NCEP_wind.html +++ b/doc/fvcom_prepro/read_NCEP_wind.html @@ -180,6 +180,6 @@ This function is called by: 0112 0113 netcdf.close(nc_u10) 0114 netcdf.close(nc_v10) -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_fabm_variables.html b/doc/fvcom_prepro/read_fabm_variables.html index dfb9ed2..8a51e89 100644 --- a/doc/fvcom_prepro/read_fabm_variables.html +++ b/doc/fvcom_prepro/read_fabm_variables.html @@ -121,7 +121,7 @@ This function is called by: 0046 % read ersem variables in donor restart file 0047 info_donor=ncinfo(conf.restart_file); 0048 else -0049 warning(['File ',conf.restart_file,' Not found. Returning']) +0049 warning('File %s not found. Returning', conf.restart_file) 0050 return 0051 end 0052 % Generally the last fvcom variable although this could change with a @@ -145,6 +145,6 @@ This function is called by: 0070 end 0071 0072 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_fvcom_bath.html b/doc/fvcom_prepro/read_fvcom_bath.html index 80b428d..55540b4 100755 --- a/doc/fvcom_prepro/read_fvcom_bath.html +++ b/doc/fvcom_prepro/read_fvcom_bath.html @@ -126,6 +126,6 @@ This function is called by: 0057 if ftbverbose 0058 fprintf('end : %s\n', subname) 0059 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_fvcom_obc.html b/doc/fvcom_prepro/read_fvcom_obc.html index fb008ea..1f602c5 100644 --- a/doc/fvcom_prepro/read_fvcom_obc.html +++ b/doc/fvcom_prepro/read_fvcom_obc.html @@ -146,6 +146,6 @@ This function is called by: 0078 if ftbverbose 0079 fprintf('\nend : %s\n', subname) 0080 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_gmsh_mesh.html b/doc/fvcom_prepro/read_gmsh_mesh.html index 611b3bd..82fad74 100644 --- a/doc/fvcom_prepro/read_gmsh_mesh.html +++ b/doc/fvcom_prepro/read_gmsh_mesh.html @@ -369,6 +369,6 @@ This function is called by: 0299 if ftbverbose 0300 fprintf('end : %s\n', subname) 0301 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_grid_mesh.html b/doc/fvcom_prepro/read_grid_mesh.html index 89ef8dd..279557c 100644 --- a/doc/fvcom_prepro/read_grid_mesh.html +++ b/doc/fvcom_prepro/read_grid_mesh.html @@ -344,6 +344,6 @@ This function is called by: 0267 fclose(fid); 0268 0269 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_sigma.html b/doc/fvcom_prepro/read_sigma.html index 0a25930..b403907 100644 --- a/doc/fvcom_prepro/read_sigma.html +++ b/doc/fvcom_prepro/read_sigma.html @@ -196,78 +196,90 @@ This function is called by: 0110 % Should be present in all sigma files. 0111 fprintf('nlev\t%d\n', nlev) 0112 fprintf('sigtype\t%s\n', sigtype) -0113 -0114 % Only present in geometric sigma files. -0115 if strcmpi(sigtype, 'GEOMETRIC') -0116 fprintf('sigpow\t%d\n', sigpow) -0117 end -0118 -0119 % Only in the generalised or uniform sigma files. -0120 if strcmpi(sigtype, 'GENERALIZED') -0121 fprintf('du\t%d\n', du) -0122 fprintf('dl\t%d\n', dl) -0123 fprintf('min_constant_depth\t%f\n', min_constant_depth) -0124 fprintf('ku\t%d\n', ku) -0125 fprintf('kl\t%d\n', kl) -0126 fprintf('zku\t%d\n', zku) -0127 fprintf('zkl\t%d\n', zkl) -0128 end -0129 if strcmpi(sigtype, 'TANH') -0130 fprintf('du\t%d\n', du) -0131 fprintf('dl\t%d\n', dl) -0132 end -0133 end -0134 -0135 % Calculate the sigma distributions at each grid node. -0136 nx = length(Mobj.h); -0137 switch lower(sigtype) -0138 case 'generalized' -0139 z = nan([nx, nlev]); -0140 h = Mobj.h; % avoids broadcasting Mobj on every iteration -0141 % Not sure if a parfor is wise here as the pool start up time might -0142 % exceed the run time. For big grids, the parfor is probably a wise -0143 % move. -0144 parfor i = 1:nx -0145 z(i, :) = sigma_gen(nlev, dl, du, kl, ku, zkl, zku, ... -0146 h(i), min_constant_depth); -0147 end -0148 clear h -0149 case 'uniform' -0150 z = repmat(sigma_geo(nlev, 1), [nx, 1]); -0151 case 'geometric' -0152 z = repmat(sigma_geo(nlev, sigpow), [nx, 1]); -0153 case 'tanh' -0154 z = repmat(sigma_tanh(nlev, dl,du), [nx, 1]); -0155 otherwise -0156 error('Don''t recognise sigtype %s (is it supported?)', sigtype) -0157 end -0158 -0159 % Create a depth array for the element centres. -0160 hc = nodes2elems(Mobj.h, Mobj); -0161 ne = length(hc); -0162 -0163 % Create a siglay variable (i.e. midpoint in the sigma levels). -0164 zlay = z(:, 1:end - 1) + (diff(z, [], 2) ./ 2); -0165 zlayc = nan(ne, nlev - 1); -0166 zc = nan(ne, nlev); -0167 for i = 1:nlev -0168 zc(:, i) = nodes2elems(z(:, i), Mobj); -0169 if i ~= nlev -0170 zlayc(:, i) = nodes2elems(zlay(:, i), Mobj); -0171 end -0172 end -0173 Mobj.siglevz = repmat(Mobj.h, 1, nlev) .* z; -0174 Mobj.siglayz = repmat(Mobj.h, 1, nlev-1) .* zlay; -0175 Mobj.siglevzc = repmat(hc, 1, nlev) .* zc; -0176 Mobj.siglayzc = repmat(hc, 1, nlev-1) .* zlayc; -0177 -0178 % Add the sigma levels and layers to the Mobj. -0179 Mobj.siglev = z; -0180 Mobj.siglay = zlay; -0181 -0182 if ftbverbose -0183 fprintf('end : %s\n', subname) -0184 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0113 Mobj.nlev = nlev; +0114 Mobj.sigtype = sigtype; +0115 % Only present in geometric sigma files. +0116 if strcmpi(sigtype, 'GEOMETRIC') +0117 fprintf('sigpow\t%d\n', sigpow) +0118 Mobj.sigpow = sigpow; +0119 end +0120 +0121 % Only in the generalised or uniform sigma files. +0122 if strcmpi(sigtype, 'GENERALIZED') +0123 fprintf('du\t%d\n', du) +0124 fprintf('dl\t%d\n', dl) +0125 fprintf('min_constant_depth\t%f\n', min_constant_depth) +0126 fprintf('ku\t%d\n', ku) +0127 fprintf('kl\t%d\n', kl) +0128 fprintf('zku\t%d\n', zku) +0129 fprintf('zkl\t%d\n', zkl) +0130 Mobj.du = du; +0131 Mobj.dl = dl; +0132 Mobj.min_constant_depth = min_constant_depth; +0133 Mobj.ku = ku; +0134 Mobj.kl = kl; +0135 Mobj.zku = zku; +0136 Mobj.zkl = zkl; +0137 end +0138 if strcmpi(sigtype, 'TANH') +0139 fprintf('du\t%d\n', du) +0140 fprintf('dl\t%d\n', dl) +0141 Mobj.du = du; +0142 Mobj.dl = dl; +0143 end +0144 end +0145 +0146 % Calculate the sigma distributions at each grid node. +0147 nx = length(Mobj.h); +0148 switch lower(sigtype) +0149 case 'generalized' +0150 z = nan([nx, nlev]); +0151 h = Mobj.h; % avoids broadcasting Mobj on every iteration +0152 % Not sure if a parfor is wise here as the pool start up time might +0153 % exceed the run time. For big grids, the parfor is probably a wise +0154 % move. +0155 parfor i = 1:nx +0156 z(i, :) = sigma_gen(nlev, dl, du, kl, ku, zkl, zku, ... +0157 h(i), min_constant_depth); +0158 end +0159 clear h +0160 case 'uniform' +0161 z = repmat(sigma_geo(nlev, 1), [nx, 1]); +0162 case 'geometric' +0163 z = repmat(sigma_geo(nlev, sigpow), [nx, 1]); +0164 case 'tanh' +0165 z = repmat(sigma_tanh(nlev, dl,du), [nx, 1]); +0166 otherwise +0167 error('Don''t recognise sigtype %s (is it supported?)', sigtype) +0168 end +0169 +0170 % Create a depth array for the element centres. +0171 hc = nodes2elems(Mobj.h, Mobj); +0172 ne = length(hc); +0173 +0174 % Create a siglay variable (i.e. midpoint in the sigma levels). +0175 zlay = z(:, 1:end - 1) + (diff(z, [], 2) ./ 2); +0176 zlayc = nan(ne, nlev - 1); +0177 zc = nan(ne, nlev); +0178 for i = 1:nlev +0179 zc(:, i) = nodes2elems(z(:, i), Mobj); +0180 if i ~= nlev +0181 zlayc(:, i) = nodes2elems(zlay(:, i), Mobj); +0182 end +0183 end +0184 Mobj.siglevz = repmat(Mobj.h, 1, nlev) .* z; +0185 Mobj.siglayz = repmat(Mobj.h, 1, nlev-1) .* zlay; +0186 Mobj.siglevzc = repmat(hc, 1, nlev) .* zc; +0187 Mobj.siglayzc = repmat(hc, 1, nlev-1) .* zlayc; +0188 Mobj.siglayc = zlayc; +0189 Mobj.siglevc = zc; +0190 % Add the sigma levels and layers to the Mobj. +0191 Mobj.siglev = z; +0192 Mobj.siglay = zlay; +0193 +0194 if ftbverbose +0195 fprintf('end : %s\n', subname) +0196 end +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/read_sms_map.html b/doc/fvcom_prepro/read_sms_map.html index 6813468..50f5f01 100644 --- a/doc/fvcom_prepro/read_sms_map.html +++ b/doc/fvcom_prepro/read_sms_map.html @@ -166,6 +166,6 @@ This function is called by: 0092 end 0093 0094 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/set_elevtide.html b/doc/fvcom_prepro/set_elevtide.html index d979966..0576d5a 100644 --- a/doc/fvcom_prepro/set_elevtide.html +++ b/doc/fvcom_prepro/set_elevtide.html @@ -122,6 +122,6 @@ This function is called by: 0051 write_FVCOM_elevtide(ObcNodes,JulianTime,SurfaceElevation,ElevationFile,MyTitle) 0052 0053 if(ftbverbose); fprintf(['end : ' subname '\n']); end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/set_elevtide_tmd.html b/doc/fvcom_prepro/set_elevtide_tmd.html index dfe4e76..047db63 100644 --- a/doc/fvcom_prepro/set_elevtide_tmd.html +++ b/doc/fvcom_prepro/set_elevtide_tmd.html @@ -24,7 +24,7 @@

## SYNOPSIS

-
function [Mobj TMD_ConList] = set_elevtide_tmd(Mobj, dates_MJD)
+
function [Mobj TMD_ConList] = set_elevtide_tmd(Mobj, dates_MJD, path_to_tmd)

## DESCRIPTION

``` Generate the required fields within Mobj for time series elevation
@@ -56,7 +56,7 @@ This function is called by:
0006 %
0007 % Rory O'Hara Murray, 2013-07-01
0008 %
-0009 function [Mobj TMD_ConList] = set_elevtide_tmd(Mobj, dates_MJD)
+0009 function [Mobj TMD_ConList] = set_elevtide_tmd(Mobj, dates_MJD, path_to_tmd)
0010
0011 %MyTitle = 'Julian FVCOM time series for open boundary from TPXO model using TMD';
0012
@@ -86,34 +86,31 @@ This function is called by:
0036 time_MJD = time - datenum('1858-11-17 00:00:00');
0037 model_file = 'DATA\Model_ES2008';
0038 current_dir = pwd;
-0039 %tmp = which('tmd_tide_pred_2.m');
-0040 %a = strfind(tmp, 'tmd_tide_pred_2.m');
-0041 %cd(tmp(1:a-1))
-0042 cd([getenv('Hydro') '\Software\Matlab\TMD2.03\'])
-0043 [eta, TMD_ConList] = tmd_tide_pred_2(model_file, time, lat, lon, 'z');
-0044 cd(current_dir);
-0045
-0046 %%
-0047 figure('position', [360   502   879   420])
-0048 %plot(NCOF_time, NCOF_eta(:,10), '-o', OTPS_time, OTPS_eta(:,10), OTPS_time, NCOF_eta2(:,10), '-')
-0049 t0 = time(1);
-0050 plot(time-t0, eta)
-0051 legend(gca, 'TMD (OTIS)', 4)
-0052 set(gca, 'yaxislocation', 'right')
-0053 xlabel('Days')
-0054 ylabel('Elevation (m)')
-0055 %title('September 2011')
+0039 cd(path_to_tmd);
+0040 [eta, TMD_ConList] = tmd_tide_pred_2(model_file, time, lat, lon, 'z');
+0041 cd(current_dir);
+0042
+0043 %%
+0044 figure('position', [360   502   879   420])
+0045 %plot(NCOF_time, NCOF_eta(:,10), '-o', OTPS_time, OTPS_eta(:,10), OTPS_time, NCOF_eta2(:,10), '-')
+0046 t0 = time(1);
+0047 plot(time-t0, eta)
+0048 legend(gca, 'TMD (OTIS)', 4)
+0049 set(gca, 'yaxislocation', 'right')
+0050 xlabel('Days')
+0051 ylabel('Elevation (m)')
+0052 %title('September 2011')
+0053
+0054 %% save file in FVCOM 3 format (netCDF)
+0055 %write_FVCOM_julian(BNid,time,eta,filename_out_netCDF,MyTitle, 'timeformat', 'SDN')
0056
-0057 %% save file in FVCOM 3 format (netCDF)
-0058 %write_FVCOM_julian(BNid,time,eta,filename_out_netCDF,MyTitle, 'timeformat', 'SDN')
-0059
-0060 %% save time series to the Mobj structure
-0061 Mobj.surfaceElevation = eta';       % Makes surfaceElevation array with size (boundary nodes, time sereis)
-0062 Mobj.el_time = time_MJD;
-0063
-0064 return
-0065
-0066```
-
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0057 %% save time series to the Mobj structure +0058 Mobj.surfaceElevation = eta'; % Makes surfaceElevation array with size (boundary nodes, time sereis) +0059 Mobj.el_time = time_MJD; +0060 +0061 return +0062 +0063 +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/set_spectide.html b/doc/fvcom_prepro/set_spectide.html index 1600095..efdd28e 100755 --- a/doc/fvcom_prepro/set_spectide.html +++ b/doc/fvcom_prepro/set_spectide.html @@ -169,6 +169,6 @@ This function is called by: 0087 %write_FVCOM_spectide(ObcNodes,Mobj.period_obc(1:nComps),Phase,Amp,Mobj.beta_love,Mobj.equilibrium_amp,SpectralFile,MyTitle) 0088 write_FVCOM_spectide(ObcNodes,Mobj.Components,Mobj.period_obc(1:nComps),Phase,Amp,Mobj.beta_love,Mobj.equilibrium_amp,SpectralFile,MyTitle) 0089 if(ftbverbose); fprintf(['end : ' subname '\n']); end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/setup_metrics.html b/doc/fvcom_prepro/setup_metrics.html index ae810b8..d744695 100755 --- a/doc/fvcom_prepro/setup_metrics.html +++ b/doc/fvcom_prepro/setup_metrics.html @@ -156,6 +156,6 @@ This function is called by: 0091 fprintf(['end : ' subname '\n']) 0092 end; 0093 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/smoothfield.html b/doc/fvcom_prepro/smoothfield.html index d4b5b8f..969f324 100755 --- a/doc/fvcom_prepro/smoothfield.html +++ b/doc/fvcom_prepro/smoothfield.html @@ -145,6 +145,6 @@ This function is called by: 0074 if ftbverbose 0075 fprintf('end : %s\n', subname) 0076 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/smoothfield2.html b/doc/fvcom_prepro/smoothfield2.html index efe2c73..c1f88ed 100755 --- a/doc/fvcom_prepro/smoothfield2.html +++ b/doc/fvcom_prepro/smoothfield2.html @@ -141,6 +141,6 @@ This function is called by: 0073 0074 %fprintf(['end : ' subname '\n']) 0075 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/truncfield.html b/doc/fvcom_prepro/truncfield.html index 0cccd22..be6a662 100755 --- a/doc/fvcom_prepro/truncfield.html +++ b/doc/fvcom_prepro/truncfield.html @@ -113,6 +113,6 @@ This function is called by: 0046 field(i) = fieldmin; 0047 end; 0048 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/wrf2fvcom.html b/doc/fvcom_prepro/wrf2fvcom.html index db34c86..ad45200 100644 --- a/doc/fvcom_prepro/wrf2fvcom.html +++ b/doc/fvcom_prepro/wrf2fvcom.html @@ -288,6 +288,6 @@ This function is called by: 0209 fprintf('done.\n') 0210 fprintf('end : %s \n', subname) 0211 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/wrf2fvcom_U10V10.html b/doc/fvcom_prepro/wrf2fvcom_U10V10.html index 227e824..fc412e5 100755 --- a/doc/fvcom_prepro/wrf2fvcom_U10V10.html +++ b/doc/fvcom_prepro/wrf2fvcom_U10V10.html @@ -211,6 +211,6 @@ This function is called by: 0163 0164 ierr = close(nc); 0165 ierr = close(nc2); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_TT.html b/doc/fvcom_prepro/write_FVCOM_TT.html index 80aa900..6c7f36d 100644 --- a/doc/fvcom_prepro/write_FVCOM_TT.html +++ b/doc/fvcom_prepro/write_FVCOM_TT.html @@ -177,6 +177,6 @@ This function is called by: 0106 end; 0107 0108 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_bath.html b/doc/fvcom_prepro/write_FVCOM_bath.html index b275e1d..0ec7fb5 100755 --- a/doc/fvcom_prepro/write_FVCOM_bath.html +++ b/doc/fvcom_prepro/write_FVCOM_bath.html @@ -132,6 +132,6 @@ This function is called by: 0064 end 0065 0066 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_bedflag.html b/doc/fvcom_prepro/write_FVCOM_bedflag.html index 74b9bec..7d2bb38 100755 --- a/doc/fvcom_prepro/write_FVCOM_bedflag.html +++ b/doc/fvcom_prepro/write_FVCOM_bedflag.html @@ -159,6 +159,6 @@ This function is called by: 0087 if ftbverbose 0088 fprintf('end : %s\n', subname) 0089 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_cor.html b/doc/fvcom_prepro/write_FVCOM_cor.html index 11c973d..9214ec3 100755 --- a/doc/fvcom_prepro/write_FVCOM_cor.html +++ b/doc/fvcom_prepro/write_FVCOM_cor.html @@ -136,6 +136,6 @@ This function is called by: 0066 end 0067 0068 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_elevtide.html b/doc/fvcom_prepro/write_FVCOM_elevtide.html index 0e3b8f8..2c7e262 100644 --- a/doc/fvcom_prepro/write_FVCOM_elevtide.html +++ b/doc/fvcom_prepro/write_FVCOM_elevtide.html @@ -311,6 +311,6 @@ This function is called by: 0206 0207 if ftbverbose; fprintf('end : %s \n', subname); end 0208 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_forcing.html b/doc/fvcom_prepro/write_FVCOM_forcing.html index 16d8961..ec25d50 100644 --- a/doc/fvcom_prepro/write_FVCOM_forcing.html +++ b/doc/fvcom_prepro/write_FVCOM_forcing.html @@ -834,6 +834,6 @@ This function is called by: 0663 if ftbverbose 0664 fprintf('end : %s \n', subname) 0665 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_grid.html b/doc/fvcom_prepro/write_FVCOM_grid.html index ac425c9..0b55e14 100755 --- a/doc/fvcom_prepro/write_FVCOM_grid.html +++ b/doc/fvcom_prepro/write_FVCOM_grid.html @@ -152,6 +152,6 @@ This function is called by: 0074 fprintf('end : %s\n', subname) 0075 end 0076 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_groundwater.html b/doc/fvcom_prepro/write_FVCOM_groundwater.html index ea6d085..b43c7fb 100644 --- a/doc/fvcom_prepro/write_FVCOM_groundwater.html +++ b/doc/fvcom_prepro/write_FVCOM_groundwater.html @@ -261,6 +261,6 @@ This function is called by: 0169 if ftbverbose 0170 fprintf('end : %s \n', subname) 0171 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_heating.html b/doc/fvcom_prepro/write_FVCOM_heating.html index 2c90f44..36ae7c3 100644 --- a/doc/fvcom_prepro/write_FVCOM_heating.html +++ b/doc/fvcom_prepro/write_FVCOM_heating.html @@ -332,6 +332,6 @@ This function is called by: 0245 if ftbverbose 0246 fprintf('end : %s \n', subname) 0247 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_meanflow.html b/doc/fvcom_prepro/write_FVCOM_meanflow.html index f786ecf..e693712 100644 --- a/doc/fvcom_prepro/write_FVCOM_meanflow.html +++ b/doc/fvcom_prepro/write_FVCOM_meanflow.html @@ -181,6 +181,6 @@ This function is called by: 0107 fprintf(['end : ' subname '\n']) 0108 end 0109 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_meanflow_ascii.html b/doc/fvcom_prepro/write_FVCOM_meanflow_ascii.html index 1a57170..ccaff07 100644 --- a/doc/fvcom_prepro/write_FVCOM_meanflow_ascii.html +++ b/doc/fvcom_prepro/write_FVCOM_meanflow_ascii.html @@ -314,6 +314,6 @@ This function is called by: 0236 end 0237 0238 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_nested_forcing.html b/doc/fvcom_prepro/write_FVCOM_nested_forcing.html index f5122fa..8767b06 100644 --- a/doc/fvcom_prepro/write_FVCOM_nested_forcing.html +++ b/doc/fvcom_prepro/write_FVCOM_nested_forcing.html @@ -595,6 +595,6 @@ This function is called by: 0474 if ftbverbose 0475 fprintf('end : %s\n', subname) 0476 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_obc.html b/doc/fvcom_prepro/write_FVCOM_obc.html index 5409765..87ee578 100755 --- a/doc/fvcom_prepro/write_FVCOM_obc.html +++ b/doc/fvcom_prepro/write_FVCOM_obc.html @@ -128,6 +128,6 @@ This function is called by: 0062 fprintf(['end : ' subname '\n']) 0063 end; 0064 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_obs_TS.html b/doc/fvcom_prepro/write_FVCOM_obs_TS.html index a155231..1df0920 100755 --- a/doc/fvcom_prepro/write_FVCOM_obs_TS.html +++ b/doc/fvcom_prepro/write_FVCOM_obs_TS.html @@ -203,6 +203,6 @@ This function is called by: 0127 0128 0129 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_probes.html b/doc/fvcom_prepro/write_FVCOM_probes.html index 8e3832f..4be48b0 100644 --- a/doc/fvcom_prepro/write_FVCOM_probes.html +++ b/doc/fvcom_prepro/write_FVCOM_probes.html @@ -252,6 +252,6 @@ This function is called by: 0134 if ftbverbose 0135 fprintf('end : %s\n', subname) 0136 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_restart.html b/doc/fvcom_prepro/write_FVCOM_restart.html index 76b7f31..a78de22 100644 --- a/doc/fvcom_prepro/write_FVCOM_restart.html +++ b/doc/fvcom_prepro/write_FVCOM_restart.html @@ -594,6 +594,6 @@ This function is called by: 0464 if ftbverbose 0465 fprintf('end : %s \n', subname) 0466 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_river.html b/doc/fvcom_prepro/write_FVCOM_river.html index 9c817ad..0f47424 100755 --- a/doc/fvcom_prepro/write_FVCOM_river.html +++ b/doc/fvcom_prepro/write_FVCOM_river.html @@ -240,6 +240,6 @@ This function is called by: 0152 fprintf('end : %s\n', subname) 0153 end 0154 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_river_ERSEM.html b/doc/fvcom_prepro/write_FVCOM_river_ERSEM.html index 3bf8421..801fad3 100644 --- a/doc/fvcom_prepro/write_FVCOM_river_ERSEM.html +++ b/doc/fvcom_prepro/write_FVCOM_river_ERSEM.html @@ -353,6 +353,6 @@ This function is called by: 0260 fprintf('end : %s\n', subname) 0261 end 0262 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_river_nml.html b/doc/fvcom_prepro/write_FVCOM_river_nml.html index 33b0125..8785257 100644 --- a/doc/fvcom_prepro/write_FVCOM_river_nml.html +++ b/doc/fvcom_prepro/write_FVCOM_river_nml.html @@ -29,13 +29,13 @@

## DESCRIPTION

``` Write a namelist for the river nodes.

- write_FVCOM_river_nml(Mobj, nml_file, nc_file)
+ write_FVCOM_river_nml(Mobj, nml_file, nc_file, vString))

DESCRIPTION:
Using the output of get_POLCOMS_rivers in Mobj, output the river name,
input file, grid node and vertical distribution into a namelist (.nml
file).
-
+
NOTE: if the vertical distribution is uniform, the string 'uniform'
will be output. If a non-uniform distribution is detected, then the
name list will need to be edited to reflect the distribution specified
@@ -48,22 +48,32 @@
vString - optional, pass a string (e.g. 'uniform') to write as the
RIVER_VERTICAL_DISTRIBUTION in the namelist, bypassing the automated
string generation.
-
+   Alternative vString can be an array of fractional distribution (one per depth)
+   for r = 1:length(Mobj2.river_nodes)
+      Z1=Mobj2.siglevz(Mobj2.river_nodes(r),1:end-1);
+      Z2=Mobj2.siglevz(Mobj2.river_nodes(r),2:end);
+      RivDist(r,:)=(exp(Z1/5)-exp(Z2/5));
+   end
+
OUTPUT:
Namelist for inclusion in the main FVCOM namelist (RIVER_INFO_FILE).
-
+
EXAMPLE USAGE:
-   write_FVCOM_river_nml(Mobj, 'casename_river.nml', 'casename_river.nc')
+   write_FVCOM_river_nml(Mobj, 'casename_river.nml', 'casename_river.nc', RivDist)

Author(s):
Pierre Cazenave (Plymouth Marine Laboratory)
+   Ricardo Torres (Plymouth Marine Laboratory)

Revision history:
2013-03-21 - First version.
2013-08-16 - Add optional fourth argument of a string to supply as the
RIVER_VERTICAL_DISTRIBUTION (e.g. 'uniform').
2013-10-16 - Fix the handling of the optional vString argument.
-
+   2018-03-28 - (RJT) Added the option of outputing float vertical
+   distribution for river flows not just uniform for all rivers.
+   2018-05-08 - Fixed vertical distribution handling to support both the
+   original functionality and the new float distribution.
==========================================================================```
@@ -82,7 +92,7 @@ This function is called by:
```0001 function write_FVCOM_river_nml(Mobj, nml_file, nc_file, vString)
0002 % Write a namelist for the river nodes.
0003 %
-0004 % write_FVCOM_river_nml(Mobj, nml_file, nc_file)
+0004 % write_FVCOM_river_nml(Mobj, nml_file, nc_file, vString))
0005 %
0006 % DESCRIPTION:
0007 %   Using the output of get_POLCOMS_rivers in Mobj, output the river name,
@@ -101,62 +111,83 @@ This function is called by:
0020 %   vString - optional, pass a string (e.g. 'uniform') to write as the
0021 %   RIVER_VERTICAL_DISTRIBUTION in the namelist, bypassing the automated
0022 %   string generation.
-0023 %
-0024 % OUTPUT:
-0025 %   Namelist for inclusion in the main FVCOM namelist (RIVER_INFO_FILE).
-0026 %
-0027 % EXAMPLE USAGE:
-0028 %   write_FVCOM_river_nml(Mobj, 'casename_river.nml', 'casename_river.nc')
+0023 %   Alternative vString can be an array of fractional distribution (one per depth)
+0024 %   for r = 1:length(Mobj2.river_nodes)
+0025 %      Z1=Mobj2.siglevz(Mobj2.river_nodes(r),1:end-1);
+0026 %      Z2=Mobj2.siglevz(Mobj2.river_nodes(r),2:end);
+0027 %      RivDist(r,:)=(exp(Z1/5)-exp(Z2/5));
+0028 %   end
0029 %
-0030 % Author(s):
-0031 %   Pierre Cazenave (Plymouth Marine Laboratory)
+0030 % OUTPUT:
+0031 %   Namelist for inclusion in the main FVCOM namelist (RIVER_INFO_FILE).
0032 %
-0033 % Revision history:
-0034 %   2013-03-21 - First version.
-0035 %   2013-08-16 - Add optional fourth argument of a string to supply as the
-0036 %   RIVER_VERTICAL_DISTRIBUTION (e.g. 'uniform').
-0037 %   2013-10-16 - Fix the handling of the optional vString argument.
-0038 %
-0039 %==========================================================================
-0040
-0041 subname = 'write_FVCOM_river_nml';
-0042
-0043 global ftbverbose;
-0044 if ftbverbose
-0045     fprintf('\nbegin : %s\n', subname)
-0046 end
-0047
-0048 nr = length(Mobj.river_nodes);
-0049
-0050 f = fopen(nml_file, 'w');
-0051 assert(f >= 0, 'Error writing to %s. Check permissions and try again.', nml_file)
+0033 % EXAMPLE USAGE:
+0034 %   write_FVCOM_river_nml(Mobj, 'casename_river.nml', 'casename_river.nc', RivDist)
+0035 %
+0036 % Author(s):
+0037 %   Pierre Cazenave (Plymouth Marine Laboratory)
+0038 %   Ricardo Torres (Plymouth Marine Laboratory)
+0039 %
+0040 % Revision history:
+0041 %   2013-03-21 - First version.
+0042 %   2013-08-16 - Add optional fourth argument of a string to supply as the
+0043 %   RIVER_VERTICAL_DISTRIBUTION (e.g. 'uniform').
+0044 %   2013-10-16 - Fix the handling of the optional vString argument.
+0045 %   2018-03-28 - (RJT) Added the option of outputing float vertical
+0046 %   distribution for river flows not just uniform for all rivers.
+0047 %   2018-05-08 - Fixed vertical distribution handling to support both the
+0048 %   original functionality and the new float distribution.
+0049 %==========================================================================
+0050
+0051 subname = 'write_FVCOM_river_nml';
0052
-0053 % Build the vertical distribution string. Round to 15 decimal places so the
-0054 % unique check works (hopefully no one needs that many vertical layers...).
-0055 vDist = roundn(abs(diff(Mobj.siglev)), -15);
-0056 if length(unique(vDist)) == 1
-0057     vString = '''uniform''';
-0058 elseif nargin <= 3
-0059     vString = char();
-0060     for ii = 1:length(vDist)
-0061         vString = [vString, sprintf('%f ', vDist(ii))];
-0062     end
-0063 end
-0064
-0065 for r = 1:nr
-0066     fprintf(f, ' &NML_RIVER\n');
-0067     fprintf(f, '  RIVER_NAME          = ''%s'',\n', Mobj.river_names{r});
-0068     fprintf(f, '  RIVER_FILE          = ''%s'',\n', nc_file);
-0069     fprintf(f, '  RIVER_GRID_LOCATION = %d,\n', Mobj.river_nodes(r));
-0070     fprintf(f, '  RIVER_VERTICAL_DISTRIBUTION = %s\n', vString);
-0071     fprintf(f, '  /\n');
-0072 end
-0073
-0074 fclose(f);
-0075
-0076 if ftbverbose
-0077     fprintf('end   : %s\n', subname)
-0078 end```
-
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0053 global ftbverbose; +0054 if ftbverbose +0055 fprintf('\nbegin : %s\n', subname) +0056 end +0057 +0058 nr = length(Mobj.river_nodes); +0059 +0060 f = fopen(nml_file, 'w'); +0061 assert(f >= 0, 'Error writing to %s. Check permissions and try again.', nml_file) +0062 +0063 for r = 1:nr +0064 fprintf(f, ' &NML_RIVER\n'); +0065 fprintf(f, ' RIVER_NAME = ''%s'',\n', Mobj.river_names{r}); +0066 fprintf(f, ' RIVER_FILE = ''%s'',\n', nc_file); +0067 fprintf(f, ' RIVER_GRID_LOCATION = %d,\n', Mobj.river_nodes(r)); +0068 +0069 % Build the vertical distribution string. Round to 15 decimal places so +0070 % the unique check works (hopefully no one needs that many vertical +0071 % layers...). +0072 vDist = roundn(abs(diff(Mobj.siglev)), -15); +0073 if length(unique(vDist)) == 1 || ~exist(vString, 'var') +0074 vString = '''uniform'''; +0075 elseif nargin <= 3 +0076 vString = char(); +0077 % loop through each river as they can have different distributions +0078 if ndim(vDist)==1 % only one fixed distribution +0079 for ii = 1:size(vDist) +0080 vString = [vString, sprintf('%f ', vDist(ii))]; +0081 end +0082 end +0083 else % we have different vDist for each river +0084 vString = char(); +0085 for ii = 1:size(vString,2) +0086 vString = [vString2, sprintf('%1.5f ', vString(r,ii))]; +0087 end +0088 end +0089 % Output whatever vertical distribution string we've got to the +0090 % namelist file. +0091 fprintf(f, ' RIVER_VERTICAL_DISTRIBUTION = %s\n', vString); +0092 fprintf(f, ' /\n'); +0093 end +0094 +0095 fclose(f); +0096 +0097 if ftbverbose +0098 fprintf('end : %s\n', subname) +0099 end +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_sediment.html b/doc/fvcom_prepro/write_FVCOM_sediment.html index 6d823f4..de7aa91 100644 --- a/doc/fvcom_prepro/write_FVCOM_sediment.html +++ b/doc/fvcom_prepro/write_FVCOM_sediment.html @@ -190,6 +190,6 @@ This function is called by: 0114 if ftbverbose 0115 fprintf('end : %s\n', subname) 0116 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_spectide.html b/doc/fvcom_prepro/write_FVCOM_spectide.html index 7569794..4566cbf 100755 --- a/doc/fvcom_prepro/write_FVCOM_spectide.html +++ b/doc/fvcom_prepro/write_FVCOM_spectide.html @@ -243,6 +243,6 @@ This function is called by: 0165 0166 if(report); fprintf(['end : ' subname '\n']); end; 0167 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_sponge.html b/doc/fvcom_prepro/write_FVCOM_sponge.html index 661ad49..5ab8eac 100755 --- a/doc/fvcom_prepro/write_FVCOM_sponge.html +++ b/doc/fvcom_prepro/write_FVCOM_sponge.html @@ -192,6 +192,6 @@ This function is called by: 0111 fprintf('end : %s\n', subname) 0112 end 0113 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_stations.html b/doc/fvcom_prepro/write_FVCOM_stations.html index afb8e5b..a6126cf 100644 --- a/doc/fvcom_prepro/write_FVCOM_stations.html +++ b/doc/fvcom_prepro/write_FVCOM_stations.html @@ -137,6 +137,6 @@ This function is called by: 0068 fprintf(['end : ' subname '\n']) 0069 end 0070 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_tsobc.html b/doc/fvcom_prepro/write_FVCOM_tsobc.html index 539ab6e..eca3afc 100644 --- a/doc/fvcom_prepro/write_FVCOM_tsobc.html +++ b/doc/fvcom_prepro/write_FVCOM_tsobc.html @@ -361,6 +361,6 @@ This function is called by: 0249 if ftbverbose 0250 fprintf('end : %s\n', subname) 0251 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_tsobcERSEM.html b/doc/fvcom_prepro/write_FVCOM_tsobcERSEM.html index 425bc67..a71ab1f 100644 --- a/doc/fvcom_prepro/write_FVCOM_tsobcERSEM.html +++ b/doc/fvcom_prepro/write_FVCOM_tsobcERSEM.html @@ -141,7 +141,7 @@ This function is called by: 0077 if ftbverbose 0078 fprintf('\nbegin : %s\n', subname) 0079 end -0080 NNuts=length(ERSEMdata) +0080 NNuts=length(ERSEMdata); 0081 % Default to string times as FVCOM looks for these first. 0082 strtime = true; 0083 inttime = false; @@ -166,7 +166,7 @@ This function is called by: 0102 nObc = length(obc_nodes); 0103 nSiglev = nSiglay + 1; 0104 -0105 if(ftbverbose); fprintf('obc reading complete\n');end; +0105 if ftbverbose; fprintf('obc reading complete\n'); end 0106 0107 %-------------------------------------------------------------------------- 0108 % Generate the requisite data @@ -204,18 +204,18 @@ This function is called by: 0140 dimidname=netcdf.inqDim(nc,dimids(dd)); 0141 switch dimidname 0142 case{'node'} -0143 +0143 0144 nobc_dimid=netcdf.inqDimID(nc,dimidname); 0145 case{'DateStrLen'} 0146 datestrlen_dimid=netcdf.inqDimID(nc,dimidname); 0147 case{'time'} -0148 +0148 0149 time_dimid=netcdf.inqDimID(nc,dimidname); 0150 % read time in case is different from data in file 0151 file_times = netcdf.getVar(nc,netcdf.inqVarID(nc,'Times'))'; 0152 file_timem = datenum(file_times,'yyyy-mm-dd HH:MM:SS.FFF'); 0153 case{'siglay'} -0154 +0154 0155 siglay_dimid=netcdf.inqDimID(nc,dimidname); 0156 case{'siglev'} 0157 siglev_dimid=netcdf.inqDimID(nc,dimidname); @@ -225,59 +225,59 @@ This function is called by: 0161 else 0162 % open boundary forcing 0163 nc = netcdf.create(tsOBCFile, 'clobber'); -0164 +0164 0165 % define global attributes 0166 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'title','Open boundary ERSEM nudging') 0167 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'type','FVCOM TIME SERIES OBC FABM FILE') 0168 netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'history', sprintf('File created with %s from the MATLAB fvcom-toolbox', subname)) -0169 -0170 +0169 +0170 0171 % define dimensions 0172 nobc_dimid=netcdf.defDim(nc,'nobc',nObc); 0173 datestrlen_dimid=netcdf.defDim(nc,'DateStrLen',26); 0174 time_dimid=netcdf.defDim(nc,'time',netcdf.getConstant('NC_UNLIMITED')); 0175 siglay_dimid=netcdf.defDim(nc,'siglay',nSiglay); 0176 siglev_dimid=netcdf.defDim(nc,'siglev',nSiglev); -0177 +0177 0178 % variables 0179 if strtime 0180 Times_varid=netcdf.defVar(nc,'Times','NC_CHAR',[datestrlen_dimid, time_dimid]); 0181 netcdf.putAtt(nc,Times_varid,'time_zone','UTC'); 0182 end -0183 +0183 0184 if floattime 0185 time_varid=netcdf.defVar(nc,'time','NC_FLOAT',time_dimid); 0186 netcdf.putAtt(nc,time_varid,'long_name','time'); 0187 netcdf.putAtt(nc,time_varid,'units','days since 1858-11-17 00:00:00'); 0188 netcdf.putAtt(nc,time_varid,'time_zone','UTC'); 0189 end -0190 +0190 0191 if inttime 0192 itime_varid=netcdf.defVar(nc,'Itime','NC_INT',time_dimid); 0193 netcdf.putAtt(nc,itime_varid,'units','days since 1858-11-17 00:00:00'); 0194 netcdf.putAtt(nc,itime_varid,'format','modified julian day (MJD)'); 0195 netcdf.putAtt(nc,itime_varid,'time_zone','UTC'); -0196 +0196 0197 itime2_varid=netcdf.defVar(nc,'Itime2','NC_INT',time_dimid); 0198 netcdf.putAtt(nc,itime2_varid,'units','msec since 00:00:00'); 0199 netcdf.putAtt(nc,itime2_varid,'time_zone','UTC'); 0200 end -0201 +0201 0202 nobc_varid=netcdf.defVar(nc,'obc_nodes','NC_INT',nobc_dimid); 0203 netcdf.putAtt(nc,nobc_varid,'long_name','Open Boundary Node Number'); 0204 netcdf.putAtt(nc,nobc_varid,'grid','obc_grid'); 0205 netcdf.putAtt(nc,nobc_varid,'type','data'); -0206 +0206 0207 obc_h_varid=netcdf.defVar(nc,'obc_h','NC_FLOAT',nobc_dimid); 0208 netcdf.putAtt(nc,obc_h_varid,'long_name','Open Boundary Depth'); 0209 netcdf.putAtt(nc,obc_h_varid,'units','m'); 0210 netcdf.putAtt(nc,obc_h_varid,'grid','obc_grid'); 0211 netcdf.putAtt(nc,obc_h_varid,'type','data'); -0212 +0212 0213 obc_siglev_varid=netcdf.defVar(nc,'siglev','NC_FLOAT',[nobc_dimid,siglev_dimid]); 0214 netcdf.putAtt(nc,obc_siglev_varid,'long_name','ocean_sigma/general_coordinate'); 0215 netcdf.putAtt(nc,obc_siglev_varid,'grid','obc_grid'); -0216 +0216 0217 obc_siglay_varid=netcdf.defVar(nc,'siglay','NC_FLOAT',[nobc_dimid,siglay_dimid]); 0218 netcdf.putAtt(nc,obc_siglay_varid,'long_name','ocean_sigma/general_coordinate'); 0219 netcdf.putAtt(nc,obc_siglay_varid,'grid','obc_grid'); @@ -337,7 +337,7 @@ This function is called by: 0273 eval(['netcdf.putVar(nc,',varidN{nuts},',Mobj.(ERSEMdata(nuts).name));']) 0274 disp(['Finished with variable, ',ERSEMdata(nuts).name]) 0275 end -0276 +0276 0277 else % file exist and time could be different... check and interpolate if necessary 0278 if length(time) < length(file_timem) 0279 for nuts=1:NNuts @@ -361,7 +361,7 @@ This function is called by: 0297 disp(['We have reversed the Z dimension of variable , ',ERSEMdata(nuts).name]) 0298 disp(['Finished with variable, ',ERSEMdata(nuts).name]) 0299 end -0300 +0300 0301 end 0302 end 0303 % close file @@ -370,6 +370,6 @@ This function is called by: 0306 if ftbverbose 0307 fprintf('end : %s\n', subname) 0308 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_wind_ts_speed.html b/doc/fvcom_prepro/write_FVCOM_wind_ts_speed.html index 94129c5..6c1648b 100644 --- a/doc/fvcom_prepro/write_FVCOM_wind_ts_speed.html +++ b/doc/fvcom_prepro/write_FVCOM_wind_ts_speed.html @@ -200,6 +200,6 @@ This function is called by: 0117 0118 0119 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_FVCOM_z0.html b/doc/fvcom_prepro/write_FVCOM_z0.html index 18669b3..98753ce 100755 --- a/doc/fvcom_prepro/write_FVCOM_z0.html +++ b/doc/fvcom_prepro/write_FVCOM_z0.html @@ -182,6 +182,6 @@ This function is called by: 0105 if ftbverbose 0106 fprintf('end : %s\n', subname) 0107 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_WRF_forcing.html b/doc/fvcom_prepro/write_WRF_forcing.html index 1007032..3191fb5 100644 --- a/doc/fvcom_prepro/write_WRF_forcing.html +++ b/doc/fvcom_prepro/write_WRF_forcing.html @@ -319,6 +319,6 @@ This function is called by: 0228 if ftbverbose 0229 fprintf('end : %s \n', subname) 0230 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_admesh_mesh.html b/doc/fvcom_prepro/write_admesh_mesh.html index 7f08a86..fc2a131 100644 --- a/doc/fvcom_prepro/write_admesh_mesh.html +++ b/doc/fvcom_prepro/write_admesh_mesh.html @@ -229,6 +229,6 @@ This function is called by: 0154 if ftbverbose 0155 fprintf('end : %s\n', subname) 0156 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_dtank.html b/doc/fvcom_prepro/write_dtank.html index 87252c1..b71d1ad 100755 --- a/doc/fvcom_prepro/write_dtank.html +++ b/doc/fvcom_prepro/write_dtank.html @@ -169,6 +169,6 @@ This function is called by: 0108 0109 fclose(fid); 0110 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_model_nml.html b/doc/fvcom_prepro/write_model_nml.html index b0c25fe..1efc32c 100644 --- a/doc/fvcom_prepro/write_model_nml.html +++ b/doc/fvcom_prepro/write_model_nml.html @@ -122,6 +122,6 @@ This function is called by: 0058 end 0059 res = fclose(fnml); 0060 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_nesting_bdy_file.html b/doc/fvcom_prepro/write_nesting_bdy_file.html index a6a4cad..9408eb7 100644 --- a/doc/fvcom_prepro/write_nesting_bdy_file.html +++ b/doc/fvcom_prepro/write_nesting_bdy_file.html @@ -551,6 +551,6 @@ This function is called by: 0471 0472 0473 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/fvcom_prepro/write_river_info.html b/doc/fvcom_prepro/write_river_info.html index 147f154..4d72b70 100755 --- a/doc/fvcom_prepro/write_river_info.html +++ b/doc/fvcom_prepro/write_river_info.html @@ -122,6 +122,6 @@ This function is called by: 0054 0055 fprintf(['end : ' subname '\n']) 0056 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/index.html b/doc/index.html index d8f522d..32ec66b 100755 --- a/doc/index.html +++ b/doc/index.html @@ -19,67 +19,68 @@

## Matlab Files found in these Directories

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + example_fetchcalc interp_coarse_to_obc set_elevtide_tmd ww3_to_swan_bndry + example_surface_plot interp_sst_assimilation set_spectide zero_to_nan + extract_mesoscale interpolate_near_coast setup_metrics -
Generated on Thu 01-Feb-2018 09:48:58 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:05:59 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/calc_fetch.html b/doc/swan_scripts/calc_fetch.html index fa5ba26..76243df 100755 --- a/doc/swan_scripts/calc_fetch.html +++ b/doc/swan_scripts/calc_fetch.html @@ -194,6 +194,6 @@ This function is called by: 0121 fetch = mind; 0122 0123 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/calc_tauw.html b/doc/swan_scripts/calc_tauw.html index 597ca14..d891788 100755 --- a/doc/swan_scripts/calc_tauw.html +++ b/doc/swan_scripts/calc_tauw.html @@ -231,6 +231,6 @@ This function is called by: 0150 0151 0152 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/example_fetchcalc.html b/doc/swan_scripts/example_fetchcalc.html index 736069d..fd683dd 100755 --- a/doc/swan_scripts/example_fetchcalc.html +++ b/doc/swan_scripts/example_fetchcalc.html @@ -71,6 +71,6 @@ This function is called by: 0027 fprintf('fetch from east wind %f\n',fetch); 0028 [fetch] = get_fetch(re41fetch,0,-1,2.0); 0029 fprintf('fetch from north wind %f\n',fetch); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/fetch_calc.html b/doc/swan_scripts/fetch_calc.html index 8de7ce6..caf1bfd 100755 --- a/doc/swan_scripts/fetch_calc.html +++ b/doc/swan_scripts/fetch_calc.html @@ -217,6 +217,6 @@ This function is called by: 0129 fetch_struct.hmesh = h; 0130 0131 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/fvcom2swan.html b/doc/swan_scripts/fvcom2swan.html index c0ae922..3625869 100755 --- a/doc/swan_scripts/fvcom2swan.html +++ b/doc/swan_scripts/fvcom2swan.html @@ -274,6 +274,6 @@ This function is called by: 0203 0204 fprintf(['end : ' subname '\n']) 0205 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/get_fetch.html b/doc/swan_scripts/get_fetch.html index cf1cdd9..78fb02a 100755 --- a/doc/swan_scripts/get_fetch.html +++ b/doc/swan_scripts/get_fetch.html @@ -124,6 +124,6 @@ This function is called by: 0053 % set fetch 0054 fetch = f.fetch(itheta,izeta); 0055 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/graph.html b/doc/swan_scripts/graph.html index 923b131..ed8cc5a 100644 --- a/doc/swan_scripts/graph.html +++ b/doc/swan_scripts/graph.html @@ -36,6 +36,6 @@ -
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/ideal_swan_obc.html b/doc/swan_scripts/ideal_swan_obc.html index a25a967..f912693 100755 --- a/doc/swan_scripts/ideal_swan_obc.html +++ b/doc/swan_scripts/ideal_swan_obc.html @@ -202,6 +202,6 @@ This function is called by: 0123 fprintf(fid,'%12.2f %s %d %s\n',aobc(i),fname,1,'&'); 0124 end; 0125 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/ideal_swan_obc_driver_example.html b/doc/swan_scripts/ideal_swan_obc_driver_example.html index ca39310..3414b46 100755 --- a/doc/swan_scripts/ideal_swan_obc_driver_example.html +++ b/doc/swan_scripts/ideal_swan_obc_driver_example.html @@ -71,6 +71,6 @@ This function is called by: 0020 inc = 5; 0021 ideal_swan_obc(nodefile,time,hs,tp,dir,inc,spread); 0022 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/index.html b/doc/swan_scripts/index.html index c362855..87ec00d 100755 --- a/doc/swan_scripts/index.html +++ b/doc/swan_scripts/index.html @@ -27,6 +27,6 @@
-
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/plot_swan_mesh.html b/doc/swan_scripts/plot_swan_mesh.html index d21e2d8..39d6c2e 100755 --- a/doc/swan_scripts/plot_swan_mesh.html +++ b/doc/swan_scripts/plot_swan_mesh.html @@ -125,6 +125,6 @@ This function is called by: 0058 fprintf(['end : ' subname '\n']) 0059 0060 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/plotunswan.html b/doc/swan_scripts/plotunswan.html index a073722..1bb42eb 100755 --- a/doc/swan_scripts/plotunswan.html +++ b/doc/swan_scripts/plotunswan.html @@ -95,6 +95,6 @@ This function is called by: 0033 trisurf(tri(:,2:4),Xp,Yp,z) % make plot using trisurf 0034 view(0,90);shading interp; % make 2D view and smooth plot 0035 colormap(jet);colorbar;axis equal % include colorbar and equal axes -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/read_specfile.html b/doc/swan_scripts/read_specfile.html index a10556c..3b10b96 100755 --- a/doc/swan_scripts/read_specfile.html +++ b/doc/swan_scripts/read_specfile.html @@ -180,6 +180,6 @@ This function is called by: 0116 plot(1./freq,dens(i,:)); hold on; 0117 end; 0118 end; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/show_fetch.html b/doc/swan_scripts/show_fetch.html index 3a6b3c9..6de2bc8 100755 --- a/doc/swan_scripts/show_fetch.html +++ b/doc/swan_scripts/show_fetch.html @@ -108,6 +108,6 @@ This function is called by: 0043 end; 0044 xlabel('Cartesian wind angle: e.g. pi/2 is south wind'); 0045 ylabel('fetch in km'); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/swan2netcdf.html b/doc/swan_scripts/swan2netcdf.html index 54bc5e7..ba5a894 100755 --- a/doc/swan_scripts/swan2netcdf.html +++ b/doc/swan_scripts/swan2netcdf.html @@ -518,6 +518,6 @@ This function is called by: 0412 0413 0414 nc = close(nc); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/swan_scripts/ww3_to_swan_bndry.html b/doc/swan_scripts/ww3_to_swan_bndry.html index 32464c8..d8de8c3 100755 --- a/doc/swan_scripts/ww3_to_swan_bndry.html +++ b/doc/swan_scripts/ww3_to_swan_bndry.html @@ -388,6 +388,6 @@ This function is called by: 0308 fprintf(fid,'%12.2f %s %d %s\n',aobc(i),fname,1,'&'); 0309 end; 0310 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/fvcom_prepro/graph.html b/doc/tests/fvcom_prepro/graph.html index e7bc436..66313c8 100644 --- a/doc/tests/fvcom_prepro/graph.html +++ b/doc/tests/fvcom_prepro/graph.html @@ -23,6 +23,6 @@ -
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/fvcom_prepro/index.html b/doc/tests/fvcom_prepro/index.html index 381736c..e803eb5 100644 --- a/doc/tests/fvcom_prepro/index.html +++ b/doc/tests/fvcom_prepro/index.html @@ -27,6 +27,6 @@
-
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/fvcom_prepro/test_write_FVCOM_tsobc.html b/doc/tests/fvcom_prepro/test_write_FVCOM_tsobc.html index 461d118..37effc6 100644 --- a/doc/tests/fvcom_prepro/test_write_FVCOM_tsobc.html +++ b/doc/tests/fvcom_prepro/test_write_FVCOM_tsobc.html @@ -170,6 +170,6 @@ This function is called by: 0107 warning('Input and output of ''%s'' differ by at most %g. Test FAILED.', outvars{v}, max(ncdiffs(:))) 0108 end 0109 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/utilities/graph.html b/doc/tests/utilities/graph.html index 2591af5..92fb418 100644 --- a/doc/tests/utilities/graph.html +++ b/doc/tests/utilities/graph.html @@ -24,6 +24,6 @@ -
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/utilities/index.html b/doc/tests/utilities/index.html index f135d6f..af2e1d3 100644 --- a/doc/tests/utilities/index.html +++ b/doc/tests/utilities/index.html @@ -27,6 +27,6 @@
-
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/utilities/test_get_POLCOMS_tsobc.html b/doc/tests/utilities/test_get_POLCOMS_tsobc.html index 9c1b7b5..1a93389 100644 --- a/doc/tests/utilities/test_get_POLCOMS_tsobc.html +++ b/doc/tests/utilities/test_get_POLCOMS_tsobc.html @@ -295,6 +295,6 @@ This function is called by: 0228 fprintf('\n------------------SUMMARY------------------\n') 0229 fprintf(' %d of %d tests passed', totalPasses, totalTests) 0230 fprintf('\n-------------------------------------------\n') -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/tests/utilities/test_grid2fvcom.html b/doc/tests/utilities/test_grid2fvcom.html index 903d84e..59379f5 100644 --- a/doc/tests/utilities/test_grid2fvcom.html +++ b/doc/tests/utilities/test_grid2fvcom.html @@ -251,6 +251,6 @@ This function is called by: 0185 fprintf('\n------------------SUMMARY------------------\n') 0186 fprintf(' %d of %d tests passed', totalPasses, totalTests) 0187 fprintf('\n-------------------------------------------\n') -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ComputeMatrixRx1_nodes.html b/doc/utilities/ComputeMatrixRx1_nodes.html new file mode 100644 index 0000000..826fb8c --- /dev/null +++ b/doc/utilities/ComputeMatrixRx1_nodes.html @@ -0,0 +1,147 @@ + + + + Description of ComputeMatrixRx1_nodes + + + + + + + + + +
Home > utilities > ComputeMatrixRx1_nodes.m
+ + + +

# ComputeMatrixRx1_nodes +

+ +

+
+ +

## SYNOPSIS

+
function RX1matrix=ComputeMatrixRx1_nodes(Z_w, Mobj)
+ +

## DESCRIPTION

+
``` Computes rx1 matrix as in ComputeMatrixRx1_V2.m downloaded from
+ https://github.com/dcherian/tools
+
+ function [RX1matrix] = ComputeMatrixRx1_nodes(Z_w, Mobj)
+
+ DESCRIPTION:
+    Calculates the hydrostatic consistency condition:
+      r = abs(Sigma/H deltaxH/deltaSigma)
+    this reflects the errors associated with horizontal pressure gradients
+    calculations that are associated with steep bathyemtry and low
+    vertical resolution.
+
+ INPUT
+   Z_w    = This is the sigmal layer vertical distribution in Z coordinates
+   Mobj   = needs triangulation and mesh information
+            table. read_sms_mesh provides everything it needs.
+
+
+ OUTPUT:
+    RX1matrix = node based field with values of max(rx1)
+
+ EXAMPLE USAGE
+    [RX1matrix] = ComputeMatrixRx1_nodes(Z_w, Mobj)
+
+ Author(s):
+    Ricardo Torres (Plymouth Marine Laboratory) based on ComputeMatrixRx1_V2
+
+ Revision history
+
+   2018-03-22 First version.
+
+==============================================================================```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function RX1matrix=ComputeMatrixRx1_nodes(Z_w, Mobj)
+0003 % https://github.com/dcherian/tools
+0004 %
+0005 % function [RX1matrix] = ComputeMatrixRx1_nodes(Z_w, Mobj)
+0006 %
+0007 % DESCRIPTION:
+0008 %    Calculates the hydrostatic consistency condition:
+0009 %      r = abs(Sigma/H deltaxH/deltaSigma)
+0010 %    this reflects the errors associated with horizontal pressure gradients
+0011 %    calculations that are associated with steep bathyemtry and low
+0012 %    vertical resolution.
+0013 %
+0014 % INPUT
+0015 %   Z_w    = This is the sigmal layer vertical distribution in Z coordinates
+0016 %   Mobj   = needs triangulation and mesh information
+0017 %            table. read_sms_mesh provides everything it needs.
+0018 %
+0019 %
+0020 % OUTPUT:
+0021 %    RX1matrix = node based field with values of max(rx1)
+0022 %
+0023 % EXAMPLE USAGE
+0024 %    [RX1matrix] = ComputeMatrixRx1_nodes(Z_w, Mobj)
+0025 %
+0026 % Author(s):
+0027 %    Ricardo Torres (Plymouth Marine Laboratory) based on ComputeMatrixRx1_V2
+0028 %
+0029 % Revision history
+0030 %
+0031 %   2018-03-22 First version.
+0032 %
+0033 %==============================================================================
+0034
+0035 subname = 'ComputeMatrixRx1_nodes';
+0036 global ftbverbose
+0037 if ftbverbose
+0038     fprintf('\nbegin : %s \n', subname)
+0039 end
+0040 %--------------------------------------------------------------------------
+0041 % Estimate dimensins of mesh based on array's sizes
+0042 %--------------------------------------------------------------------------
+0043
+0044 N=size(Z_w,2)-1;
+0045 nNodes = size(Z_w,1);
+0046 RX1matrix=zeros(nNodes,1);
+0047 TR = triangulation(Mobj.tri, [Mobj.x, Mobj.y]);
+0048 % loop through all Nodes
+0049 for iXi=1:nNodes
+0050     rx1=0;
+0051 % Find neighbouring nodes for the node under consideration
+0052     ti = cell2mat(vertexAttachments(TR,iXi));
+0053     vertices = setdiff(unique(TR.ConnectivityList(ti,:)),iXi);
+0054 % calculate max rx1 values in the vertical and horizontal among all neighbouring nodes
+0055     for nn=1:length(vertices)
+0056         for i=1:N
+0057             a1=abs(Z_w(iXi,i+1) - Z_w(vertices(nn),i+1) + ...
+0058                 Z_w(iXi,i) - Z_w(vertices(nn),i));
+0059             b1=abs(Z_w(iXi,i+1) + Z_w(vertices(nn),i+1) - ...
+0060                 Z_w(iXi,i) - Z_w(vertices(nn),i));
+0061             quot=abs(a1/b1);
+0062             rx1=max(rx1, quot);
+0063         end
+0064     end
+0065     RX1matrix(iXi)=rx1;
+0066 end
+0067 if ftbverbose
+0068   fprintf('end   : %s\n', subname)
+0069 end```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/utilities/ST_Dstar.html b/doc/utilities/ST_Dstar.html index 19d78cc..d89d92c 100755 --- a/doc/utilities/ST_Dstar.html +++ b/doc/utilities/ST_Dstar.html @@ -147,6 +147,6 @@ This function is called by: 0077 if ftbverbose 0078 fprintf('end : %s\n', subname) 0079 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_d2phi.html b/doc/utilities/ST_d2phi.html index 443a91e..c63f982 100755 --- a/doc/utilities/ST_d2phi.html +++ b/doc/utilities/ST_d2phi.html @@ -97,6 +97,6 @@ This function is called by: 0032 phi = -log2(d*1000); 0033 0034 %fprintf(['end : ' subname '\n']) -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_erate.html b/doc/utilities/ST_erate.html index f985087..0607a31 100755 --- a/doc/utilities/ST_erate.html +++ b/doc/utilities/ST_erate.html @@ -152,6 +152,6 @@ This function is called by: 0075 if ftbverbose 0076 fprintf('end : %s\n', subname) 0077 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_example.html b/doc/utilities/ST_example.html index d4740fd..f92d949 100755 --- a/doc/utilities/ST_example.html +++ b/doc/utilities/ST_example.html @@ -99,6 +99,6 @@ This function is called by: 0039 xlabel('Grain diameter (mm)') 0040 ylabel('critical shear Pa') 0041 axis([.01,10,.01,10]) -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_phi2d.html b/doc/utilities/ST_phi2d.html index ed6ea8d..0fba5c0 100755 --- a/doc/utilities/ST_phi2d.html +++ b/doc/utilities/ST_phi2d.html @@ -103,6 +103,6 @@ This function is called by: 0038 if ftbverbose 0039 fprintf('end : %s\n', subname) 0040 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_summary.html b/doc/utilities/ST_summary.html index 3b4e0c7..facf54e 100755 --- a/doc/utilities/ST_summary.html +++ b/doc/utilities/ST_summary.html @@ -140,6 +140,6 @@ This function is called by: 0069 fprintf('%10d %20s %8.4f %8.2f %9.4f %8.3f %8.3f\n',phi,phiclass,d*1000,Dstar,Wset*1000,Taucr,1000*erate) 0070 0071 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_taucr.html b/doc/utilities/ST_taucr.html index d924d79..d97056d 100755 --- a/doc/utilities/ST_taucr.html +++ b/doc/utilities/ST_taucr.html @@ -152,6 +152,6 @@ This function is called by: 0080 if ftbverbose 0081 fprintf('end : %s\n', subname) 0082 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_wentworth.html b/doc/utilities/ST_wentworth.html index 3c469eb..6a93c39 100755 --- a/doc/utilities/ST_wentworth.html +++ b/doc/utilities/ST_wentworth.html @@ -105,6 +105,6 @@ This function is called by: 0040 if ftbverbose 0041 fprintf('end : %s\n', subname) 0042 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ST_wset.html b/doc/utilities/ST_wset.html index 1f9c291..ae04b1d 100755 --- a/doc/utilities/ST_wset.html +++ b/doc/utilities/ST_wset.html @@ -152,6 +152,6 @@ This function is called by: 0081 if ftbverbose 0082 fprintf('end : %s\n', subname) 0083 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/SW_Density.html b/doc/utilities/SW_Density.html index 83db6d7..35e4dda 100755 --- a/doc/utilities/SW_Density.html +++ b/doc/utilities/SW_Density.html @@ -179,6 +179,6 @@ This function is called by: 0094 if ftbverbose 0095 fprintf('end : %s\n', subname) 0096 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/SW_Kviscosity.html b/doc/utilities/SW_Kviscosity.html index 04caf2c..810c31d 100755 --- a/doc/utilities/SW_Kviscosity.html +++ b/doc/utilities/SW_Kviscosity.html @@ -50,6 +50,6 @@ This function is called by: 0005 rho = SW_Density(T,S); 0006 new = mu./rho; 0007 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/SW_Viscosity.html b/doc/utilities/SW_Viscosity.html index 51bb573..86fc619 100755 --- a/doc/utilities/SW_Viscosity.html +++ b/doc/utilities/SW_Viscosity.html @@ -156,6 +156,6 @@ This function is called by: 0077 end 0078 end 0079 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/Times2Datetime.html b/doc/utilities/Times2Datetime.html new file mode 100644 index 0000000..b385c50 --- /dev/null +++ b/doc/utilities/Times2Datetime.html @@ -0,0 +1,68 @@ + + + + Description of Times2Datetime + + + + + + + + + +
Home > utilities > Times2Datetime.m
+ + + +

# Times2Datetime +

+ +

## PURPOSE

+
TIMES2DATETIME Converts the 'Times' variable from a FVCOM output file to
+ +

## SYNOPSIS

+
function [ outputDTs ] = Times2Matlab( Times )
+ +

## DESCRIPTION

+
```TIMES2DATETIME Converts the 'Times' variable from a FVCOM output file to
+a Matlab Datetime array. This isn't gonna work if the FVCOM model isn't using
+ Julian dates.
+   Input: 'Times' variable, already read from a FVCOM netCDF output file.
+   Output: Array of Matlab Datetime objects, one for each timestep.```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function [ outputDTs ] = Times2Matlab( Times )
+0002 %TIMES2DATETIME Converts the 'Times' variable from a FVCOM output file to
+0003 %a Matlab Datetime array. This isn't gonna work if the FVCOM model isn't using
+0004 % Julian dates.
+0005 %   Input: 'Times' variable, already read from a FVCOM netCDF output file.
+0006 %   Output: Array of Matlab Datetime objects, one for each timestep.
+0007
+0008 % NB time zones are not considered.
+0009
+0010 %   Simon Waldman / Marine Scotland Science 2018.
+0011
+0012 assert(ischar(Times), 'Input should be a character array.');
+0013
+0014 outputDTs = datetime( Times', 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss.SSSSSS');
+0015
+0016 end
+0017```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/utilities/Times2Matlab.html b/doc/utilities/Times2Matlab.html index 3e3a513..376e4b7 100644 --- a/doc/utilities/Times2Matlab.html +++ b/doc/utilities/Times2Matlab.html @@ -64,6 +64,6 @@ This function is called by: 0016 0017 end 0018 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/calc_scoord.html b/doc/utilities/calc_scoord.html index d3a1f6a..a612c8a 100644 --- a/doc/utilities/calc_scoord.html +++ b/doc/utilities/calc_scoord.html @@ -205,6 +205,6 @@ This function is called by: 0152 polcoms.dsuv=dsuv; 0153 0154 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/catstruct.html b/doc/utilities/catstruct.html index 8ddaae3..b43f498 100644 --- a/doc/utilities/catstruct.html +++ b/doc/utilities/catstruct.html @@ -223,6 +223,6 @@ This function is called by: 0139 0140 0141 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/centroid.html b/doc/utilities/centroid.html index 0537528..66d6f4e 100644 --- a/doc/utilities/centroid.html +++ b/doc/utilities/centroid.html @@ -68,6 +68,6 @@ This function is called by: 0018 a = 1/2*sum (x.*y2-x2.*y); 0019 x0 = 1/6*sum((x.*y2-x2.*y).*(x+x2))/a; 0020 y0 = 1/6*sum((x.*y2-x2.*y).*(y+y2))/a; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/check_wset.html b/doc/utilities/check_wset.html index cab4418..cfaef3b 100755 --- a/doc/utilities/check_wset.html +++ b/doc/utilities/check_wset.html @@ -145,6 +145,6 @@ This function is called by: 0074 0075 0076 %fprintf(['end : ' subname '\n']) -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/concat_by_struct.html b/doc/utilities/concat_by_struct.html new file mode 100644 index 0000000..5404ede --- /dev/null +++ b/doc/utilities/concat_by_struct.html @@ -0,0 +1,135 @@ + + + + Description of concat_by_struct + + + + + + + + + +
Home > utilities > concat_by_struct.m
+ + + +

# concat_by_struct +

+ +

## PURPOSE

+
A function to concatenate data contained within a structure.
+ +

## SYNOPSIS

+
function all_data = concat_by_struct(in_struct,last)
+ +

## DESCRIPTION

+
``` A function to concatenate data contained within a structure.
+     does something like cat(1,data(:).*);
+ function all_data = concat_by_struct(in_struct,last)
+
+ DESCRIPTION:
+    Concatenates data contained within a structure. It only works on the first dimension unless
+     logical variable "last" is set to true.
+
+ INPUT
+   in_struct  = Structured variable with dimension such as
+        in_struct(1:10).data1, in_struct(1:10).data2...
+   last       = logical variable. Enable to work on last dimension only
+
+ OUTPUT:
+    all_data = struct with first dimension removed.
+
+ EXAMPLE USAGE
+    all_data = concat_by_struct(in_struct,true)
+
+ Author(s):
+    Ricardo Torres (Plymouth Marine Laboratory)
+
+ Revision history
+
+   2018-03-22 First version in fvcom-toolbox.
+
+==============================================================================```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function all_data = concat_by_struct(in_struct,last)
+0002
+0003 % A function to concatenate data contained within a structure.
+0004 %     does something like cat(1,data(:).*);
+0005 % function all_data = concat_by_struct(in_struct,last)
+0006 %
+0007 % DESCRIPTION:
+0008 %    Concatenates data contained within a structure. It only works on the first dimension unless
+0009 %     logical variable "last" is set to true.
+0010 %
+0011 % INPUT
+0012 %   in_struct  = Structured variable with dimension such as
+0013 %        in_struct(1:10).data1, in_struct(1:10).data2...
+0014 %   last       = logical variable. Enable to work on last dimension only
+0015 %
+0016 % OUTPUT:
+0017 %    all_data = struct with first dimension removed.
+0018 %
+0019 % EXAMPLE USAGE
+0020 %    all_data = concat_by_struct(in_struct,true)
+0021 %
+0022 % Author(s):
+0023 %    Ricardo Torres (Plymouth Marine Laboratory)
+0024 %
+0025 % Revision history
+0026 %
+0027 %   2018-03-22 First version in fvcom-toolbox.
+0028 %
+0029 %==============================================================================
+0030
+0031 subname = mfilename;
+0032 global ftbverbose
+0033 if ftbverbose
+0034     fprintf('\nbegin : %s \n', subname)
+0035 end
+0036
+0037 vars = fieldnames(in_struct);
+0038 maxl=1;sizes=1;
+0039 for kk = 1:size(vars,1)
+0040 % find largest record
+0041 eval(['xyz=size(in_struct(1).',char(vars(kk)) ');'])
+0042 sizes=[sizes;xyz(:)];;
+0043 end
+0044
+0045 for kk = 1:size(vars,1)
+0046     if eval(['isstruct(in_struct(1).' char(vars(kk)) ')'])
+0047         in_vars = fieldnames(in_struct);
+0048         eval(['all_data.' char(vars(kk)) ' = concat_by_struct([in_struct.' char(vars(kk)) '],last);']);
+0049     else
+0050         eval(['xyz=ndims(in_struct(1).',char(vars(kk)) ');'])
+0051         if last % If concatenating on the last dimension
+0052
+0053                 eval(['all_data.' char(vars(kk)) ' = cat(xyz,in_struct(:).' char(vars(kk)) ');']);
+0054         else % concatenate on the first dimension
+0055                     eval(['all_data.' char(vars(kk)) ' = cat(1,in_struct(:).' char(vars(kk)) ');']);
+0056         end
+0057     end
+0058 end
+0059
+0060 if ftbverbose
+0061   fprintf('end   : %s\n', subname)
+0062 end```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/utilities/connectivity.html b/doc/utilities/connectivity.html index 74103f6..0366817 100644 --- a/doc/utilities/connectivity.html +++ b/doc/utilities/connectivity.html @@ -135,6 +135,6 @@ This function is called by: 0070 bnd(e(e2t(:,2)==0,:)) = true; % True for bnd nodes 0071 0072 end % connectivity() -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/deg2utm.html b/doc/utilities/deg2utm.html index 34f4f4e..13d5a05 100644 --- a/doc/utilities/deg2utm.html +++ b/doc/utilities/deg2utm.html @@ -219,6 +219,6 @@ This function is called by: 0131 utmzone(i,:)=sprintf('%02d %c',Huso,Letra); 0132 end 0133 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/densatp.html b/doc/utilities/densatp.html index 5a705c6..40e4435 100644 --- a/doc/utilities/densatp.html +++ b/doc/utilities/densatp.html @@ -160,6 +160,6 @@ This function is called by: 0104 % CONVERT KG/M3 TO g/cc 0105 0106 rhp = RHP ./ 1000; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/depth2pressure.html b/doc/utilities/depth2pressure.html index 00c9197..023308a 100644 --- a/doc/utilities/depth2pressure.html +++ b/doc/utilities/depth2pressure.html @@ -70,6 +70,6 @@ This function is called by: 0019 D=sin(PLAT); 0020 C1=5.92E-3+(D.*D)*5.25E-3; 0021 P80=((1-C1)-sqrt(((1-C1).^2)-(8.84E-6*DPTH)))/4.42E-6; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/distance_along_BC.html b/doc/utilities/distance_along_BC.html index 78f8249..6897e0f 100644 --- a/doc/utilities/distance_along_BC.html +++ b/doc/utilities/distance_along_BC.html @@ -133,6 +133,6 @@ This function is called by: 0069 fprintf('end : %s \n', subname) 0070 end 0071 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/distance_to_coast.html b/doc/utilities/distance_to_coast.html index f867876..2479c33 100644 --- a/doc/utilities/distance_to_coast.html +++ b/doc/utilities/distance_to_coast.html @@ -134,6 +134,6 @@ This function is called by: 0071 end 0072 0073 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/find_boundary_elements.html b/doc/utilities/find_boundary_elements.html index dcc2fd1..3f550e5 100644 --- a/doc/utilities/find_boundary_elements.html +++ b/doc/utilities/find_boundary_elements.html @@ -172,6 +172,6 @@ This function is called by: 0091 if ftbverbose 0092 fprintf('end : %s \n', subname) 0093 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/find_relaxation_boundary.html b/doc/utilities/find_relaxation_boundary.html index 1da53a9..86b31de 100644 --- a/doc/utilities/find_relaxation_boundary.html +++ b/doc/utilities/find_relaxation_boundary.html @@ -210,6 +210,6 @@ This function is called by: 0122 if ftbverbose 0123 fprintf('end : %s \n', subname) 0124 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/fix_inside_boundary.html b/doc/utilities/fix_inside_boundary.html index b5ae6e6..8706650 100644 --- a/doc/utilities/fix_inside_boundary.html +++ b/doc/utilities/fix_inside_boundary.html @@ -297,6 +297,6 @@ This function is called by: 0206 % 0207 % xlabel('Eastings') 0208 % ylabel('Northings') -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/get_BADC_data.html b/doc/utilities/get_BADC_data.html index 2e1c1d7..492f58a 100644 --- a/doc/utilities/get_BADC_data.html +++ b/doc/utilities/get_BADC_data.html @@ -129,6 +129,6 @@ This function is called by: 0067 close(remote) 0068 end 0069 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/get_NCEP_year.html b/doc/utilities/get_NCEP_year.html index b53d34d..fc2af87 100644 --- a/doc/utilities/get_NCEP_year.html +++ b/doc/utilities/get_NCEP_year.html @@ -80,6 +80,6 @@ This function is called by: 0020 [~, tmp_year, ~] = fileparts(file); 0021 tmp_year = regexp(tmp_year, '\.', 'split'); 0022 year = str2double(tmp_year(end)); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/get_polcoms_fixed_vars.html b/doc/utilities/get_polcoms_fixed_vars.html index 5eb2469..a918d9f 100644 --- a/doc/utilities/get_polcoms_fixed_vars.html +++ b/doc/utilities/get_polcoms_fixed_vars.html @@ -110,6 +110,6 @@ This function is called by: 0058 polcoms.latu=polcoms.latu'; 0059 [polcoms]=calc_scoord(polcoms); 0060 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/get_polcoms_timeseriesv1.html b/doc/utilities/get_polcoms_timeseriesv1.html index 20043cd..46bcf0e 100644 --- a/doc/utilities/get_polcoms_timeseriesv1.html +++ b/doc/utilities/get_polcoms_timeseriesv1.html @@ -150,6 +150,6 @@ This function is called by: 0104 0105 % Close the MATLAB pool if we opened it. 0106 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/get_runs.html b/doc/utilities/get_runs.html index 128ee95..59ec761 100644 --- a/doc/utilities/get_runs.html +++ b/doc/utilities/get_runs.html @@ -129,6 +129,6 @@ This function is called by: 0081 0082 end 0083 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/get_runs_test.html b/doc/utilities/get_runs_test.html index 785cbb9..10e61ae 100644 --- a/doc/utilities/get_runs_test.html +++ b/doc/utilities/get_runs_test.html @@ -513,6 +513,6 @@ This function is called by: 0467 % end 0468 0469 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/ginput2.html b/doc/utilities/ginput2.html index 6a821bd..2b0f459 100755 --- a/doc/utilities/ginput2.html +++ b/doc/utilities/ginput2.html @@ -826,6 +826,6 @@ This function is called by: 0669 0670 0671 % [EOF] ginput2.m -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/greg2julian.html b/doc/utilities/greg2julian.html index 2583787..b71b015 100755 --- a/doc/utilities/greg2julian.html +++ b/doc/utilities/greg2julian.html @@ -151,6 +151,6 @@ This function is called by: 0061 julianday = julianday{n+1}; 0062 0063 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/greg2mjulian.html b/doc/utilities/greg2mjulian.html index 56bac8b..148c82c 100755 --- a/doc/utilities/greg2mjulian.html +++ b/doc/utilities/greg2mjulian.html @@ -54,6 +54,6 @@ This function is called by: 0006 % See GREG2JULIAN. 0007 0008 mjulianday = greg2julian(year,month,day,hour,mint,sec)-2400000.5; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/grid2fvcom.html b/doc/utilities/grid2fvcom.html index 31137bc..deb7880 100644 --- a/doc/utilities/grid2fvcom.html +++ b/doc/utilities/grid2fvcom.html @@ -474,6 +474,6 @@ This function is called by: 0340 % end 0341 % axis([min(Mobj.lon), max(Mobj.lon), min(Mobj.lat), max(Mobj.lat)]) 0342 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/grid_vert_interp.html b/doc/utilities/grid_vert_interp.html index b820206..b695014 100644 --- a/doc/utilities/grid_vert_interp.html +++ b/doc/utilities/grid_vert_interp.html @@ -304,6 +304,6 @@ This function is called by: 0197 if ftbverbose 0198 fprintf(['end : ' subname '\n']) 0199 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/gridvecs.html b/doc/utilities/gridvecs.html index 5395b56..f0ebe71 100755 --- a/doc/utilities/gridvecs.html +++ b/doc/utilities/gridvecs.html @@ -125,6 +125,6 @@ This function is called by: 0074 fprintf(fid,'%d\n',node(i)); 0075 end; 0076 fclose(fid); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/inbox.html b/doc/utilities/inbox.html index 9ec9aad..ce55185 100755 --- a/doc/utilities/inbox.html +++ b/doc/utilities/inbox.html @@ -48,6 +48,6 @@ This function is called by: 0004 pts = find( x > box(1) & x < box(2) & y >box(3) & y < box(4)); 0005 0006 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/index.html b/doc/utilities/index.html index 5eba177..59bbd68 100755 --- a/doc/utilities/index.html +++ b/doc/utilities/index.html @@ -19,7 +19,7 @@

## Matlab files in this directory:

-
-
Generated on Thu 01-Feb-2018 09:48:59 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:00 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/inkmlbb.html b/doc/utilities/inkmlbb.html index f19c3c5..30c6340 100755 --- a/doc/utilities/inkmlbb.html +++ b/doc/utilities/inkmlbb.html @@ -82,6 +82,6 @@ This function is called by: 0036 %axis equal 0037 %colorbar 0038 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/interpolate_near_coast.html b/doc/utilities/interpolate_near_coast.html index 1ac04b9..11f8286 100644 --- a/doc/utilities/interpolate_near_coast.html +++ b/doc/utilities/interpolate_near_coast.html @@ -81,6 +81,6 @@ This function is called by: 0036 end 0037 data=[tempzet1(:);tempzet2(:)]; 0038 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/interpolate_polcoms_timeseries_zet.html b/doc/utilities/interpolate_polcoms_timeseries_zet.html index d3a6207..8b67ac8 100644 --- a/doc/utilities/interpolate_polcoms_timeseries_zet.html +++ b/doc/utilities/interpolate_polcoms_timeseries_zet.html @@ -110,6 +110,6 @@ This function is called by: 0066 return 0067 0068 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/isintriangle.html b/doc/utilities/isintriangle.html index 34d7052..489444c 100755 --- a/doc/utilities/isintriangle.html +++ b/doc/utilities/isintriangle.html @@ -77,6 +77,6 @@ This function is called by: 0022 0023 return 0024 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/julian2greg.html b/doc/utilities/julian2greg.html index e2aaa69..f2f562b 100755 --- a/doc/utilities/julian2greg.html +++ b/doc/utilities/julian2greg.html @@ -177,6 +177,6 @@ This function is called by: 0088 format('long', 'g'); 0089 dategreg = [ day month year hour minu sec ]; 0090 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/lanczosfilter.html b/doc/utilities/lanczosfilter.html index 8ed6228..8c535d8 100644 --- a/doc/utilities/lanczosfilter.html +++ b/doc/utilities/lanczosfilter.html @@ -257,6 +257,6 @@ This function is called by: 0156 0157 0158 % Carlos AdriÃ¡n Vargas Aguilera. nubeobscura@hotmail.com -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/lat_to_m.html b/doc/utilities/lat_to_m.html index 1292017..7d5a42f 100644 --- a/doc/utilities/lat_to_m.html +++ b/doc/utilities/lat_to_m.html @@ -57,6 +57,6 @@ This function is called by: 0009 m = 111132.09 * ones(size(rlat)) - ... 0010 566.05 * cos(2 * rlat) + 1.2 * cos(4 * rlat); 0011 dy = dlat .* m ; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/lon_to_m.html b/doc/utilities/lon_to_m.html index 04f72d3..b6bf65c 100644 --- a/doc/utilities/lon_to_m.html +++ b/doc/utilities/lon_to_m.html @@ -54,6 +54,6 @@ This function is called by: 0007 rlat = alat * pi/180; 0008 p = 111415.13 * cos(rlat) - 94.55 * cos(3 * rlat); 0009 dx = dlon .* p; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/m_ll2ll.html b/doc/utilities/m_ll2ll.html index 58558c9..fa48aad 100644 --- a/doc/utilities/m_ll2ll.html +++ b/doc/utilities/m_ll2ll.html @@ -267,6 +267,6 @@ This function is called by: 0219 lon=lon/DEG2RADS; 0220 0221 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/m_to_lat.html b/doc/utilities/m_to_lat.html index ff7d138..9c173d3 100644 --- a/doc/utilities/m_to_lat.html +++ b/doc/utilities/m_to_lat.html @@ -57,6 +57,6 @@ This function is called by: 0009 m = 111132.09 * ones(size(rlat)) - ... 0010 566.05 * cos(2 * rlat) + 1.2 * cos(4 * rlat); 0011 dlat = dy ./ m; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/m_to_lon.html b/doc/utilities/m_to_lon.html index 154aeec..4be6f53 100644 --- a/doc/utilities/m_to_lon.html +++ b/doc/utilities/m_to_lon.html @@ -54,6 +54,6 @@ This function is called by: 0007 rlat = alat * pi/180; 0008 p = 111415.13 * cos(rlat) - 94.55 * cos(3 * rlat); 0009 dlon = dx ./ p; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/make_logo.html b/doc/utilities/make_logo.html index 2aaf37d..5843d30 100644 --- a/doc/utilities/make_logo.html +++ b/doc/utilities/make_logo.html @@ -126,6 +126,6 @@ This function is called by: 0072 if ftbverbose 0073 fprintf('end : %s \n', subname) 0074 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/merge_bathymetry.html b/doc/utilities/merge_bathymetry.html index f99d1d6..49b80fe 100644 --- a/doc/utilities/merge_bathymetry.html +++ b/doc/utilities/merge_bathymetry.html @@ -103,6 +103,6 @@ This function is called by: 0051 new_bat=f1d.*coarse_bat+((1-f1d).*fine_bat); 0052 return 0053 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/mjul2matlab.html b/doc/utilities/mjul2matlab.html index ec4accb..c12d68b 100644 --- a/doc/utilities/mjul2matlab.html +++ b/doc/utilities/mjul2matlab.html @@ -56,6 +56,6 @@ This function is called by: 0010 0011 end 0012 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/mjul2str.html b/doc/utilities/mjul2str.html index be7d21a..66f9a3b 100755 --- a/doc/utilities/mjul2str.html +++ b/doc/utilities/mjul2str.html @@ -45,13 +45,15 @@ This function is called by:
```0001 function strout = mjul2str(MJD,noyear)
0002 % Convert a modified Julian day to a Matlab datestr style string
0003
-0004 mjul2matlab = 678942; %difference between modified Julian day 0 and Matlab day 0
-0005 if(~exist('noyear'))
-0006 strout = datestr(MJD+mjul2matlab);
-0007 else
+0004 MJD = double(MJD);
+0005
+0006 mjul2matlab = 678942; %difference between modified Julian day 0 and Matlab day 0
+0007 if(~exist('noyear'))
0008 strout = datestr(MJD+mjul2matlab);
-0009 strout = strout(1:end-5)
-0010 end;```
-
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0009 else +0010 strout = datestr(MJD+mjul2matlab); +0011 strout = strout(1:end-5) +0012 end; +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/mjul2str2.html b/doc/utilities/mjul2str2.html index fbfcd71..b62706e 100755 --- a/doc/utilities/mjul2str2.html +++ b/doc/utilities/mjul2str2.html @@ -50,6 +50,6 @@ This function is called by: 0005 mjul2matlab = 678942; %difference between modified Julian day 0 and Matlab day 0 0006 strout = datestr(MJD+mjul2matlab); 0007 strout = strout(1:end-5); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/mjulian2greg.html b/doc/utilities/mjulian2greg.html index a27e4ca..10594a1 100755 --- a/doc/utilities/mjulian2greg.html +++ b/doc/utilities/mjulian2greg.html @@ -147,6 +147,6 @@ This function is called by: 0065 %This function converts Modified Julian dates to Gregorian dates. 0066 0067 %[year,month,day,hour,minu,sec,dayweek,dategreg] = julian2greg(MJD+2400000.5); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/naut_2_cart.html b/doc/utilities/naut_2_cart.html index 8ca8fba..2c779c1 100755 --- a/doc/utilities/naut_2_cart.html +++ b/doc/utilities/naut_2_cart.html @@ -97,6 +97,6 @@ This function is called by: 0030 angle = angle*deg2rad; 0031 u = -cos(angle).* speed; 0032 v = -sin(angle).* speed; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/pl64.html b/doc/utilities/pl64.html index bf80a67..6252e05 100755 --- a/doc/utilities/pl64.html +++ b/doc/utilities/pl64.html @@ -130,6 +130,6 @@ This function is called by: 0075 'warning time series is too short' 0076 end 0077 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/plot_fvcom_field.html b/doc/utilities/plot_fvcom_field.html index aabd367..9c1fbff 100644 --- a/doc/utilities/plot_fvcom_field.html +++ b/doc/utilities/plot_fvcom_field.html @@ -47,9 +47,38 @@ [optional] axi = the axis - specify axis range [optional] pll = the axis [optional] grd = add gridlines - specify colour + [optional] tit = add title - specify text + [optional] leg = add legend - specify text as a cell array + [optional] qui = add quiver vectors - specify a structure with the quiver information in (see examples) + EXAMPLE USAGE - plot_fvcom_field(Mobj, Mobj.zeta, 'fid', 1, 'cli', [0 100], 'gif', 'animation.gif', 'axi', [60000 70000 40000 50000]) + plot_fvcom_field(Mobj, Mobj.zeta, 'fid', 1, 'cli', [0 100], 'gif', 'animation.gif', 'axi', [60000 70000 40000 50000]) + + Quiver vecotor example 1 (plot every other depth average velocity vector on unstructured grid): + Q.X = PFOW.lonc(1:15:end); + Q.Y = PFOW.latc(1:15:end); + Q.U = PFOW.ua(1:15:end,:); + Q.V = PFOW.va(1:15:end,:); + plot_fvcom_field(PFOW, PFOW.ua(:,1:13), 'pll', 'qui', Q) + + Quiver vecotor example 2 (include vecotrs on an interpolated regular grid): + Q.x = -4:0.01:-2; + Q.y = 58:0.01:59; + + [Q.X1, Q.Y1] = meshgrid(Q.x, Q.y); + Q.X = Q.X1(:); Q.Y = Q.Y1(:); + + Only use data from within the region of interpolation + I = PFOW.lonc>Q.x(1) & PFOW.lonc<Q.x(end) & PFOW.latc>Q.y(1) & PFOW.latc<Q.y(end); + + for tt=1:13 + Fx = scatteredInterpolant(double(PFOW.lonc(I)), double(PFOW.latc(I)), double(PFOW.ua(I,tt))); + Fy = scatteredInterpolant(double(PFOW.lonc(I)), double(PFOW.latc(I)), double(PFOW.va(I,tt))); + Q.U(:,tt) = Fx(Q.X, Q.Y); + Q.V(:,tt) = Fy(Q.X, Q.Y); + end + plot_fvcom_field(PFOW, PFOW.ua(:,1:13), 'pll', 'qui', Q) Author(s) Rory O'Hara Murray (Marine Scotland Science) @@ -91,152 +120,199 @@ This function is called by: 0018 % [optional] axi = the axis - specify axis range 0019 % [optional] pll = the axis 0020 % [optional] grd = add gridlines - specify colour -0021 % -0022 % EXAMPLE USAGE -0023 % plot_fvcom_field(Mobj, Mobj.zeta, 'fid', 1, 'cli', [0 100], 'gif', 'animation.gif', 'axi', [60000 70000 40000 50000]) +0021 % [optional] tit = add title - specify text +0022 % [optional] leg = add legend - specify text as a cell array +0023 % [optional] qui = add quiver vectors - specify a structure with the quiver information in (see examples) 0024 % -0025 % Author(s) -0026 % Rory O'Hara Murray (Marine Scotland Science) -0027 % -0028 % Developments: -0029 % 2014-05-22: Changed the way fig id is checked, not using 'exist' anymore. -0030 % 2014-08-15: Added the axis command in -0031 % -0032 function [a] = plot_fvcom_field(M, plot_field, varargin) -0033 MJD_datenum = datenum('1858-11-17 00:00:00'); -0034 -0035 % check to see if nv or tri should be used. -0036 if isfield(M, 'nv') -0037 nv = M.nv; -0038 elseif isfield(M, 'tri') -0039 nv = M.tri; -0040 end -0041 -0042 % check to see if a time variable is there or not -0043 if isfield(M, 'time') %& size(M.time,1)>1 -0044 time_flag = true; -0045 else -0046 time_flag = false; -0047 end -0048 -0049 % defaults -0050 clims = [min(plot_field(:)) max(plot_field(:))]; -0051 if clims(1)==clims(2) -0052 clims(1)=clims(1)-0.1; -0053 clims(2)=clims(2)+0.1; -0054 end -0055 gif = false; -0056 grd = false; -0057 plot_ll = false; -0058 fig_flag = false; -0059 axis_flag = false; -0060 title_flag = false; -0061 legend_text_flag = false; -0062 quiver_flag = false; +0025 % +0026 % EXAMPLE USAGE +0027 % plot_fvcom_field(Mobj, Mobj.zeta, 'fid', 1, 'cli', [0 100], 'gif', 'animation.gif', 'axi', [60000 70000 40000 50000]) +0028 % +0029 % Quiver vecotor example 1 (plot every other depth average velocity vector on unstructured grid): +0030 % Q.X = PFOW.lonc(1:15:end); +0031 % Q.Y = PFOW.latc(1:15:end); +0032 % Q.U = PFOW.ua(1:15:end,:); +0033 % Q.V = PFOW.va(1:15:end,:); +0034 % plot_fvcom_field(PFOW, PFOW.ua(:,1:13), 'pll', 'qui', Q) +0035 % +0036 % Quiver vecotor example 2 (include vecotrs on an interpolated regular grid): +0037 % Q.x = -4:0.01:-2; +0038 % Q.y = 58:0.01:59; +0039 % +0040 % [Q.X1, Q.Y1] = meshgrid(Q.x, Q.y); +0041 % Q.X = Q.X1(:); Q.Y = Q.Y1(:); +0042 % +0043 % Only use data from within the region of interpolation +0044 % I = PFOW.lonc>Q.x(1) & PFOW.lonc<Q.x(end) & PFOW.latc>Q.y(1) & PFOW.latc<Q.y(end); +0045 % +0046 % for tt=1:13 +0047 % Fx = scatteredInterpolant(double(PFOW.lonc(I)), double(PFOW.latc(I)), double(PFOW.ua(I,tt))); +0048 % Fy = scatteredInterpolant(double(PFOW.lonc(I)), double(PFOW.latc(I)), double(PFOW.va(I,tt))); +0049 % Q.U(:,tt) = Fx(Q.X, Q.Y); +0050 % Q.V(:,tt) = Fy(Q.X, Q.Y); +0051 % end +0052 % plot_fvcom_field(PFOW, PFOW.ua(:,1:13), 'pll', 'qui', Q) +0053 % +0054 % Author(s) +0055 % Rory O'Hara Murray (Marine Scotland Science) +0056 % +0057 % Developments: +0058 % 2014-05-22: Changed the way fig id is checked, not using 'exist' anymore. +0059 % 2014-08-15: Added the axis command in +0060 % +0061 function [a] = plot_fvcom_field(M, plot_field, varargin) +0062 MJD_datenum = datenum('1858-11-17 00:00:00'); 0063 -0064 for ii=1:1:length(varargin) -0065 keyword = lower(varargin{ii}); -0066 if length(keyword)~=3 -0067 continue -0068 end -0069 switch keyword -0070 case 'fid' % id of a figure -0071 fig = varargin{ii+1}; -0072 fig_flag = true; -0073 case 'cli' % colour limits -0074 clims = varargin{ii+1}; -0075 case 'gif' % make an animated gif -0076 gif = true; -0077 gif_filename = varargin{ii+1}; -0078 case 'axi' % axis -0079 axis_flag = true; -0080 axi = varargin{ii+1}; -0081 case 'grd' % grid lines -0082 grd = true; -0083 edgecolor = varargin{ii+1}; -0084 case 'pll' -0085 plot_ll = true; -0086 case 'tit' -0087 title_flag = true; -0088 fig_title = varargin{ii+1}; -0089 case 'leg' -0090 legend_text_flag = true; -0091 legend_text = varargin{ii+1}; -0092 case 'qui' -0093 quiver_flag = true; -0094 quiverData = varargin{ii+1}; -0095 end -0096 end -0097 -0098 if plot_ll -0099 x = M.lon; -0100 y = M.lat; -0101 else -0102 x = M.x; -0103 y = M.y; -0104 end -0105 -0106 if not(axis_flag) -0107 axi = [min(x) max(x) min(y) max(y)]; -0108 end -0109 -0110 xE = x(nv)'; -0111 yE = y(nv)'; -0112 plot_field = squeeze(plot_field); -0113 -0114 if size(plot_field,1)==size(nv,1) % plot on elements -0115 if grd -0116 patch_func = @(dummy) patch(xE, yE, dummy', 'edgecolor', edgecolor); -0117 else -0118 patch_func = @(dummy) patch(xE, yE, dummy', 'linestyle', 'none'); -0119 end -0120 elseif size(plot_field,1)==size(x,1) % plot on nodes -0121 if grd -0122 patch_func = @(dummy) patch('Vertices',[x, y], 'Faces',nv, 'Cdata',dummy,'edgecolor', edgecolor,'facecolor','interp'); -0123 else -0124 patch_func = @(dummy) patch('Vertices',[x, y], 'Faces',nv, 'Cdata',dummy,'linestyle','none','facecolor','interp'); -0125 end -0126 end -0127 -0128 if not(fig_flag) -0129 fig = figure; -0130 end -0131 -0132 for ii=1:size(plot_field,2) -0133 if ishandle(fig)==0 break; end -0134 a = patch_func(plot_field(:,ii)); -0135 c = colorbar; -0136 if legend_text_flag set(get(c, 'ylabel'), 'string', legend_text); end -0137 set(gca, 'clim', clims); -0138 axis(axi) -0139 if title_flag -0140 title(fig_title) -0141 elseif time_flag -0142 title(['time = ' datestr(double(M.time(ii))+MJD_datenum, 'HH:MM dd/mm/yyyy')]) -0143 end -0144 if quiver_flag -0145 hold on -0146 quiver(quiverData.X, quiverData.Y, quiverData.U(:,:,ii), quiverData.V(:,:,ii), 'k'); -0147 hold off -0148 end -0149 -0150 if gif -0151 axis off -0152 set(gcf, 'color', 'w') -0153 frame = getframe(1); -0154 im = frame2im(frame); -0155 [imind,cm] = rgb2ind(im,256); -0156 if ii == 1; -0157 imwrite(imind,cm,gif_filename,'gif', 'Loopcount',inf); -0158 else -0159 imwrite(imind,cm,gif_filename,'gif','WriteMode','append'); -0160 end -0161 else -0162 pause(0.01); -0163 end -0164 end -0165 -0166 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0064 % check to see if nv or tri should be used. +0065 if isfield(M, 'nv') +0066 nv = M.nv; +0067 elseif isfield(M, 'tri') +0068 nv = M.tri; +0069 end +0070 +0071 % check to see if a time variable is there or not +0072 if isfield(M, 'time') %& size(M.time,1)>1 +0073 time_flag = true; +0074 else +0075 time_flag = false; +0076 end +0077 +0078 % defaults +0079 clims = [min(plot_field(:)) max(plot_field(:))]; +0080 if clims(1)==clims(2) +0081 clims(1)=clims(1)-0.1; +0082 clims(2)=clims(2)+0.1; +0083 end +0084 gif = false; +0085 grd = false; +0086 plot_ll = false; +0087 fig_flag = false; +0088 axis_flag = false; +0089 title_flag = false; +0090 legend_text_flag = false; +0091 quiver_flag = false; +0092 quiver2_flag = false; +0093 +0094 for ii=1:1:length(varargin) +0095 keyword = lower(varargin{ii}); +0096 if length(keyword)~=3 +0097 continue +0098 end +0099 switch keyword +0100 case 'fid' % id of a figure +0101 fig = varargin{ii+1}; +0102 fig_flag = true; +0103 case 'cli' % colour limits +0104 clims = varargin{ii+1}; +0105 case 'gif' % make an animated gif +0106 gif = true; +0107 gif_filename = varargin{ii+1}; +0108 case 'axi' % axis +0109 axis_flag = true; +0110 axi = varargin{ii+1}; +0111 case 'grd' % grid lines +0112 grd = true; +0113 edgecolor = varargin{ii+1}; +0114 case 'pll' +0115 plot_ll = true; +0116 case 'tit' +0117 title_flag = true; +0118 fig_title = varargin{ii+1}; +0119 case 'leg' +0120 legend_text_flag = true; +0121 legend_text = varargin{ii+1}; +0122 case 'qui' +0123 quiver_flag = true; +0124 quiverData = varargin{ii+1}; +0125 if isfield(quiverData,'scale')==0 quiverData.scale = 1; end +0126 if isfield(quiverData,'colour')==0 quiverData.colour =0.99*[1 1 1]; end +0127 % case 'qu2' +0128 % quiver2_flag = true; +0129 % quiverData = varargin{ii+1}; +0130 end +0131 end +0132 +0133 if plot_ll +0134 x = M.lon; +0135 y = M.lat; +0136 else +0137 x = M.x; +0138 y = M.y; +0139 end +0140 +0141 if not(axis_flag) +0142 axi = [min(x) max(x) min(y) max(y)]; +0143 end +0144 +0145 xE = x(nv)'; +0146 yE = y(nv)'; +0147 plot_field = squeeze(plot_field); +0148 +0149 if size(plot_field,1)==size(nv,1) % plot on elements +0150 if grd +0151 patch_func = @(dummy) patch(xE, yE, dummy', 'edgecolor', edgecolor); +0152 else +0153 patch_func = @(dummy) patch(xE, yE, dummy', 'linestyle', 'none'); +0154 end +0155 elseif size(plot_field,1)==size(x,1) % plot on nodes +0156 if grd +0157 patch_func = @(dummy) patch('Vertices',[x, y], 'Faces',nv, 'Cdata',dummy,'edgecolor', edgecolor,'facecolor','interp'); +0158 else +0159 patch_func = @(dummy) patch('Vertices',[x, y], 'Faces',nv, 'Cdata',dummy,'linestyle','none','facecolor','interp'); +0160 end +0161 end +0162 +0163 if fig_flag +0164 if fig.Type(1)=='f' +0165 the_axes = axes; +0166 elseif fig.Type(1)=='a' +0167 the_axes = fig; +0168 end +0169 else +0170 fig = figure; +0171 the_axes = axes; +0172 end +0173 axes(the_axes); +0174 +0175 for ii=1:size(plot_field,2) +0176 if ishandle(fig)==0 break; end +0177 a = patch_func(plot_field(:,ii)); +0178 c = colorbar; +0179 if legend_text_flag set(get(c, 'ylabel'), 'string', legend_text); end +0180 set(gca, 'clim', clims); +0181 axis(axi) +0182 if title_flag +0183 title(fig_title) +0184 elseif time_flag +0185 title(['time = ' datestr(double(M.time(ii))+MJD_datenum, 'HH:MM dd/mm/yyyy')]) +0186 end +0187 if quiver_flag +0188 % hold on +0189 % quiver(quiverData.X, quiverData.Y, quiverData.U(:,:,ii), quiverData.V(:,:,ii), 'w'); +0190 % hold off +0191 % elseif quiver2_flag +0192 hold on +0193 quiver(quiverData.X, quiverData.Y, quiverData.U(:,ii), quiverData.V(:,ii), quiverData.scale, 'color', quiverData.colour) +0194 hold off +0195 end +0196 +0197 if gif +0198 axis off +0199 set(gcf, 'color', 'w') +0200 frame = getframe(1); +0201 im = frame2im(frame); +0202 [imind,cm] = rgb2ind(im,256); +0203 if ii == 1; +0204 imwrite(imind,cm,gif_filename,'gif', 'Loopcount',inf); +0205 else +0206 imwrite(imind,cm,gif_filename,'gif','WriteMode','append'); +0207 end +0208 else +0209 pause(0.01); +0210 end +0211 end +0212 +0213 return +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/pp2nc.html b/doc/utilities/pp2nc.html index 315b488..158f742 100644 --- a/doc/utilities/pp2nc.html +++ b/doc/utilities/pp2nc.html @@ -169,6 +169,6 @@ This function is called by: 0075 end 0076 end 0077 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/pp2nc_subset.html b/doc/utilities/pp2nc_subset.html index 1f226a7..6b0fb03 100644 --- a/doc/utilities/pp2nc_subset.html +++ b/doc/utilities/pp2nc_subset.html @@ -185,6 +185,6 @@ This function is called by: 0085 end 0086 end 0087 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/pressure2depth.html b/doc/utilities/pressure2depth.html index ebb0b33..b4164e5 100644 --- a/doc/utilities/pressure2depth.html +++ b/doc/utilities/pressure2depth.html @@ -89,6 +89,6 @@ This function is called by: 0028 0029 Z = (((-1.82E-15*P+2.279E-10).*P-2.2512E-5).*P+9.72659).*P; 0030 Z = Z./GR; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/qair2rh.html b/doc/utilities/qair2rh.html index 023ea14..3d7794f 100644 --- a/doc/utilities/qair2rh.html +++ b/doc/utilities/qair2rh.html @@ -89,6 +89,6 @@ This function is called by: 0027 rh = e ./ es; 0028 rh(rh > 1) = 1; 0029 rh(rh < 0) = 0; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/quiverwcolorbar.html b/doc/utilities/quiverwcolorbar.html index 02907fb..4e0cd51 100644 --- a/doc/utilities/quiverwcolorbar.html +++ b/doc/utilities/quiverwcolorbar.html @@ -473,6 +473,6 @@ This function is called by: 0390 0391 function retval = isscalar(m) 0392 retval = prod(size(m)) == 1; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/read_FVCOM_river_file.html b/doc/utilities/read_FVCOM_river_file.html new file mode 100644 index 0000000..19c01ff --- /dev/null +++ b/doc/utilities/read_FVCOM_river_file.html @@ -0,0 +1,175 @@ + + + + Description of read_FVCOM_river_file + + + + + + + + + +
+ + + +

+ +

+
+ +

+
+ +

## DESCRIPTION

+
``` function [Riv]=read_river_file(river_root,Mobj)
+
+
+ DESCRIPTION:
+    Reads both *.nc and *nml files associated with FVCOM river input files
+
+ INPUT
+   river_root = full address of river filename without extension
+   Mobj       = needs bathymetry, nodes, elements and triangulation table.
+
+ OUTPUT:
+    Riv       = structure variable with all variables in the file
+
+ EXAMPLE USAGE
+
+ Author(s):
+    Ricardo Torres (Plymouth Marine Laboratory)
+
+ Revision history
+
+   2018-07-22 First version.
+
+==============================================================================```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function [Riv]=read_FVCOM_river_file(river_root,Mobj)
+0003 % Reads FVCOM river files
+0004 %
+0006 %
+0007 % DESCRIPTION:
+0008 %    Reads both *.nc and *nml files associated with FVCOM river input files
+0009 %
+0010 % INPUT
+0011 %   river_root = full address of river filename without extension
+0012 %   Mobj       = needs bathymetry, nodes, elements and triangulation table.
+0013 %
+0014 % OUTPUT:
+0015 %    Riv       = structure variable with all variables in the file
+0016 %
+0017 % EXAMPLE USAGE
+0019 %
+0020 % Author(s):
+0021 %    Ricardo Torres (Plymouth Marine Laboratory)
+0022 %
+0023 % Revision history
+0024 %
+0025 %   2018-07-22 First version.
+0026 %
+0027 %==============================================================================
+0028 [~, subname] = fileparts(mfilename('fullpath'));
+0029 global ftbverbose
+0030 if ftbverbose
+0031     fprintf('\nbegin : %s \n', subname)
+0032 end
+0033
+0034 % Check if they are in the same order... (a couple of manual test suggest
+0035 ncRivers = [river_root '.nc'];
+0036 fidnml = fopen ([river_root '.nml']);
+0037 % get variables from netcdf file
+0038 info = ncinfo(ncRivers);
+0039 % extract all variables
+0040 varnames={};
+0041 for nn =1:length(info.Variables)
+0042     varnames{nn}=info.Variables(nn).Name;
+0043 end
+0044 Riv=[];nn=1;
+0045 for vv=varnames
+0047 if isfloat(Riv.(vv{1}).data)
+0048     Riv.(vv{1}).data =double(Riv.(vv{1}).data);
+0049     % extract units
+0050     for rr = 1:length(info.Variables(nn).Attributes)
+0051     if startsWith(info.Variables(nn).Attributes(rr).Name ,'units')
+0052     Riv.(vv{1}).units =     info.Variables(nn).Attributes(rr).Value
+0053     end
+0054     end
+0055 end
+0056 nn=nn+1;
+0057 end
+0058 pos =0;
+0059
+0060 while ~feof(fidnml)
+0061     pos = pos+1;
+0062     lines=cell(3,1);
+0063     for dd=1:3
+0064         lines{dd} = fgetl(fidnml);
+0065         %     fprintf(fout,'%s\n',line)
+0066     end
+0067     % keep name
+0068     [river_name]= extractAfter(lines{2},'= ');
+0069     Riv.river_name(pos,1)={river_name(1:end-1)};
+0071     line = fgetl(fidnml);
+0072     % extract grid location
+0073     t =strfind(line,'=');
+0074
+0075     Riv.IDX(pos,1) = str2double(line(t+1:end));
+0076     % check if IDX is in the list to remove
+0077         line1 = fgetl(fidnml);
+0078         line2 = fgetl(fidnml);
+0079 end
+0080 fclose (fidnml);
+0081 % extract river positions
+0082 for rr=1:length(Riv.IDX)
+0083 Riv.lon.data(rr) = Mobj.lon(Riv.IDX(rr,1));
+0084 Riv.lat.data(rr) = Mobj.lat(Riv.IDX(rr,1));
+0085 Riv.x.data(rr) = Mobj.x(Riv.IDX(rr,1));
+0086 Riv.y.data(rr) = Mobj.y(Riv.IDX(rr,1));
+0087 end
+0088
+0089 % %% for each river estimate the annual cycle mean and river
+0090 % % flow/concentration relationship
+0091 % % rnut = Riv2.N1_p;
+0092 % % read tamar nutrient observations.
+0093 % ncfile = fullfile('/data/euryale4/backup/mbe/Experiments/Rosa_rivers/Analysis/tamar_nutrient_nc','gunnislake_dayavg_%s.nc')
+0094 % vars = {'si','amm','phs','nitrate','o2'}
+0095 % varsR = {'N5_s','N4_n','N1_p','N3_n','O2_o'}
+0097 % for nn=1:length(vars)
+0100 % end
+0101 %%
+0102 Riv.mtime.data = (Riv.time.data+ 678942);
+0103 % rr=10;```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/utilities/read_fvcom_mesh.html b/doc/utilities/read_fvcom_mesh.html index 278ff7e..20e0828 100644 --- a/doc/utilities/read_fvcom_mesh.html +++ b/doc/utilities/read_fvcom_mesh.html @@ -182,6 +182,6 @@ This function is called by: 0113 end 0114 0115 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/read_kml.html b/doc/utilities/read_kml.html index 58d695b..97ed5fe 100755 --- a/doc/utilities/read_kml.html +++ b/doc/utilities/read_kml.html @@ -219,6 +219,6 @@ This function is called by: 0147 lat=reshape(lat,max(a,b),min(a,b)); 0148 lon=reshape(lon,max(a,b),min(a,b)); 0149 z=reshape(z,max(a,b),min(a,b)); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0676 %-------------------------------------------------------------------------- +0677 % Tidy up, finish and return data +0678 %-------------------------------------------------------------------------- +0679 +0680 netcdf.close(nc) +0681 +0682 if ftbverbose +0683 fprintf('end : %s \n', subname) +0684 end +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/read_netcdf_vars.html b/doc/utilities/read_netcdf_vars.html index 1d41bb2..f0372f6 100644 --- a/doc/utilities/read_netcdf_vars.html +++ b/doc/utilities/read_netcdf_vars.html @@ -276,6 +276,6 @@ This function is called by: 0194 netcdf.close(ncid) 0195 0196 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/read_netcdf_vars_xy.html b/doc/utilities/read_netcdf_vars_xy.html index a127e45..2376f45 100644 --- a/doc/utilities/read_netcdf_vars_xy.html +++ b/doc/utilities/read_netcdf_vars_xy.html @@ -167,6 +167,6 @@ This function is called by: 0114 0115 end 0116 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/read_polcoms_params.html b/doc/utilities/read_polcoms_params.html index 516317a..6a26714 100644 --- a/doc/utilities/read_polcoms_params.html +++ b/doc/utilities/read_polcoms_params.html @@ -58,6 +58,6 @@ This function is called by: 0012 end 0013 0014 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/read_scoord_params.html b/doc/utilities/read_scoord_params.html index a3a7150..2056b80 100644 --- a/doc/utilities/read_scoord_params.html +++ b/doc/utilities/read_scoord_params.html @@ -54,6 +54,6 @@ This function is called by: 0009 scoord.theta=C{1}(3); 0010 scoord.bb=C{1}(4); 0011 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/readdir.html b/doc/utilities/readdir.html index 729f4c1..bfa3dd6 100644 --- a/doc/utilities/readdir.html +++ b/doc/utilities/readdir.html @@ -65,6 +65,6 @@ This function is called by: 0021 end 0022 fclose(fdir); 0023 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/readzetUBVB.html b/doc/utilities/readzetUBVB.html index 7684470..96d5714 100644 --- a/doc/utilities/readzetUBVB.html +++ b/doc/utilities/readzetUBVB.html @@ -131,6 +131,6 @@ This function is called by: 0076 end 0077 fclose(fid); 0078 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/restrict_spatial_indices.html b/doc/utilities/restrict_spatial_indices.html new file mode 100644 index 0000000..8f6d799 --- /dev/null +++ b/doc/utilities/restrict_spatial_indices.html @@ -0,0 +1,169 @@ + + + + Description of restrict_spatial_indices + + + + + + + + + +
Home > utilities > restrict_spatial_indices.m
+ + + +

# restrict_spatial_indices +

+ +

## PURPOSE

+
Eliminates the FVCOM nodes and elements in the lists mask_nodes and
+ +

+
+ +

## DESCRIPTION

+
``` Eliminates the FVCOM nodes and elements in the lists mask_nodes and
+
+
+ DESCRIPTION:
+   Loops through all variables in FVCOM and restricts spatial dimensions
+
+
+ INPUT:
+   FVCOM        = Structure variable with FVCOM output data
+   mask_nodes = list of node indices to remove
+   mask_elems = list of elements indices to remove
+
+ OUTPUT:
+   FVCOM with fewer nodes and elements!
+
+ EXAMPLE USAGE:
+   FVCOM.temp = temperature field (node,levels,times)
+   FVCOM.u = velocity field (elements,levels,times)
+   mask_nodes = (1:300) can be the boundary/nesting nodes
+   mask_elems = (1:400) can be the boundary/nesting elements
+
+ Author(s):
+   Ricardo Torres (Plymouth Marine Laboratory)```
+ + +

## CROSS-REFERENCE INFORMATION

+This function calls: +
+
+This function is called by: +
+
+ + + + +

## SOURCE CODE

+
```0001 function FVCOM = restrict_spatial_indices(FVCOM,mask_nodes,mask_elems);
+0002
+0003 % Eliminates the FVCOM nodes and elements in the lists mask_nodes and
+0005 %
+0007 %
+0008 % DESCRIPTION:
+0009 %   Loops through all variables in FVCOM and restricts spatial dimensions
+0010 %
+0011 %
+0012 % INPUT:
+0013 %   FVCOM        = Structure variable with FVCOM output data
+0014 %   mask_nodes = list of node indices to remove
+0015 %   mask_elems = list of elements indices to remove
+0016 %
+0017 % OUTPUT:
+0018 %   FVCOM with fewer nodes and elements!
+0019 %
+0020 % EXAMPLE USAGE:
+0021 %   FVCOM.temp = temperature field (node,levels,times)
+0022 %   FVCOM.u = velocity field (elements,levels,times)
+0023 %   mask_nodes = (1:300) can be the boundary/nesting nodes
+0024 %   mask_elems = (1:400) can be the boundary/nesting elements
+0026 %
+0027 % Author(s):
+0028 %   Ricardo Torres (Plymouth Marine Laboratory)
+0029
+0030 %
+0031 % Revision history:
+0032 %   2018-09-17 First version
+0033 %
+0034 %==========================================================================
+0035
+0036
+0037 [~, subname] = fileparts(mfilename('fullpath'));
+0038
+0039 global ftbverbose
+0040 if ftbverbose
+0041     fprintf('\nbegin : %s\n', subname)
+0042 end
+0043
+0044 vnames = fields (FVCOM);
+0045
+0046 if isfield(FVCOM,'x');
+0047 nodes = length(FVCOM.x);
+0048 elseif isfield(FVCOM,'lon')
+0049     nodes = length(FVCOM.lon);
+0050 else
+0051     warning('No easily identifiable variable with node dimensions positions... e.g. x/y or lon/lat and I will continue')
+0052 end
+0053
+0054 if isfield(FVCOM,'xc');
+0055 elems = length(FVCOM.xc);
+0056 elseif isfield(FVCOM,'lonc')
+0057     elems = length(FVCOM.lonc);
+0058 else
+0059     warning('No easily identifiable variable with element dimensions positions... e.g. xc/yc or lonc/latc and I cannot continue')
+0060 end
+0061
+0062 if exist('nodes','var')
+0063 else
+0064     nodes=0;
+0065 end
+0066 if exist('elems','var')
+0067 else
+0068     elems=0;
+0069 end
+0070
+0071 for vv=vnames'
+0072     switch size(FVCOM.(vv{1}),1) % In FVCOM variable structure, the first dimension is always the spatial dimension if it is present
+0073         case nodes
+0074             disp(['Clipping variable  FVCOM.',vv{1}])
+0075             switch ndims(FVCOM.(vv{1}))
+0076                 case 1
+0078                 case 2
+0080                 case 3
+0082             end
+0083         case elems
+0084              disp(['Clipping variable  FVCOM.',vv{1}])
+0085              switch ndims(FVCOM.(vv{1}))
+0086                 case 1
+0088                 case 2
+0090                 case 3
+0092             end
+0093     end
+0094 end
+0095
+0096
+0097```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
+ + \ No newline at end of file diff --git a/doc/utilities/runmean.html b/doc/utilities/runmean.html index cdcb067..dd55848 100755 --- a/doc/utilities/runmean.html +++ b/doc/utilities/runmean.html @@ -299,6 +299,6 @@ This function is called by: 0211 % Y = reshape(Y,sz) ; 0212 % end 0213 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/show_sigma.html b/doc/utilities/show_sigma.html index e332075..07690ea 100755 --- a/doc/utilities/show_sigma.html +++ b/doc/utilities/show_sigma.html @@ -278,6 +278,6 @@ This function is called by: 0206 end 0207 axis([xslice(1,1),xslice(end,1),min(yslice(:,end)),5]) 0208 title('sigma distribution along the transect'); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/sigma_gen.html b/doc/utilities/sigma_gen.html index 5b4aaa7..7f25781 100755 --- a/doc/utilities/sigma_gen.html +++ b/doc/utilities/sigma_gen.html @@ -123,27 +123,30 @@ This function is called by: 0048 dist(k+1) = (x1+x2)/x3-1.0; 0049 end 0050 else -0051 %dr=(h-sum(zku)-sum(zkl))/h/double(nlev-ku-kl-1); -0052 dr = (h-du-dl)/h/double(nlev-ku-kl-1); -0053 dist(1) = 0.0; -0054 -0055 for k = 2:ku+1 -0056 dist(k) = dist(k-1)-zku(k-1)/h; -0057 % fprintf('building z %f %f %f %f \n',z(k),zku(k-1),h,zku(k-1)/h) -0058 end -0059 -0060 for k = ku+2:nlev-kl -0061 dist(k) = dist(k-1)-dr; -0062 % fprintf('building z %f %f \n',z(k),dr) -0063 end -0064 -0065 kk = 0; -0066 for k = nlev-kl+1:nlev -0067 kk = kk+1; -0068 dist(k) = dist(k-1)-zkl(kk)/h; -0069 % fprintf('building z %f %f \n',z(k),zkl(kk)) -0070 end -0071 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0051 % I'm (Pierre Cazenave) pretty certain the code below is horribly broke in some fashion. But, I've modified the PyFVCOM version +0052 % of this function to simply return sigma_geo(nlev, 1) in here and that seems to be OK. I should probably do the +0053 % same here, but I can't afford the time to properly test it, so this note will have to do instead. +0054 %dr=(h-sum(zku)-sum(zkl))/h/double(nlev-ku-kl-1); +0055 dr = (h-du-dl)/h/double(nlev-ku-kl-1); +0056 dist(1) = 0.0; +0057 +0058 for k = 2:ku+1 +0059 dist(k) = dist(k-1)-zku(k-1)/h; +0060 % fprintf('building z %f %f %f %f \n',z(k),zku(k-1),h,zku(k-1)/h) +0061 end +0062 +0063 for k = ku+2:nlev-kl +0064 dist(k) = dist(k-1)-dr; +0065 % fprintf('building z %f %f \n',z(k),dr) +0066 end +0067 +0068 kk = 0; +0069 for k = nlev-kl+1:nlev +0070 kk = kk+1; +0071 dist(k) = dist(k-1)-zkl(kk)/h; +0072 % fprintf('building z %f %f \n',z(k),zkl(kk)) +0073 end +0074 end +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/sigma_geo.html b/doc/utilities/sigma_geo.html index 045df90..70a4913 100755 --- a/doc/utilities/sigma_geo.html +++ b/doc/utilities/sigma_geo.html @@ -109,6 +109,6 @@ This function is called by: 0041 dist(k) = ((kb-k)/((kb+1)/2-1))^p_sigma/2-1.0; 0042 end 0043 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/sigma_tanh.html b/doc/utilities/sigma_tanh.html index a10728a..d0fe904 100755 --- a/doc/utilities/sigma_tanh.html +++ b/doc/utilities/sigma_tanh.html @@ -24,12 +24,12 @@
Generate a tanh sigma coordinate distribution.

## SYNOPSIS

-
function dist = sigma_tanh(nlev,dl,du)
+
function Mobj = sigma_tanh(nlev,dl,du,Mobj,sigma_file)

## DESCRIPTION

``` Generate a tanh sigma coordinate distribution.

- Mobj = sigma_tanh(nlev, dl, du)
+ Mobj = sigma_tanh(nlev, dl, du, Mobj)

DESCRIPTION:
Generate a tanh vertical sigma coordinate distribution.
@@ -40,19 +40,25 @@
coordinates are parallel with uniform thickness.
du:         The upper depth boundary from the surface, up to which the
coordinates are parallel with uniform thickness.
+   Mobj:       [optional] Mesh object file
+   sigma_file: [optional] File to which to save the sigma distribution.

OUTPUT:
-   dist:       Tanh vertical sigma coordinate distribution.
+   Mobj.sigma:     Hyperbolic tangent vertical sigma coordinate distribution.
+   Mobj.sig...     All the sigma layers variables such as siglev, siglevz,
+                   siglayz, etc.

EXAMPLE USAGE:
-   Mobj = read_sigma(nlev, dl, du)
+   Mobj = read_sigma(nlev, dl, du, Mobj)

Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Pierre Cazenave (Plymouth Marine Laboratory)
+   Ricardo Torres (Plymouth Marine Laboratory)

Revision history
-   2013-04-23 Added help on the function and reformatted the code.```
+ 2013-04-23 Added help on the function and reformatted the code. + 2018-09-14 Added option to add the sigma data to a mesh object.

## CROSS-REFERENCE INFORMATION

@@ -67,10 +73,10 @@ This function is called by:

## SOURCE CODE

-
```0001 function dist = sigma_tanh(nlev,dl,du)
+0001 function Mobj = sigma_tanh(nlev,dl,du,Mobj,sigma_file)
0002 % Generate a tanh sigma coordinate distribution.
0003 %
-0004 % Mobj = sigma_tanh(nlev, dl, du)
+0004 % Mobj = sigma_tanh(nlev, dl, du, Mobj)
0005 %
0006 % DESCRIPTION:
0007 %   Generate a tanh vertical sigma coordinate distribution.
@@ -81,31 +87,75 @@ This function is called by:
0012 %               coordinates are parallel with uniform thickness.
0013 %   du:         The upper depth boundary from the surface, up to which the
0014 %               coordinates are parallel with uniform thickness.
-0015 %
-0016 % OUTPUT:
-0017 %   dist:       Tanh vertical sigma coordinate distribution.
-0018 %
-0019 % EXAMPLE USAGE:
-0020 %   Mobj = read_sigma(nlev, dl, du)
-0021 %
-0022 % Author(s):
-0023 %   Geoff Cowles (University of Massachusetts Dartmouth)
-0024 %   Pierre Cazenave (Plymouth Marine Laboratory)
+0015 %   Mobj:       [optional] Mesh object file
+0016 %   sigma_file: [optional] File to which to save the sigma distribution.
+0017 %
+0018 % OUTPUT:
+0019 %   Mobj.sigma:     Hyperbolic tangent vertical sigma coordinate distribution.
+0020 %   Mobj.sig...     All the sigma layers variables such as siglev, siglevz,
+0021 %                   siglayz, etc.
+0022 %
+0023 % EXAMPLE USAGE:
+0024 %   Mobj = read_sigma(nlev, dl, du, Mobj)
0025 %
-0026 % Revision history
-0027 %   2013-04-23 Added help on the function and reformatted the code.
-0028
-0029 dist = zeros(1, nlev);
-0030
-0031 for k = 1:nlev-1
-0032     x1 = dl+du;
-0033     x1 = x1*(nlev-1-k)/(nlev-1);
-0034     x1 = x1-dl;
-0035     x1 = tanh(x1);
-0036     x2 = tanh(dl);
-0037     x3 = x2+tanh(du);
-0038     dist(k+1) = (x1+x2)/x3-1.0;
-0039 end
-Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0026 % Author(s):
+0027 %   Geoff Cowles (University of Massachusetts Dartmouth)
+0028 %   Pierre Cazenave (Plymouth Marine Laboratory)
+0029 %   Ricardo Torres (Plymouth Marine Laboratory)
+0030 %
+0031 % Revision history
+0032 %   2013-04-23 Added help on the function and reformatted the code.
+0033 %   2018-09-14 Added option to add the sigma data to a mesh object.
+0034
+0035 dist = zeros(1, nlev);
+0036
+0037 for k = 1:nlev-1
+0038     x1 = dl+du;
+0039     x1 = x1*(nlev-1-k)/(nlev-1);
+0040     x1 = x1-dl;
+0041     x1 = tanh(x1);
+0042     x2 = tanh(dl);
+0043     x3 = x2+tanh(du);
+0044     dist(k+1) = (x1+x2)/x3-1.0;
+0045 end
+0046 if nargin >= 4
+0047     conf.nlev = nlev;
+0048     Mobj.sigma = dist;
+0049     Mobj.siglev = zeros(Mobj.nVerts,conf.nlev);
+0050     Mobj.siglevc = zeros(Mobj.nElems,conf.nlev);
+0051     Mobj.siglayc = zeros(Mobj.nElems,conf.nlev-1);
+0052     Mobj.siglev = repmat(Mobj.sigma,Mobj.nVerts,1);
+0053     Mobj.siglay = Mobj.siglev(:,1:end-1) + (diff(Mobj.siglev,1,2)/2);
+0054     for zz = 1:conf.nlev-1
+0055         Mobj.siglevc(:, zz) = nodes2elems(Mobj.siglev(:, zz), Mobj);
+0056         Mobj.siglayc(:, zz) = nodes2elems(Mobj.siglay(:, zz), Mobj);
+0057     end
+0058     % An extra level compared with layers.
+0059     Mobj.siglevc(:, zz + 1) = nodes2elems(Mobj.siglev(:, zz + 1), Mobj);
+0060
+0061     % Finally, make some [depth, sigma] arrays.
+0062     Mobj.siglevz = repmat(Mobj.h, 1, conf.nlev) .* Mobj.siglev;
+0063     Mobj.siglayz = repmat(Mobj.h, 1, conf.nlev-1) .* Mobj.siglay;
+0064     if isfield(Mobj, 'hc')
+0065         Mobj.siglevzc = repmat(Mobj.hc, 1, conf.nlev) .* Mobj.siglevc;
+0066         Mobj.siglayzc= repmat(Mobj.hc, 1, conf.nlev-1) .* Mobj.siglayc;
+0067     end
+0068 else
+0069     Mobj = dist;
+0070 end
+0071 % generate sigma file
+0072 % Save to the given file name.
+0073 if nargin==5
+0074     fout = fopen(sigma_file, 'wt');
+0075     assert(fout >= 0, 'Error opening sigma file: %s', sigma_file)
+0076     fprintf(fout, 'NUMBER OF SIGMA LEVELS = %d\n', nlev);
+0077     fprintf(fout, 'SIGMA COORDINATE TYPE = TANH\n');
+0078     fprintf(fout, 'DU = %4.1f\n', du);
+0079     fprintf(fout, 'DL = %4.1f\n', dl);
+0080     fprintf(fout,'\n');
+0081     fclose(fout);
+0082 end
+0083```
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/surrounders.html b/doc/utilities/surrounders.html index 2ec28d6..4309fef 100644 --- a/doc/utilities/surrounders.html +++ b/doc/utilities/surrounders.html @@ -117,6 +117,6 @@ This function is called by: 0038 0039 eidx = max((abs(triangles - n) == 0), [], 2); 0040 nodes = unique(triangles(triangles(eidx) ~= n, :)); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/transect_nodes_screen.html b/doc/utilities/transect_nodes_screen.html index d0c642b..710c310 100644 --- a/doc/utilities/transect_nodes_screen.html +++ b/doc/utilities/transect_nodes_screen.html @@ -234,6 +234,6 @@ This function is called by: 0160 transect.y=unique(transect.y); 0161 transect.idx=unique(transect.idx); 0162 return -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/tri_from_bndry.html b/doc/utilities/tri_from_bndry.html index 1482e6f..2841e49 100755 --- a/doc/utilities/tri_from_bndry.html +++ b/doc/utilities/tri_from_bndry.html @@ -93,6 +93,6 @@ This function is called by: 0045 tri(:,1) = a(2,:); 0046 tri(:,2) = a(3,:); 0047 tri(:,3) = a(4,:); -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/turbine_area_sigma.html b/doc/utilities/turbine_area_sigma.html index 873b6e2..6dcddba 100644 --- a/doc/utilities/turbine_area_sigma.html +++ b/doc/utilities/turbine_area_sigma.html @@ -24,22 +24,27 @@
Calculate the fraction of the rotor swept area is occupying each sigma layer

## SYNOPSIS

-
function sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig)
+
function sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig, subplot_info)

## DESCRIPTION

``` Calculate the fraction of the rotor swept area is occupying each sigma layer

Example Usage:

- sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig)
+ sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig, subplot_info)

Input Parameters:     H  - mean sea level (m)
Ht - height of turbine hub above seabed (m)
r  - turbine rotor radius (m)
sigLay - number of sigma layers (not levels) in the model
-                       plot_fig - flag to plot a figure (optional)
+                       plot_fig - optional; flag to plot a figure
+                       subplot_info - optional; if present should be an
+                       array containing the three parameters to subplot
+                       that should be used to put the figure into a
+                       subplot.

- Rory O'Hara Murray, 19-Nov-2014```
+ Rory O'Hara Murray, 19-Nov-2014 + Simon Waldman, 2016.

## CROSS-REFERENCE INFORMATION

@@ -58,120 +63,130 @@ This function is called by: 0002 % 0003 % Example Usage: 0004 % -0005 % sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig) +0005 % sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig, subplot_info) 0006 % 0007 % Input Parameters: H - mean sea level (m) 0008 % Ht - height of turbine hub above seabed (m) 0009 % r - turbine rotor radius (m) 0010 % sigLay - number of sigma layers (not levels) in the model -0011 % plot_fig - flag to plot a figure (optional) -0012 % -0013 % Rory O'Hara Murray, 19-Nov-2014 -0014 % -0015 function sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig) -0016 -0017 assert(nargin >= 4, 'Not enough arguments.'); -0018 assert(isnumeric(sigLay) && sigLay - fix(sigLay) < eps, 'sigLay (4th parameter) must be an integer number of sigma layers.'); -0019 -0020 if nargin<5 -0021 plot_fig = false; -0022 end -0023 -0024 % Turbine and sigma layer parameters -0025 elev = 0; % water elevation above/below MSL - change this to see how the sigma layer occupation fraction changes with the tide -0026 depth = H + elev; -0027 -0028 dT = depth - Ht; % turbine hub depth -0029 -0030 assert(dT>r, 'Turbine will stick out of water'); -0031 -0032 dLay = depth./sigLay; -0033 zLev = [0:-dLay:-depth]'; -0034 -0035 % what sigma layer is the hub in? -0036 drsl = zLev+dT; % depth of hub relative to each sigma level -0037 hub_sigma = sum(drsl>=0); -0038 -0039 %% draw sigma levels / layers -0040 if plot_fig -0041 figure -0042 plot([-r r], zLev*[1 1]) -0043 xlabel('Distance (m)') -0044 ylabel('Depth (m)') -0045 title([num2str(depth, '%2.0f') ' m water depth']) -0046 -0047 % draw rotor area -0048 a=0; -0049 b=-dT; -0050 ang = 0:pi/20:2*pi; -0051 x=r*cos(ang); -0052 y=r*sin(ang); -0053 hold on -0054 plot(a+x,b+y, a, b, 'o') -0055 end -0056 %% what fraction of the rotor area is in each sigma layer? -0057 -0058 % loop trough all segments below the hub -0059 dBot=-drsl(-drsl>=0);% the minimum of this array is hub height above a sigma level -0060 numBot=sum(dBot<=r); -0061 segmentsBotCum = []; -0062 for ii=1:numBot -0063 phi = acos(dBot(ii)/r); -0064 sector = phi*r*r; -0065 triBot(ii) = r*sin(phi)*dBot(ii); -0066 segmentsBotCum(ii) = sector-triBot(ii); -0067 end -0068 -0069 % loop through all the segments above the hub -0070 dTop=flip(drsl(drsl>=0)); -0071 numTop=sum(dTop<=r); -0072 segmentsTopCum = []; -0073 for ii=1:numTop -0074 phi = acos(dTop(ii)/r); -0075 sector = phi*r*r; -0076 triTop(ii) = r*sin(phi)*dTop(ii); -0077 segmentsTopCum(ii) = sector-triTop(ii); -0078 end -0079 -0080 -0081 segmentsTopCum2 = flip(segmentsTopCum); -0082 segmentsTop = segmentsTopCum2-[0 segmentsTopCum2(1:end-1)]; -0083 segmentsBot = segmentsBotCum-[segmentsBotCum(2:end) 0]; -0084 -0085 % check that there are segments below/above hub, i.e. whether the rotors -0086 % actually span multiple sigma layers -0087 % sig_cent is area of the rotors in the layer the hub is in -0088 if numTop>0 & numBot>0 -0089 sigCent = pi*r*r-segmentsTopCum(1)-segmentsBotCum(1); -0090 elseif numTop==0 & numBot>0 -0091 sigCent = pi*r*r-segmentsBotCum(1); -0092 elseif numTop>0 & numBot==0 -0093 sigCent = pi*r*r-segmentsTopCum(1); -0094 elseif numTop==0 & numBot==0 % entire rotor is confined to one sigma layer -0095 sigCent = pi*r*r; -0096 end -0097 -0098 % if sigCent is zero then the hub must exactely co-inside with a sigma -0099 % level (unusual...) check it's larger than a very small area (or zero) -0100 if sigCent>0 -0101 % if hub co-insides exactely with a sigma level -0102 segments = [segmentsTop sigCent segmentsBot]; -0103 segments_frac = segments./(pi*r*r); -0104 sig_span = hub_sigma + [-length(segmentsTop) length(segmentsBot)]; -0105 numSigma = numTop+numBot+1; % total number of occupied sigma layers -0106 else -0107 segments = [segmentsTop segmentsBot]; -0108 segments_frac = segments./(pi*r*r); -0109 sig_span = hub_sigma + [-length(segmentsTop) length(segmentsBot)-1]; -0110 numSigma = numTop+numBot; % total number of occupied sigma layers -0111 end -0112 -0113 % work out the fraction of the turbine area in each sigma layer -0114 sigma_frac = zeros(1,sigLay); -0115 sigma_frac(sig_span(1):sig_span(2)) = segments_frac; -0116 -0117 total_frac = sum(sigma_frac); -0118 -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+0011 % plot_fig - optional; flag to plot a figure +0012 % subplot_info - optional; if present should be an +0013 % array containing the three parameters to subplot +0014 % that should be used to put the figure into a +0015 % subplot. +0016 % +0017 % Rory O'Hara Murray, 19-Nov-2014 +0018 % Simon Waldman, 2016. +0019 % +0020 function sigma_frac = turbine_area_sigma(H, Ht, r, sigLay, plot_fig, subplot_info) +0021 +0022 assert(nargin >= 4, 'Not enough arguments.'); +0023 assert(isnumeric(sigLay) && sigLay - fix(sigLay) < eps, 'sigLay (4th parameter) must be an integer number of sigma layers.'); +0024 +0025 if nargin<5 +0026 plot_fig = false; +0027 end +0028 if nargin<6 +0029 splot = false; +0030 else +0031 splot = true; +0032 end +0033 +0034 dT = H - Ht; % turbine hub depth +0035 +0036 assert(dT>r, 'Turbine will stick out of water'); +0037 +0038 dLay = H./sigLay; +0039 zLev = [0:-dLay:-H]'; +0040 +0041 % what sigma layer is the hub in? +0042 drsl = zLev+dT; % depth of hub relative to each sigma level +0043 hub_sigma = sum(drsl>=0); +0044 +0045 %% draw sigma levels / layers +0046 if plot_fig +0047 if splot +0048 subplot( subplot_info(1), subplot_info(2), subplot_info(3) ) +0049 else +0050 figure +0051 end +0052 plot([-r r], zLev*[1 1]) +0053 xlabel('Distance (m)') +0054 ylabel('Depth (m)') +0055 title([num2str(H, '%2.0f') ' m water depth']) +0056 +0057 % draw rotor area +0058 a=0; +0059 b=-dT; +0060 ang = 0:pi/20:2*pi; +0061 x=r*cos(ang); +0062 y=r*sin(ang); +0063 hold on +0064 plot(a+x,b+y, a, b, 'o') +0065 end +0066 %% what fraction of the rotor area is in each sigma layer? +0067 +0068 % loop trough all segments below the hub +0069 dBot=-drsl(-drsl>=0);% the minimum of this array is hub height above a sigma level +0070 numBot=sum(dBot<=r); +0071 segmentsBotCum = []; +0072 for ii=1:numBot +0073 phi = acos(dBot(ii)/r); +0074 sector = phi*r*r; +0075 triBot(ii) = r*sin(phi)*dBot(ii); +0076 segmentsBotCum(ii) = sector-triBot(ii); +0077 end +0078 +0079 % loop through all the segments above the hub +0080 dTop=flip(drsl(drsl>=0)); +0081 numTop=sum(dTop<=r); +0082 segmentsTopCum = []; +0083 for ii=1:numTop +0084 phi = acos(dTop(ii)/r); +0085 sector = phi*r*r; +0086 triTop(ii) = r*sin(phi)*dTop(ii); +0087 segmentsTopCum(ii) = sector-triTop(ii); +0088 end +0089 +0090 +0091 segmentsTopCum2 = flip(segmentsTopCum); +0092 segmentsTop = segmentsTopCum2-[0 segmentsTopCum2(1:end-1)]; +0093 segmentsBot = segmentsBotCum-[segmentsBotCum(2:end) 0]; +0094 +0095 % check that there are segments below/above hub, i.e. whether the rotors +0096 % actually span multiple sigma layers +0097 % sig_cent is area of the rotors in the layer the hub is in +0098 if numTop>0 & numBot>0 +0099 sigCent = pi*r*r-segmentsTopCum(1)-segmentsBotCum(1); +0100 elseif numTop==0 & numBot>0 +0101 sigCent = pi*r*r-segmentsBotCum(1); +0102 elseif numTop>0 & numBot==0 +0103 sigCent = pi*r*r-segmentsTopCum(1); +0104 elseif numTop==0 & numBot==0 % entire rotor is confined to one sigma layer +0105 sigCent = pi*r*r; +0106 end +0107 +0108 % if sigCent is zero then the hub must exactely co-inside with a sigma +0109 % level (unusual...) check it's larger than a very small area (or zero) +0110 if sigCent>0 +0111 % if hub co-insides exactely with a sigma level +0112 segments = [segmentsTop sigCent segmentsBot]; +0113 segments_frac = segments./(pi*r*r); +0114 sig_span = hub_sigma + [-length(segmentsTop) length(segmentsBot)]; +0115 numSigma = numTop+numBot+1; % total number of occupied sigma layers +0116 else +0117 segments = [segmentsTop segmentsBot]; +0118 segments_frac = segments./(pi*r*r); +0119 sig_span = hub_sigma + [-length(segmentsTop) length(segmentsBot)-1]; +0120 numSigma = numTop+numBot; % total number of occupied sigma layers +0121 end +0122 +0123 % work out the fraction of the turbine area in each sigma layer +0124 sigma_frac = zeros(1,sigLay); +0125 sigma_frac(sig_span(1):sig_span(2)) = segments_frac; +0126 +0127 total_frac = sum(sigma_frac); +0128 +
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/utm2deg.html b/doc/utilities/utm2deg.html index 5092e61..9d4d154 100644 --- a/doc/utilities/utm2deg.html +++ b/doc/utilities/utm2deg.html @@ -224,6 +224,6 @@ This function is called by: 0132 Lon(i)=longitude; 0133 0134 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/wave_fric.html b/doc/utilities/wave_fric.html index 06acb3f..3f6d8e3 100755 --- a/doc/utilities/wave_fric.html +++ b/doc/utilities/wave_fric.html @@ -64,6 +64,6 @@ This function is called by: 0020 fw = max(fwr,fws); %wave friction factor 0021 0022 tauw = 0.5*rho*fw*u_orb*u_orb; %wave shear stress -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/wgs2utm.html b/doc/utilities/wgs2utm.html index 97907fa..771e0d8 100644 --- a/doc/utilities/wgs2utm.html +++ b/doc/utilities/wgs2utm.html @@ -259,6 +259,6 @@ This function is called by: 0153 utmzone = floor(Lon0./6)+31; 0154 utmhemi = char( 83.* (Lat < 0) + 78.* (Lat >= 0) ); 0155 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/write_SMS_2dm.html b/doc/utilities/write_SMS_2dm.html index 9aefaea..8e5d3d6 100644 --- a/doc/utilities/write_SMS_2dm.html +++ b/doc/utilities/write_SMS_2dm.html @@ -180,6 +180,6 @@ This function is called by: 0105 if ftbverbose 0106 fprintf('end : %s\n', subname) 0107 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/write_SMS_cst.html b/doc/utilities/write_SMS_cst.html index 86996a6..9d7ba14 100644 --- a/doc/utilities/write_SMS_cst.html +++ b/doc/utilities/write_SMS_cst.html @@ -147,6 +147,6 @@ This function is called by: 0076 if ftbverbose 0077 fprintf('end : %s \n', subname) 0078 end -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file diff --git a/doc/utilities/zero_to_nan.html b/doc/utilities/zero_to_nan.html index e5cc634..92262e5 100644 --- a/doc/utilities/zero_to_nan.html +++ b/doc/utilities/zero_to_nan.html @@ -60,6 +60,6 @@ This function is called by: 0009 % 2017-03-27 Removed the loops and used logical indexing instead. 0010 0011 array(array == 0) = nan; -
Generated on Thu 01-Feb-2018 09:49:00 by m2html © 2005
+
Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005
\ No newline at end of file -- 2.24.1