<p><b>mpetersen@lanl.gov</b> 2012-05-23 08:44:20 -0600 (Wed, 23 May 2012)</p><p>transport_section tool:  Added sections for Agulhas current, Caribbian channels, and Arctic channels.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/tools/transport_sections/compute_transport.m
===================================================================
--- branches/tools/transport_sections/compute_transport.m        2012-05-22 20:50:11 UTC (rev 1930)
+++ branches/tools/transport_sections/compute_transport.m        2012-05-23 14:44:20 UTC (rev 1931)
@@ -62,13 +62,25 @@
          tr(k,i,iSection) = sectionEdgeSign(i,iSection)*sectionData(k,i,iSection,1);
       end
    end
+   
+   % Optional, for plotting the flow across a cross-section.
+   % This plots u on edges, so columns oscillate as edges change
+   % direction.  The best way to view a cross-section is to use the
+   % uMeridional and uZonal at the cell center.
    %figure(iSection+1)
    %imagesc(log(abs(tr(:,1:nEdgesInSection(iSection),iSection))))
    %imagesc(tr(:,1:nEdgesInSection(iSection),iSection))
    %colorbar  
 
+   % note: flow computed in matlab only matches that computed in
+   % MPAS-O if they both use hZLevel.  To do a verification check,
+   % replace the line 
+   %     * h_edge(k,iEdge)*m3ps_to_Sv;
+   % in mpas_ocn_time_average.F with the line
+   %     * hZLevel(k,iEdge)*m3ps_to_Sv;
+
    temptext = char(sectionText(iSection));
