Due to a shift in policy, from 0900 GMT on Wednesday 14th July 2021, we will be disabling ssh access to the server for external users. External users who wish to continue to access code repositories on the server will need to switch to using https. This can be accomplished in the following way: 1) On the repo on gitlab, use the clone dialogue and select ‘Clone with HTTPS’ to get the address of the repo; 2) From within the checkout of your repo run: $ git remote set-url origin HTTPS_ADDRESS. Here, replace HTTPS_ADDRESS with the address you have just copied from GitLab. Pulls and pushes will now require you to enter a username and password rather than using a ssh key. If you would prefer not to enter a password each time, you might consider caching your login credentials.

Commit 24229219 authored by Pierre Cazenave's avatar Pierre Cazenave

Update the documentation for the latest release.

parent 9ab7705d
......@@ -59,6 +59,6 @@ This function is called by:
0007 <span class="comment">% Revision history</span>
0008 <span class="comment">%</span>
0009 <span class="comment">%==============================================================================</span></pre></div>
<hr><address>Generated on Wed 10-Aug-2016 16:44:39 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
<hr><address>Generated on Thu 01-Feb-2018 09:49:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of do_residual</title>
<meta name="keywords" content="do_residual">
<meta name="description" content="DO_RESIDUAL Takes the u and v vectors of a model output and calculates">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_postproc</a> &gt; do_residual.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_postproc&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>do_residual
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>DO_RESIDUAL Takes the u and v vectors of a model output and calculates</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [rDir,rMag,uRes,vRes]=do_residual(u,v,dt) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> DO_RESIDUAL Takes the u and v vectors of a model output and calculates
the long-term direction and magnitude for that data.
[RDIR,RMAG,URES,VRES]=DO_RESIDUAL(U,V,DT) takes the residual direction
(RDIR) and magnitude RMAG) of the data in U and V sampled at interval
DT. URES and UDIR are the summed U and V positions (the raw data for a
progresive vector diagram). Direction output is in degrees, vector
magnitude in units/s.
Pierre Cazenave PML 20/03/2012.</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="do_residual_plot.html" class="code" title="function [Plots]=do_residual_plot(plotOPTS,FVCOM,dt)">do_residual_plot</a> Take the output of do_residual and plot as a vector figure. Summarises a</li></ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [rDir,rMag,uRes,vRes]=do_residual(u,v,dt)</a>
0002 <span class="comment">% DO_RESIDUAL Takes the u and v vectors of a model output and calculates</span>
0003 <span class="comment">% the long-term direction and magnitude for that data.</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% [RDIR,RMAG,URES,VRES]=DO_RESIDUAL(U,V,DT) takes the residual direction</span>
0006 <span class="comment">% (RDIR) and magnitude RMAG) of the data in U and V sampled at interval</span>
0007 <span class="comment">% DT. URES and UDIR are the summed U and V positions (the raw data for a</span>
0008 <span class="comment">% progresive vector diagram). Direction output is in degrees, vector</span>
0009 <span class="comment">% magnitude in units/s.</span>
0010 <span class="comment">%</span>
0011 <span class="comment">% Pierre Cazenave PML 20/03/2012.</span>
0012 <span class="comment">%</span>
0013
0014 <span class="comment">% Loosely based on my original dfsuResidual.m and processResidual function</span>
0015 <span class="comment">% for DHI's MIKE21 software, which in turn were based on Dave Lambkin's</span>
0016 <span class="comment">% residual analysis scripts.</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% TODO: Make it possible to specify the average for all layers (i.e. NZ is</span>
0019 <span class="comment">% all layers).</span>
0020
0021 <span class="comment">% Let's do it...</span>
0022
0023 toSecFactor=24*60*60;
0024
0025 nElements=size(u,1);
0026 nLayers=size(u,2);
0027 nTimeSteps=size(u,3);
0028
0029 <span class="comment">% Some tidal assumptions. This will need to change in areas in which the</span>
0030 <span class="comment">% diurnal tide dominates over the semidiurnal.</span>
0031 tideCycle=(12+(25/60))/24;
0032 tideWindow=ceil(tideCycle/dt);
0033 tideDuration=(mean((dt*nTimeSteps)-tideCycle)-mean(tideCycle))*toSecFactor;
0034
0035 <span class="comment">% Preallocate outputs.</span>
0036 uRes=zeros(nElements,nLayers,nTimeSteps);
0037 vRes=zeros(nElements,nLayers,nTimeSteps);
0038 uSum=nan(nElements,nTimeSteps,nLayers);
0039 vSum=nan(nElements,nTimeSteps,nLayers);
0040 uStart=nan(nElements,nLayers);
0041 vStart=nan(nElements,nLayers);
0042 uEnd=nan(nElements,nLayers);
0043 vEnd=nan(nElements,nLayers);
0044
0045 <span class="keyword">for</span> hh=1:nLayers
0046 uSum(:,:,hh)=cumsum(squeeze(u(:,hh,:)),2);
0047 vSum(:,:,hh)=cumsum(squeeze(v(:,hh,:)),2);
0048 <span class="keyword">for</span> ii=1:nTimeSteps;
0049 uRes(:,hh,ii)=uRes(:,hh,ii)+(uSum(:,ii,hh).*(dt*toSecFactor));
0050 vRes(:,hh,ii)=vRes(:,hh,ii)+(vSum(:,ii,hh).*(dt*toSecFactor));
0051 <span class="keyword">end</span>
0052 uStart(:,hh)=mean(squeeze(uRes(:,hh,1:tideWindow)),2);
0053 vStart(:,hh)=mean(squeeze(vRes(:,hh,1:tideWindow)),2);
0054 uEnd(:,hh)=mean(squeeze(uRes(:,hh,end-tideWindow:end)),2);
0055 vEnd(:,hh)=mean(squeeze(vRes(:,hh,end-tideWindow:end)),2);
0056 <span class="keyword">end</span>
0057
0058 uDiff=uEnd-uStart;
0059 vDiff=vEnd-vStart;
0060
0061 <span class="comment">% Calculate direction and magnitude.</span>
0062 rDir=atan2(uDiff,vDiff)*(180/pi); <span class="comment">% in degrees.</span>
0063 rMag=sqrt(uDiff.^2+vDiff.^2)/tideDuration; <span class="comment">% in units/s.</span></pre></div>
<hr><address>Generated on Thu 01-Feb-2018 09:49:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of do_residual_plot</title>
<meta name="keywords" content="do_residual_plot">
<meta name="description" content="Take the output of do_residual and plot as a vector figure. Summarises a">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_postproc</a> &gt; do_residual_plot.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_postproc&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>do_residual_plot
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Take the output of do_residual and plot as a vector figure. Summarises a</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [Plots]=do_residual_plot(plotOPTS,FVCOM,dt) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Take the output of do_residual and plot as a vector figure. Summarises a
specified interval of time as a single long-term direction and magnitude.</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="do_residual.html" class="code" title="function [rDir,rMag,uRes,vRes]=do_residual(u,v,dt)">do_residual</a> DO_RESIDUAL Takes the u and v vectors of a model output and calculates</li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Plots]=do_residual_plot(plotOPTS,FVCOM,dt)</a>
0002 <span class="comment">% Take the output of do_residual and plot as a vector figure. Summarises a</span>
0003 <span class="comment">% specified interval of time as a single long-term direction and magnitude.</span>
0004 m_mappath;
0005
0006 warning(<span class="string">'on'</span>,<span class="string">'FVCOM:Plot:ResidualAnalysis'</span>)
0007
0008 figure(plotOPTS.figure); clf
0009 m_proj(<span class="string">'UTM'</span>,<span class="string">'lon'</span>,[plotOPTS.range_lon],<span class="string">'lat'</span>,[plotOPTS.range_lat],<span class="string">'zon'</span>,30,<span class="string">'ell'</span>,<span class="string">'grs80'</span>);
0010 m_grid(<span class="string">'box'</span>,<span class="string">'fancy'</span>);
0011 m_usercoast(plotOPTS.coastline_file,<span class="string">'Color'</span>,<span class="string">'k'</span>,<span class="string">'LineWidth'</span>,3);
0012 [x,y]=m_ll2ll(FVCOM.xc,FVCOM.yc); x=x+6;
0013
0014 igood = find (x &lt; plotOPTS.range_lon(2) &amp; x &gt; plotOPTS.range_lon(1) &amp;<span class="keyword">...</span>
0015 y &lt; plotOPTS.range_lat(2) &amp; y &gt; plotOPTS.range_lat(1));
0016 igood=igood(1:plotOPTS.data_dec:end);
0017
0018 <span class="keyword">if</span> isfield(plotOPTS,<span class="string">'nz_plot_vec'</span>)
0019 nLayers=size(plotOPTS.nz_plot_vec,2);
0020 nLayersRange=plotOPTS.nz_plot_vec;
0021 <span class="keyword">else</span>
0022 nLayers=size(plotOPTS.nz_plot,2);
0023 nLayersRange=plotOPTS.nz_plot;
0024 <span class="keyword">end</span>
0025
0026 <span class="comment">% Check we're not depth averaging values.</span>
0027 <span class="keyword">if</span> isfield(plotOPTS,<span class="string">'depth_average'</span>) &amp;&amp; plotOPTS.depth_average
0028 <span class="keyword">if</span> nLayers&gt;1
0029 warning(<span class="string">'FVCOM:Plot:ResidualAnalysis'</span>,<span class="string">'Depth averaging has been set as well as a specific number of layers to extract. Usually one or the other is preferred.'</span>)
0030 <span class="keyword">end</span>
0031 nLayers=1;
0032 nLayersRange=1;
0033 <span class="comment">% Average through all depths. Don't squeeze() here as that's taken</span>
0034 <span class="comment">% care of in do_residual().</span>
0035 uIn=mean(FVCOM.u,2);
0036 vIn=mean(FVCOM.v,2);
0037 <span class="keyword">else</span>
0038 uIn=FVCOM.u(:,nLayersRange,:);
0039 vIn=FVCOM.v(:,nLayersRange,:);
0040 <span class="keyword">end</span>
0041
0042 <span class="keyword">if</span> nLayers==1
0043 colourSpec=[0 0 0];
0044 <span class="keyword">else</span>
0045 colourSpec=colormap(hsv(nLayers));
0046 setColourMap=1;
0047 <span class="keyword">end</span>
0048
0049 <span class="comment">% We're not using uRes and vRes here, but if you wanted to do a PVD, then</span>
0050 <span class="comment">% you would use:</span>
0051 <span class="comment">% plot(uRes(someElement,someLayer,:),vRes(someElement,someLayer,:),'.-'),</span>
0052 <span class="comment">% for example.</span>
0053 [rDir,rMag,uRes,vRes]=<a href="do_residual.html" class="code" title="function [rDir,rMag,uRes,vRes]=do_residual(u,v,dt)">do_residual</a>(uIn,vIn,dt);
0054
0055 <span class="comment">% Mesh goes underneath the vectors</span>
0056 <span class="keyword">if</span> plotOPTS.do_mesh
0057 <span class="comment">% plot vertices</span>
0058 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,<span class="string">'clip'</span>,<span class="string">'on'</span>);
0059 Plots(plotOPTS.figure).handles=patch(<span class="string">'Vertices'</span>,[X,Y],<span class="keyword">...</span>
0060 <span class="string">'Faces'</span>,plotOPTS.mesh.tri,<span class="string">'EdgeColor'</span>,[0.6 0.6 0.6],<span class="keyword">...</span>
0061 <span class="string">'FaceColor'</span>,<span class="string">'none'</span>); hold on
0062 <span class="keyword">end</span>
0063
0064 <span class="keyword">for</span> ii=1:nLayers
0065 <span class="comment">% Decompose to vector components for m_vec.</span>
0066 uVec=rMag(:,ii,:).*sind(rDir(:,ii,:));
0067 vVec=rMag(:,ii,:).*cosd(rDir(:,ii,:));
0068 [Plots(plotOPTS.figure).handles(ii),~]=m_vec(plotOPTS.vel_sca,<span class="keyword">...</span>
0069 x(igood),y(igood),squeeze(uVec(igood)),squeeze(vVec(igood)),<span class="keyword">...</span>
0070 colourSpec(ii,:),<span class="string">'shaftwidth'</span>,1,<span class="string">'headwidth'</span>,2);
0071 <span class="keyword">if</span> exist(<span class="string">'setColourMap'</span>,<span class="string">'var'</span>)
0072 <span class="keyword">if</span> setColourMap
0073 colorbar
0074 set(get(colorbar,<span class="string">'YLabel'</span>),<span class="string">'String'</span>,<span class="string">'Layer'</span>)
0075 <span class="keyword">end</span>
0076 <span class="keyword">end</span>
0077 <span class="keyword">end</span>
0078</pre></div>
<hr><address>Generated on Thu 01-Feb-2018 09:49:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of do_surface_plot</title>
<meta name="keywords" content="do_surface_plot">
<meta name="description" content="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_postproc</a> &gt; do_surface_plot.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_postproc&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>do_surface_plot
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong></strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [Plots]=do_surface_plot(plotOPTS,FVCOM) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment">
Function to display color maps of FVCOM variables (i.e. temperature)
[Plots]=do_surface_plot(plotOPTS,FVCOM)
DESCRIPTION:
Generates maps of variables using m_map toolbox (patch
INPUT:
plotOPTS = structure array with predefined options for generating the
maps
FVCOM = data extracted from FVCOM NC file. See read_netCDF_FVCOM for
details
plotOPTS.range_lat: [50.1000 50.4000]
plotOPTS.range_lon: [-4.5000 -3.8500]
plotOPTS.fig_name: 'co2_S5_slowleak'
plotOPTS.mesh: [1x1 struct]
plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'
plotOPTS.zone: 30
plotOPTS.ell: 'grs80'
plotOPTS.var_plot: 'PH'
plotOPTS.clims: [6 8]
plotOPTS.do_mesh: 0
plotOPTS.nz_plot: 1
plotOPTS.figure: 1
plotOPTS.Time_record: 7.3271e+05
plotOPTS.nz_plot_vec: 1
plotOPTS.data_dec: 5
plotOPTS.vel_sca: 5
plotOPTS.pause: 0.5000</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="example_surface_plot.html" class="code" title="">example_surface_plot</a> Sample script to extract and generate m_map contours of tracer variables</li></ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Plots]=do_surface_plot(plotOPTS,FVCOM)</a>
0002 <span class="comment">%</span>
0003 <span class="comment">% Function to display color maps of FVCOM variables (i.e. temperature)</span>
0004 <span class="comment">%</span>
0005 <span class="comment">% [Plots]=do_surface_plot(plotOPTS,FVCOM)</span>
0006 <span class="comment">%</span>
0007 <span class="comment">% DESCRIPTION:</span>
0008 <span class="comment">% Generates maps of variables using m_map toolbox (patch</span>
0009 <span class="comment">%</span>
0010 <span class="comment">% INPUT:</span>
0011 <span class="comment">% plotOPTS = structure array with predefined options for generating the</span>
0012 <span class="comment">% maps</span>
0013 <span class="comment">% FVCOM = data extracted from FVCOM NC file. See read_netCDF_FVCOM for</span>
0014 <span class="comment">% details</span>
0015 <span class="comment">%</span>
0016 <span class="comment">% plotOPTS.range_lat: [50.1000 50.4000]</span>
0017 <span class="comment">% plotOPTS.range_lon: [-4.5000 -3.8500]</span>
0018 <span class="comment">% plotOPTS.fig_name: 'co2_S5_slowleak'</span>
0019 <span class="comment">% plotOPTS.mesh: [1x1 struct]</span>
0020 <span class="comment">% plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'</span>
0021 <span class="comment">% plotOPTS.zone: 30</span>
0022 <span class="comment">% plotOPTS.ell: 'grs80'</span>
0023 <span class="comment">% plotOPTS.var_plot: 'PH'</span>
0024 <span class="comment">% plotOPTS.clims: [6 8]</span>
0025 <span class="comment">% plotOPTS.do_mesh: 0</span>
0026 <span class="comment">% plotOPTS.nz_plot: 1</span>
0027 <span class="comment">% plotOPTS.figure: 1</span>
0028 <span class="comment">% plotOPTS.Time_record: 7.3271e+05</span>
0029 <span class="comment">% plotOPTS.nz_plot_vec: 1</span>
0030 <span class="comment">% plotOPTS.data_dec: 5</span>
0031 <span class="comment">% plotOPTS.vel_sca: 5</span>
0032 <span class="comment">% plotOPTS.pause: 0.5000</span>
0033
0034 <span class="comment">%</span>
0035 <span class="comment">% OUTPUT:</span>
0036 <span class="comment">% Plots = structure array with figure handles</span>
0037 <span class="comment">%</span>
0038 <span class="comment">% EXAMPLE USAGE</span>
0039 <span class="comment">% [Plots]=do_surface_plot(plotOPTS,FVCOM)</span>
0040 <span class="comment">%</span>
0041 <span class="comment">% Author(s):</span>
0042 <span class="comment">% Ricardo Torres and Pierre Cazenave (Plymouth Marine Laboratory)</span>
0043 <span class="comment">%</span>
0044 <span class="comment">% Revision history</span>
0045 <span class="comment">%</span>
0046 <span class="comment">%==============================================================================</span>
0047 <span class="comment">%</span>
0048 m_mappath;
0049 <span class="comment">% adds m_map to matlab paths. file is in utilities directory.</span>
0050 <span class="comment">% amend according to your m_map installation paths</span>
0051
0052 figure(plotOPTS.figure);clf
0053 <span class="comment">% generate figure with correct projection lat and lon range ellipsoid and</span>
0054 <span class="comment">% zone.</span>
0055 m_proj(<span class="string">'UTM'</span>,<span class="string">'lon'</span>,[ plotOPTS.range_lon],<span class="string">'lat'</span>,[plotOPTS.range_lat],<span class="string">'zon'</span>,plotOPTS.zone,<span class="string">'ell'</span>,plotOPTS.ell)
0056 m_grid(<span class="string">'box'</span>,<span class="string">'fancy'</span>)
0057 <span class="comment">% add coastline if present</span>
0058 <span class="keyword">if</span> (isfield(plotOPTS,<span class="string">'coastline_file'</span>) &amp;&amp; ~isempty(plotOPTS.coastline_file) )
0059 m_usercoast(plotOPTS.coastline_file,<span class="string">'Color'</span>,<span class="string">'k'</span>,<span class="string">'LineWidth'</span>,3);
0060 <span class="keyword">end</span>
0061
0062 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,<span class="string">'clip'</span>,<span class="string">'on'</span>);
0063 <span class="comment">%------------------------------------------------------------------------------</span>
0064 <span class="comment">% Generate maps at a give level</span>
0065 <span class="comment">%------------------------------------------------------------------------------</span>
0066
0067 <span class="keyword">for</span> aa=1:length(plotOPTS.Time_record)
0068 fprintf(<span class="string">'Time step %i of %i\n'</span>,aa,length(plotOPTS.Time_record));
0069 <span class="comment">%plot map</span>
0070 hold on
0071 Plots(plotOPTS.figure).handles=patch(<span class="string">'Vertices'</span>,[X,Y],<span class="string">'Faces'</span>,plotOPTS.mesh.tri,<span class="keyword">...</span>
0072 <span class="string">'Cdata'</span>,squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),<span class="string">'edgecolor'</span>,<span class="string">'interp'</span>,<span class="string">'facecolor'</span>,<span class="string">'interp'</span>);
0073
0074 caxis(plotOPTS.clims)
0075 colorbar
0076 <span class="comment">% check if mesh elements are required</span>
0077 <span class="keyword">if</span> plotOPTS.do_mesh
0078 <span class="comment">%plot vertices</span>
0079 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,<span class="string">'clip'</span>,<span class="string">'on'</span>);
0080 Plots(plotOPTS.figure).mesh=patch(<span class="string">'Vertices'</span>,[X,Y],<span class="string">'Faces'</span>,plotOPTS.mesh.tri,<span class="keyword">...</span>
0081 <span class="string">'EdgeColor'</span>,[0.6 0.6 0.6],<span class="string">'FaceColor'</span>,<span class="string">'none'</span>);hold on
0082
0083 <span class="keyword">end</span>
0084 <span class="comment">%-----------------------------------------------------------------------</span>
0085 <span class="comment">% Only in my case it needs adding 6 because proj automatically determines a</span>
0086 <span class="comment">% reference long in strides of 6deg while m_map doesn't</span>
0087 <span class="comment">%------------------------------------------------------------------------</span>
0088 pause(.2)
0089 <span class="keyword">if</span> aa~=length(plotOPTS.Time_record)
0090 delete(Plots(plotOPTS.figure).handles(:))
0091 <span class="keyword">end</span>
0092
0093 <span class="keyword">end</span>
0094
0095 <span class="keyword">return</span>
0096</pre></div>
<hr><address>Generated on Thu 01-Feb-2018 09:49:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of do_surface_plotVel</title>
<meta name="keywords" content="do_surface_plotVel">
<meta name="description" content="reads image and plots tracks or stations">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt; <a href="index.html">fvcom_postproc</a> &gt; do_surface_plotVel.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for fvcom_postproc&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>do_surface_plotVel
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>reads image and plots tracks or stations</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [Plots]=do_surface_plotVel(plotOPTS,FVCOM) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> reads image and plots tracks or stations</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [Plots]=do_surface_plotVel(plotOPTS,FVCOM)</a>
0002 <span class="comment">% reads image and plots tracks or stations</span>
0003 m_mappath;
0004
0005 figure(plotOPTS.figure)
0006 <span class="comment">% set(gcf,'units','normalized','outerposition',[0 0 0.5 0.5])</span>
0007 clf
0008 m_proj(<span class="string">'UTM'</span>,<span class="string">'lon'</span>,[plotOPTS.range_lon],<span class="string">'lat'</span>,[plotOPTS.range_lat],<span class="string">'zon'</span>,plotOPTS.zone,<span class="string">'ell'</span>,<span class="string">'grs80'</span>)
0009 m_grid(<span class="string">'box'</span>,<span class="string">'fancy'</span>)
0010 set(gca,<span class="string">'FontSize'</span>,18)
0011
0012 m_usercoast(plotOPTS.coastline_file,<span class="string">'Color'</span>,<span class="string">'k'</span>,<span class="string">'LineWidth'</span>,3);
0013 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,<span class="string">'clip'</span>,<span class="string">'on'</span>);
0014
0015
0016 <span class="keyword">if</span> isfield(plotOPTS,<span class="string">'Time_record'</span>) &amp; isfield(FVCOM,<span class="string">'mattime'</span>)
0017 <span class="keyword">if</span> length(plotOPTS.Time_record)==1
0018 [dump,igoodT] = min(abs(plotOPTS.Time_record(1)-FVCOM.mattime));
0019 <span class="keyword">else</span>
0020
0021 igoodT = find( plotOPTS.Time_record(1) &lt;= FVCOM.mattime &amp; FVCOM.mattime &lt;= plotOPTS.Time_record(end) );
0022 <span class="keyword">end</span>
0023 <span class="keyword">else</span>
0024 igoodT=(1:length(FVCOM.(plotOPTS.var_plot)));
0025 <span class="keyword">end</span>
0026
0027
0028 <span class="keyword">for</span> aa=igoodT
0029 <span class="comment">% plot map with plotOPTS.var_plot</span>
0030 hold on
0031 <span class="keyword">try</span>
0032 <span class="comment">% 3D data (i.e. DYE, pH etc.)</span>
0033 Plots(1).handles=patch(<span class="string">'Vertices'</span>,[X,Y],<span class="string">'Faces'</span>,plotOPTS.mesh.tri,<span class="keyword">...</span>
0034 <span class="string">'FaceVertexCdata'</span>,squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),<span class="keyword">...</span>
0035 <span class="string">'CDataMapping'</span>,<span class="string">'scaled'</span>,<span class="string">'edgecolor'</span>,<span class="string">'none'</span>,<span class="string">'FaceColor'</span>,<span class="string">'flat'</span>);
0036 <span class="comment">% Plots(1).handles=scatter(plotOPTS.mesh.xc,plotOPTS.mesh.yc,20,squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'filled')</span>
0037 <span class="keyword">catch</span>
0038 <span class="comment">% 2D data only (i.e. zeta etc.)</span>
0039 Plots(1).handles=patch(<span class="string">'Vertices'</span>,[X,Y],<span class="string">'Faces'</span>,plotOPTS.mesh.tri,<span class="keyword">...</span>
0040 <span class="string">'FaceVertexCdata'</span>,squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),<span class="keyword">...</span>
0041 <span class="string">'CDataMapping'</span>,<span class="string">'scaled'</span>,<span class="string">'edgecolor'</span>,<span class="string">'none'</span>,<span class="string">'FaceColor'</span>,<span class="string">'flat'</span>);
0042 <span class="comment">% Plots(1).handles=scatter(plotOPTS.mesh.xc,plotOPTS.mesh.yc,20,squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),'filled')</span>
0043 <span class="keyword">end</span>
0044 fprintf(<span class="string">'Time step %i of %i\n'</span>,aa,length(plotOPTS.Time_record))
0045 display([<span class="string">'Time '</span>,datestr(FVCOM.mattime(aa))])
0046 caxis(plotOPTS.clims)
0047 colorbar
0048 set(get(colorbar,<span class="string">'YLabel'</span>),<span class="string">'String'</span>,plotOPTS.var_plot,<span class="string">'FontSize'</span>,14)
0049 <span class="comment">% check if mesh elements are required</span>
0050 <span class="keyword">if</span> plotOPTS.do_mesh
0051 <span class="comment">% plot vertices</span>
0052 [X,Y]=m_ll2xy(plotOPTS.mesh.lon,plotOPTS.mesh.lat,<span class="string">'clip'</span>,<span class="string">'on'</span>);
0053 patch(<span class="string">'Vertices'</span>,[X,Y],<span class="string">'Faces'</span>,plotOPTS.mesh.tri,<span class="keyword">...</span>
0054 <span class="string">'EdgeColor'</span>,[0.6 0.6 0.6],<span class="string">'FaceColor'</span>,<span class="string">'none'</span>); hold on
0055 <span class="keyword">end</span>
0056 <span class="comment">%----------------------------------------------------------------------</span>
0057 <span class="comment">% Only in my case it needs adding 6 because proj automatically</span>
0058 <span class="comment">% determines a reference long in strides of 6deg while m_map doesn't</span>
0059 <span class="comment">%----------------------------------------------------------------------</span>
0060 m_usercoast(plotOPTS.coastline_file,<span class="string">'patch'</span>,[0.6, 0.6, 0.6]);
0061 pause(plotOPTS.pause)
0062 <span class="comment">% if aa~=length(plotOPTS.Time_record)</span>
0063 <span class="comment">% delete(Plots(1).handles)</span>
0064 <span class="comment">% end</span>
0065 <span class="keyword">end</span>
0066
0067 <span class="keyword">return</span>
0068</pre></div>
<hr><address>Generated on Thu 01-Feb-2018 09:49:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
\ No newline at end of file