-   fprintf(['Section %3i, ' temptext(1:20) 'observed flow:' ...
+   fprintf(['Section %3i, ' temptext(1:22) ' observed flow:' ...
             temptext(63:75) ' mpas flow: %20.15f Sv</font>
<font color="gray">'],iSection,tr_total(iSection))
 
 %   fprintf(['Section %3i, ' temptext(1:20) 'observed flow:' ...

Modified: branches/tools/transport_sections/find_edge_sections.m
===================================================================
--- branches/tools/transport_sections/find_edge_sections.m        2012-05-22 20:50:11 UTC (rev 1930)
+++ branches/tools/transport_sections/find_edge_sections.m        2012-05-23 14:44:20 UTC (rev 1931)
@@ -34,6 +34,28 @@
 % the path to the end-edge before stopping with a warning.
 maxEdges = 1500;
 
+% Make sure sectionCoord traverse from south to north, and from east to west.
+%   [startlat startlon endlat endlon]
+nSections = size(sectionCoord,1);
+for j=1:nSections
+  latChange = sectionCoord(j,3) - sectionCoord(j,1);
+  lonChange = sectionCoord(j,4) - sectionCoord(j,2);
+  if abs(lonChange)&gt;abs(latChange) % zonal section
+    if lonChange&gt;0
+      fprintf(['Warning: Zonal sections should go from east to west.  ' ...
+         'For section %g start and end longitudes are %g, %g </font>
<font color="blue">'], ...
+          j,sectionCoord(j,2),sectionCoord(j,4))
+    end
+  else
+    if latChange&lt;0
+      fprintf(['Warning: Meridional sections should go from south to north.  ' ...
+         'For section %g start and end latitudes are %g, %g </font>
<font color="gray">'], ...
+          j,sectionCoord(j,1),sectionCoord(j,3))
+    end
+  end
+  
+end
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 %  Read edge and edge data from grid file
@@ -53,8 +75,6 @@
 [dimname,vertexDegree]= netcdf.inqDim(ncid,netcdf.inqDimID(ncid,'vertexDegree'));
 netcdf.close(ncid)
 
-nSections = size(sectionCoord,1);
-
 % Grid variables should be:
 % lat varies from -pi/2:pi/2
 % lon varies from 0:2*pi

Modified: branches/tools/transport_sections/sub_plot_edge_sections.m
===================================================================
--- branches/tools/transport_sections/sub_plot_edge_sections.m        2012-05-22 20:50:11 UTC (rev 1930)
+++ branches/tools/transport_sections/sub_plot_edge_sections.m        2012-05-23 14:44:20 UTC (rev 1931)
@@ -4,7 +4,7 @@
      sectionEdgeIndex, nEdgesInSection,...
      fid_latex)
 
-% Plot cell section locations on world map
+% Plot edge section locations on world map
 
 % Mark Petersen, MPAS-Ocean Team, LANL, May 2012
 
@@ -12,13 +12,13 @@
 % dir                text string, name of simulation
 % sectionCoord(nSections,4)  endpoints of sections, with one section per row as
 %                     [startlat startlon endlat endlon]
-% latCellDeg(nCells)                         lat arrays for all cells
-% lonCellDeg(nCells)                         lon arrays for all cells  
-% sectionEdgeIndex(maxEdges,nSections)       cell index of each section
-% nEdgesInSection(nSections)                 number of cells in each section
+% latVertexDeg(nVertices)                         lat arrays for all vertices
+% lonVertexDeg(nVertices)                         lon arrays for all vertices  
+% sectionEdgeIndex(maxEdges,nSections)       edge index of each section
+% nEdgesInSection(nSections)                 number of edges in each section
 % fid_latex           file ID of latex file
 
-fprintf(['** sub_plot_cell_sections, on figure 1.</font>
<font color="blue">'])
+fprintf(['** sub_plot_edge_sections, on figure 1.</font>
<font color="gray">'])
 
 nSections = size(sectionCoord,1);
 
@@ -75,7 +75,7 @@
  
  
    % plot vertexs.  This is just done for debugging.
-   %plot(lonVertexDeg,latVertexDeg,'.y')
+   plot(lonVertexDeg,latVertexDeg,'.y')
 
    grid on
 
@@ -85,6 +85,7 @@
 
      h=plot([mod(lonCoordDeg,360)],[latCoordDeg],'*-');
      set(h,'Color','y','LineWidth',1)
+     h=plot([mod(lonCoordDeg(1),360)],[latCoordDeg(1)],'*k');
 
      for i=1:nEdgesInSection(iSection)
         h = line([lonSectionVertex(i,iSection) lonSectionVertex(i+1,iSection)],...
@@ -108,7 +109,7 @@
    dir_name1 =  regexprep(dir,'\.','_');
    dir_name2 =  regexprep(dir_name1,'/','_');
    filename=['f/' dir_name2 '_vertex_map' ];
-   print('-djpeg',[filename '.jpg'])
+   print('-djpeg',[filename '.jpg']);
    
    % put printing text in a latex file
    fprintf(fid_latex,...

Modified: branches/tools/transport_sections/transport_sections.m
===================================================================
--- branches/tools/transport_sections/transport_sections.m        2012-05-22 20:50:11 UTC (rev 1930)
+++ branches/tools/transport_sections/transport_sections.m        2012-05-23 14:44:20 UTC (rev 1931)
@@ -56,10 +56,6 @@
 %sim(1).dir='x1.120km';
 %sim(1).netcdf_file = 'output120km.0001-10-22_12:30:00.nc';
 
-%clear sim
-%sim(1).dir='p91l';
-%sim(1).netcdf_file = 'output120km.0001-10-22_00.00.00.nc';
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 %  Specify section coordinates and text
@@ -67,36 +63,64 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % sectionText        a cell array with text describing each section
 sectionText = {
-'Drake Passage,         -56  to -63 lat,  68W lon, section A21, 140+/- 6 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis ',...
-'S Ocean, Tasmania-Ant, -44  to -66 lat, 140E lon, section P12, 157+/-10 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis ',...
-'S Ocean, Africa-Ant,   -31.3to -70 lat,  30E lon, section  I6,          Sv in Ganachaud99thesis                         ',...
-'Florida Current,        27 lat, -80  to -78.8lon,             31.5+/-1.5Sv in Johns_ea02dsr, 32.3+/-3.2Sv Larsen92rslpt '...
-'Indonesian Throughflow, -9  to -18 lat, 116E lon, section J89,  16+/- 5 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis ',...
-'Mozambique Channel,    -25 lat,  35  to  44E lon, section I4 ,  14+/- 6 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis ',...
+'Drake Passage, S Ocean -56  to -63 lat,  68W lon, section A21,  140+/- 6 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis',...
+'Tasmania-Ant, S Ocean  -44  to -66 lat, 140E lon, section P12,  157+/-10 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis',...
+'Africa-Ant, S Ocean    -31.3to -70 lat,  30E lon, section  I6,           Sv in Ganachaud99thesis                        ',...
+'Antilles Inflow, Carib.                                       -18.4+/-4.7Sv in Johns_ea02dsr                            '...
+'Mona Passage, Caribbian                                        -2.6+/-1.2Sv in Johns_ea02dsr                            '...
+'Windward Passage, Carib                                        -7.0      Sv in Nelepo_ea76sr, Roemmich81jgr             '...
+'Florida-Cuba, Caribbian                                        31.5+/-1.5Sv in Johns_ea02dsr, 32.3+/-3.2Sv Larsen92rslpt'...
+'Florida-Bahamas, Carib. 27 lat, -80  to -78.8lon,              31.5+/-1.5Sv in Johns_ea02dsr, 32.3+/-3.2Sv Larsen92rslpt'...
+'Indonesian Throughflow, -9  to -18 lat, 116E lon, section J89,  -16+/- 5 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis',...
+'Agulhas                                                         -70+/-20 Sv in Bryden_Beal01dsr                         ',...
+'Mozambique Channel,    -25 lat,  35  to  44E lon, section I4 ,  -14+/- 6 Sv in Ganachaud_Wunsch00n and Ganachaud99thesis',...
+'Bering Strait, Arctic                                          0.83+/-0.66Sv in Roach_ea95jgr                           '...
     };
+%'Lancaster Sound, Arctic                                        0.67+/-0.3Sv in Maltrud_McLean05om                       '...
+%'Fram Strait, Arctic                                           -4.2+/-2.3Sv in Fahrbach_ea01pr                           '...
+%'Robeson Channel, Arctic                                       -0.75+/-0.2Sv in Maltrud_McLean05om                       '...
 
 % sectionAbbreviation an 8-character title for each section
 sectionAbbreviation = [...
     'Drake Pa';...
     'Tasm-Ant';...
     'Afri-Ant';...
-    'Flor Cur';...
+    'Antilles';...
+    'Mona Pas';...
+    'Wind Pas';...
+    'FL-Cuba ';...
+    'FL-Baham';...
     'Ind Thru';...
+    'Agulhas ';...
     'Mozam Ch';...
+    'Bering  ';...
 ];
+%    'Lancastr';...
+%   'Fram    ';...
+%   'Robeson ';...
 
 % sectionCoord(nSections,4)  endpoints of sections, with one section per row as
-%                     [startlat startlon endlat endlon]
+%   [startlat startlon endlat endlon]
 % Traverse from south to north, and from east to west.
 % Then positive velocities are eastward and northward.
 sectionCoord = [...
- -64.5 -64   -55    -65.3;... % Drake
- -67   140   -43.5  147;...   % Tasm-Ant
- -31.3  30   -70.0   30;...   % Afri-Ant
-  26.52 -78.78 26.7 -80;...   % Flor Cur  
- -21   116    -8.8  116;...   % Ind Thru
- -25    44   -25     34;...   % Mozam Ch
+ -64.5  -64    -55    -65.3;... % Drake
+ -67    140    -43.5  147  ;... % Tasm-Ant
+ -70.0   30    -31.3   30  ;... % Afri-Ant
+  10.7  -63.2   18.0  -65.9;... % Antilles  
+  18.4  -67.2   18.4  -68.5;... % Mona Passage
+  19.8  -73.4   20.1  -74.3;... % Windward Passage
+  23.1  -81.0   25.15 -81.0;... % Florida-Cuba
+  26.52 -78.78  26.7  -80.1;... % Florida-Bahamas
+ -21    116.0   -8.8  116  ;... % Ind Thru
+ -32.4   32.0  -31.0   30.2;... % Agulhas
+ -25     44.0  -25.0   34  ;... % Mozam Ch
+  65.8 -167.7   66.1 -169.7;... % Bering St
   ];
+%  73.7  -80.6   74.6  -81.0;... % Lancaster Sound- was not able to
+%  get this to connect for all resolutions
+% 79.7   10.7   79.7  -17.7;... % Fram St - crosses 0 lon.  This is not in code yet.
+% 81.0  -63.5   82.0  -63.5;... % Robeson Ch - was not able to get this to connect 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
@@ -111,7 +135,7 @@
 
 var_name = {...
 'acc_u',...
-}
+};
 
 var_conv_factor = [1 1 1]; % No conversion here.
 
@@ -124,9 +148,9 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 find_edge_sections_flag         = true ;
-write_edge_sections_text_flag   = false;
-write_edge_sections_netcdf_flag = false;
-plot_edge_sections_flag         = false;
+write_edge_sections_text_flag   = true ;
+write_edge_sections_netcdf_flag = true ;
+plot_edge_sections_flag         = true ;
 compute_transport_flag          = true ;
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -194,7 +218,7 @@
        sim(iSim).sectionEdgeIndex, sim(iSim).nEdgesInSection,...
        fid_latex);
   end
-
+return
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %
   %  Load large variables from netcdf file
@@ -220,7 +244,7 @@
       sim(iSim).sectionData,sectionText,sectionAbbreviation)
   end
 
-  close(fid_latex)
+  fclose(fid_latex);
   
 end % iSim
 

Modified: branches/tools/transport_sections/write_edge_sections_text.m
===================================================================
--- branches/tools/transport_sections/write_edge_sections_text.m        2012-05-22 20:50:11 UTC (rev 1930)
+++ branches/tools/transport_sections/write_edge_sections_text.m        2012-05-23 14:44:20 UTC (rev 1931)
@@ -31,7 +31,7 @@
 maxNEdgesInSection = max(nEdgesInSection);
 
 dir_name1 =  regexprep(dir,'/','_');
-unix(['mkdir text_files/' dir_name1 ]);
+unix(['mkdir -p text_files/' dir_name1 ]);
 
 % sectionEdgeIndex
 filename = ['text_files/' dir_name1 '/sectionEdgeIndex.txt'];

</font>
</pre>