<p><b>ringler@lanl.gov</b> 2012-03-16 10:49:49 -0600 (Fri, 16 Mar 2012)</p><p><br>
documented, cleaned up and generalized viz tools for OpenDX<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/OpenDX/movie.cfg
===================================================================
--- branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/OpenDX/movie.cfg        2012-03-16 16:37:59 UTC (rev 1659)
+++ branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/OpenDX/movie.cfg        2012-03-16 16:49:49 UTC (rev 1660)
@@ -1,5 +1,5 @@
 //
-// time: Thu Mar 15 16:53:00 2012
+// time: Fri Mar 16 10:48:58 2012
 //
 // version: 3.2.0 (format), 4.4.4 (DX)
 //
@@ -64,7 +64,7 @@
 // workspace: width = 500, height = 500
 // layout: snap = 0, width = 50, height = 50, align = NN
 //
-// panel[10]: position = (0.0039,0.1027), size = 0.1465x0.2852, startup = 1, devstyle = 1, screen = 0
+// panel[10]: position = (0.0039,0.1305), size = 0.1465x0.2852, startup = 1, devstyle = 1, screen = 0
 // title: value = Control Panel
 //
 // workspace: width = 500, height = 500
@@ -82,27 +82,21 @@
 // workspace: width = 500, height = 500
 // layout: snap = 0, width = 50, height = 50, align = NN
 //
+// panel[13]: position = (0.0039,0.0330), size = 0.1465x0.2852, startup = 1, devstyle = 1, screen = 0
+// title: value = Control Panel
+//
+// workspace: width = 500, height = 500
+// layout: snap = 0, width = 50, height = 50, align = NN
+//
 // interactor FileSelector[1]: num_components = 1, value = &quot;./movie/list.dx&quot;
 // instance: panel = 0, x = 5, y = 5, style = FileSelector, vertical = 1, size = 180x55
 //
 // interactor String[1]: num_components = 1, value = &quot;smovie&quot;
 // instance: panel = 1, x = 5, y = 5, style = Text, vertical = 1, size = 119x51
 //
-// interactor Integer[9]: num_components = 1, value = 1 
-// component[0]: minimum = -1e+06, maximum = 1e+06, global increment = 1, decimal = 0, global continuous = 0
-// instance: panel = 9, x = 5, y = 5, style = Stepper, vertical = 1, size = 119x54
-// local continuous: value = 0, mode = global
-// local increment[0]: value = 1, mode = global
-//
-// interactor Integer[10]: num_components = 1, value = 18 
-// component[0]: minimum = -1e+06, maximum = 1e+06, global increment = 1, decimal = 0, global continuous = 0
-// instance: panel = 10, x = 5, y = 5, style = Stepper, vertical = 1, size = 121x54
-// local continuous: value = 0, mode = global
-// local increment[0]: value = 1, mode = global
-//
 // node Sequencer[1]:
-// vcr[1]: min = 1, max = 18, beg = 1, end = 18, cur = 1, inc = 1, loop = off, step = off, pal = off
-// window: position = (0.0063,0.2015), size = 0.1094x0.0507, screen = 0
+// vcr[1]: min = 1, max = 32, beg = 1, end = 32, cur = 1, inc = 1, loop = off, step = off, pal = off
+// window: position = (0.6180,0.0165), size = 0.1355x0.0932, screen = 0
 // startup = 1
 //
 // interactor Scalar[2]: num_components = 1, value = -1500.0 
@@ -131,11 +125,12 @@
 // input[18]: defaulting = 0, value = 1.1363e-05
 // window: position = (0.0090,0.4785), size = 0.3230x0.4100, screen = 0
 //
-// interactor String[7]: num_components = 1, value = &quot;white&quot;
+// interactor String[7]: num_components = 1, value = &quot;black&quot;
+// instance: panel = 13, x = 5, y = 5, style = Text, vertical = 1, size = 126x51
 //
 // node Image[2]:
 // depth: value = 24
-// window: position = (0.3590,0.0114), size = 0.2758x0.9449, screen = 0
+// window: position = (0.3414,0.0146), size = 0.2758x0.9449, screen = 0
 // input[1]: defaulting = 0, value = &quot;Image_2&quot;
 // input[4]: defaulting = 0, value = 1
 // input[5]: defaulting = 0, value = [84316.1 212644 0]

Modified: branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/OpenDX/movie.net
===================================================================
--- branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/OpenDX/movie.net        2012-03-16 16:37:59 UTC (rev 1659)
+++ branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/OpenDX/movie.net        2012-03-16 16:49:49 UTC (rev 1660)
@@ -1,5 +1,5 @@
 //
-// time: Thu Mar 15 16:53:00 2012
+// time: Fri Mar 16 10:48:58 2012
 //
 // version: 3.2.0 (format), 4.4.4 (DX)
 //
@@ -36,46 +36,16 @@
     main_Import_1_in_6
     ) [instance: 1, cache: 1];
     // 
-    // node Integer[9]: x = 323, y = 69, inputs = 11, label = Integer
-    // input[1]: defaulting = 0, visible = 0, type = 32, value = &quot;Integer_9&quot;
-    // input[3]: defaulting = 0, visible = 0, type = 1, value = 1 
-    // input[5]: defaulting = 1, visible = 0, type = 1, value = -1000000
-    // input[6]: defaulting = 1, visible = 0, type = 1, value = 1000000
-    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
-    // input[9]: defaulting = 1, visible = 0, type = 1, value = 0
-    // output[1]: visible = 1, type = 1, value = 1 
-    //
-    // 
-    // node Integer[10]: x = 422, y = 61, inputs = 11, label = Integer
-    // input[1]: defaulting = 0, visible = 0, type = 32, value = &quot;Integer_10&quot;
-    // input[3]: defaulting = 0, visible = 0, type = 1, value = 18 
-    // input[5]: defaulting = 1, visible = 0, type = 1, value = -1000000
-    // input[6]: defaulting = 1, visible = 0, type = 1, value = 1000000
-    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
-    // input[9]: defaulting = 1, visible = 0, type = 1, value = 0
-    // output[1]: visible = 1, type = 1, value = 18 
-    //
-    // 
-    // node Sequencer[1]: x = 225, y = 249, inputs = 7, label = Sequencer
+    // node Sequencer[1]: x = 226, y = 249, inputs = 7, label = Sequencer
     // input[1]: defaulting = 0, visible = 0, type = 32, value = &quot;Sequencer_1&quot;
     // input[4]: defaulting = 1, visible = 1, type = 1, value = 1
-    // input[5]: defaulting = 1, visible = 1, type = 1, value = 18
+    // input[5]: defaulting = 1, visible = 1, type = 1, value = 32
     // input[6]: defaulting = 1, visible = 0, type = 1, value = 1
-    // input[7]: defaulting = 0, visible = 0, type = 16777217, value = { 1 18 1 1 18 1 }
-    // vcr[1]: min = 1, max = 18, beg = 1, end = 18, cur = 1, inc = 1, loop = off, step = off, pal = off
-    // window: position = (0.0063,0.2015), size = 0.1094x0.0507, screen = 0
+    // input[7]: defaulting = 0, visible = 0, type = 16777217, value = { 1 32 1 1 32 1 }
+    // vcr[1]: min = 1, max = 32, beg = 1, end = 32, cur = 1, inc = 1, loop = off, step = off, pal = off
+    // window: position = (0.6180,0.0165), size = 0.1355x0.0932, screen = 0
     //
-    main_Sequencer_1_in_3 = @frame;
-main_Sequencer_1_out_1[cache: 2] = 
-    Sequencer(
-    main_Sequencer_1_in_1,
-    main_Sequencer_1_in_2,
-    main_Sequencer_1_in_3,
-    main_Integer_9_out_1,
-    main_Integer_10_out_1,
-    main_Sequencer_1_in_6,
-    main_Sequencer_1_in_7
-    ) [instance: 1, cache: 1];
+    main_Sequencer_1_out_1 = @frame;
     // 
     // node Select[2]: x = 141, y = 320, inputs = 3, label = Select
     // input[2]: defaulting = 1, visible = 1, type = 1, value = 0
@@ -193,7 +163,7 @@
     ) [instance: 5, cache: 1];
     // 
     // node String[7]: x = 477, y = 583, inputs = 0, label = String
-    // output[1]: visible = 1, type = 32, value = &quot;white&quot;
+    // output[1]: visible = 1, type = 32, value = &quot;black&quot;
     //
     // 
     // node ColorBar[1]: x = 366, y = 689, inputs = 16, label = ColorBar
@@ -261,7 +231,7 @@
     // input[39]: defaulting = 0, visible = 0, type = 5, value = 0.5
     // input[41]: defaulting = 0, visible = 0, type = 32, value = &quot;none&quot;
     // depth: value = 24
-    // window: position = (0.3590,0.0114), size = 0.2758x0.9449, screen = 0
+    // window: position = (0.3414,0.0146), size = 0.2758x0.9449, screen = 0
     // internal caching: 1
     //
 main_Image_2_out_1,
@@ -319,15 +289,6 @@
     main_Image_2_in_49
     ) [instance: 2, cache: 1];
     // 
-    // node Overlay[1]: x = 89, y = 993, inputs = 3, label = Overlay
-    //
-main_Overlay_1_out_1 = 
-    Overlay(
-    main_Overlay_1_in_1,
-    main_Overlay_1_in_2,
-    main_Overlay_1_in_3
-    ) [instance: 1, cache: 1];
-    // 
     // node Render[1]: x = 395, y = 1045, inputs = 3, label = Render
     //
 main_Render_1_out_1 = 
@@ -356,40 +317,18 @@
 main_Import_1_in_5 = NULL;
 main_Import_1_in_6 = NULL;
 main_Import_1_out_1 = NULL;
-main_Integer_9_in_1 = &quot;Integer_9&quot;;
-main_Integer_9_in_2 = NULL;
-main_Integer_9_in_3 = 1 ;
-main_Integer_9_in_4 = NULL;
-main_Integer_9_in_5 = NULL;
-main_Integer_9_in_6 = NULL;
-main_Integer_9_in_7 = NULL;
-main_Integer_9_in_8 = NULL;
-main_Integer_9_in_9 = NULL;
-main_Integer_9_in_10 = NULL;
-main_Integer_9_in_11 = NULL;
-main_Integer_9_out_1 = 1 ;
-main_Integer_10_in_1 = &quot;Integer_10&quot;;
-main_Integer_10_in_2 = NULL;
-main_Integer_10_in_3 = 18 ;
-main_Integer_10_in_4 = NULL;
-main_Integer_10_in_5 = NULL;
-main_Integer_10_in_6 = NULL;
-main_Integer_10_in_7 = NULL;
-main_Integer_10_in_8 = NULL;
-main_Integer_10_in_9 = NULL;
-main_Integer_10_in_10 = NULL;
-main_Integer_10_in_11 = NULL;
-main_Integer_10_out_1 = 18 ;
 main_Sequencer_1_in_1 = &quot;Sequencer_1&quot;;
 main_Sequencer_1_in_2 = NULL;
 main_Sequencer_1_in_3 = NULL;
+main_Sequencer_1_in_4 = NULL;
+main_Sequencer_1_in_5 = NULL;
 main_Sequencer_1_in_6 = NULL;
-main_Sequencer_1_in_7 = { 1 18 1 1 18 1 };
+main_Sequencer_1_in_7 = { 1 32 1 1 32 1 };
 main_Sequencer_1_out_1 = NULL;
 
 @startframe = 1;
 @nextframe  = @startframe;
-@endframe   = 18;
+@endframe   = 32;
 @deltaframe = 1;
 main_Select_2_in_3 = NULL;
 main_Select_2_out_1 = NULL;
@@ -448,7 +387,7 @@
 main_Color_5_in_4 = NULL;
 main_Color_5_in_5 = NULL;
 main_Color_5_out_1 = NULL;
-main_String_7_out_1 = &quot;white&quot;;
+main_String_7_out_1 = &quot;black&quot;;
 main_ColorBar_1_in_2 = [0.16 0.06];
 main_ColorBar_1_in_3 = [200 15];
 main_ColorBar_1_in_4 = 0;
@@ -826,9 +765,6 @@
 main_Image_2_in_49 = NULL;
 main_Image_2_out_1 = NULL;
 main_Image_2_out_2 = NULL;
-main_Overlay_1_in_1 = NULL;
-main_Overlay_1_in_2 = NULL;
-main_Overlay_1_in_3 = NULL;
 main_Render_1_in_3 = NULL;
 main_Render_1_out_1 = NULL;
 main_WriteImage_1_in_2 = NULL;

Modified: branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/matlab/dump_frames_for_OpenDX.m
===================================================================
--- branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/matlab/dump_frames_for_OpenDX.m        2012-03-16 16:37:59 UTC (rev 1659)
+++ branches/ocean_projects/ocean_test_cases_staging/ocean/baroclinic_channel/viz_tools/matlab/dump_frames_for_OpenDX.m        2012-03-16 16:49:49 UTC (rev 1660)
@@ -4,60 +4,123 @@
 
 clear all
 
+%-------------------------------------------------------------------------
+% NOTE: relative to where this script is executed, we assume that the
+% following directories exist:
+%   ../OpenDX
+%   ../OpenDX/movie
+%   ../OpenDX/movie/data
+%
+% NOTE: we assume that the following files exist in ../OpenDX/movies
+%   ocean.position.data
+%   ocean.edge.data
+%   ocean.loop.data
+%   ocean.face.data
+%
+% All of the ocean.*.data files were created in when the basin mesh was
+% created. These files are grid specific and can be found in
+% branches/ocean_projects/basin/dx
+%
+% for baroclinic_channel test case, we generally have:
 % 10km: nx=16, nx=50, 4km: nx=40, ny=125, 1km: nx=160, ny=500
 %-------------------------------------------------------------------------
 
-nx=160
-ny=500
-iLevel = 1
-var = 'Vor_cell'
+%-------------------------------------------------------------------------
+% USERS: set the fields below here
+%-------------------------------------------------------------------------
+
+field3D=1            % set to 1 for 3D fields (like temperature) and 0 for 2D
+iLevel = 1           % if field3D=1, this the level to be extracted
+var = 'Vor_cell'     % this is the variable to be extracted (case sensitive)
+
+periodic=1      % for channels or any planar re-entrant settings, periodic=1
+nx=160          % when periodic == 1, must specify nx
+ny=500          % when periodic == 1, must specify ny
+
+
+% path the output netCDF file == resolution + time_step + output
 resolution = '../../1000m_20levs'
 time_step = 'se20_160_4procs'
 output = 'output.0000-01-01_00:00:00.nc'
 file = [resolution '/' time_step '/' output]
 
-%optional
+% if you don't want all time slices in output file, set the bounds here
+% default is from 1 to number of time records in netCDF file
+% so set nTimeMin&lt;1 to start at beginning of output file
+% and set nTimeMax to be very big to go to the end of output file
 nTimeMin = -1;
 nTimeMax = 9e10;
-nTimeShift = 0;
 
+
+%OpenDX sometimes has problems with very small numbers
+replaceSmallNumbers = 0;        % set to one to replace small numbers
+eps = 1.0e-12;                  % small numbers are set to this value
+
 %-------------------------------------------------------------------------
+%  USERS: no routine edits below here
+%-------------------------------------------------------------------------
 
 
-eps = 1.0e-12
 
+% OpenDX requires the first data field to be labeled with 0
+% so nTimeShift makes sure this is the case (not fully implemented)
+if nTimeMin &gt; 1
+    nTimeShift = -nTimeMin;
+else
+    nTimeShift = 0;
+end
+
+% data will be masked in OpenDX based on this value
+% this value must be hardwired into OpenDX, so change only when necessary
+mask_value = -1499.0
+
+% get a handle to the ouptut netCDF file
 ncid = netcdf.open(file,'nc_nowrite')
 
+% get some dimensions
+[TimeName, TimeLength] = netcdf.inqDim(ncid,1);
+[nCellsName, nCells] = netcdf.inqDim(ncid,2);
+[nEdgesName, nEdges] = netcdf.inqDim(ncid,3);
+[nVerticesName, nVertices] = netcdf.inqDim(ncid,7);
+[nVertLevelsName, nVertLevels] = netcdf.inqDim(ncid,13);
 
-[nCellsName, nCellsLength] = netcdf.inqDim(ncid,1);
-[nEdgesName, nEdgesLength] = netcdf.inqDim(ncid,2);
-[nVerticesName, nVerticesLength] = netcdf.inqDim(ncid,5);
-[nVertLevelsName, nVertLevelsLength] = netcdf.inqDim(ncid,8);
-[nTracersName, nTracersLength] = netcdf.inqDim(ncid,9);
-[TimeName, TimeLength] = netcdf.inqDim(ncid,0);
+% get nEdgesOnCell. sum(nEdgesOnCell) is exported to OpenDX files
+varID = netcdf.inqVarID(ncid,'nEdgesOnCell');
+[varName,xtype,dimids,natts] = netcdf.inqVar(ncid,varID);
+[numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid);
+nEdgesOnCell =  netcdf.getVar(ncid,varID);
 
+% get the depth of each column. cells below bottom are masked in OpenDX
+varID = netcdf.inqVarID(ncid,'maxLevelCell');
+[varName,xtype,dimids,natts] = netcdf.inqVar(ncid,varID);
+[numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid);
+maxLevelCell =  netcdf.getVar(ncid,varID);
+
+% find the starting and ending time as measured in the netCDF file
 iTimeMin = max(1,nTimeMin)
 iTimeMax = min(TimeLength,nTimeMax)
 nTime = iTimeMax - iTimeMin + 1
 
+% OK, get the data field (var) to be dumped to files
 varID = netcdf.inqVarID(ncid,var);
 [varName,xtype,dimids,natts] = netcdf.inqVar(ncid,varID);
 [numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid);
-
-size(dimids)
-dimids
-
 var =  netcdf.getVar(ncid,varID);
-size(var)
 a=size(var)
 
+% see if the specified min/max times are smaller than what is in the file
 iTimeMin = max(1,nTimeMin)
-iTimeMax = min(a(3),nTimeMax)
+if field3D == 1
+    iTimeMax = min(a(3),nTimeMax)
+else
+    iTimeMax = min(a(2),nTimeMax)
+end
 nTime = iTimeMax - iTimeMin + 1
 
-
+% we assume that ../OpenDX/movie exists
+% remove OpenDX files in that directory
 system('rm -f ../OpenDX/movie/list.dx')
-system('rm -f ../OpenDX/movie/data/scalar.*')
+system('rm -f ../OpenDX/movie/data/*.data')
 system('rm -f ../OpenDX/movie/*.dx')
 system('rm -f ../OpenDX/movie/*.data')
 str1 = [ 'cp ' resolution '/dx/ocean.dx ../OpenDX/movie/.' ]
@@ -71,32 +134,32 @@
 system(str4)
 system(str5)
 
-
+% build the header of list.dx file (this is the file that OpenDX will open)
 f1 = '../OpenDX/movie/list.dx'
 fid = fopen(f1, 'w');
 
-
-fprintf(fid, 'object &quot;positions list&quot; class array type float rank 1 shape 3 items 480000</font>
<font color="blue">')
+fprintf(fid, 'object &quot;positions list&quot; class array type float rank 1 shape 3 items %d </font>
<font color="black">', sum(nEdgesOnCell))
 fprintf(fid, 'ascii data file ocean.position.data</font>
<font color="black">')
 fprintf(fid, '</font>
<font color="red">')
 
-fprintf(fid, 'object &quot;edge list&quot; class array type int rank 0 items 480000</font>
<font color="blue">')
+fprintf(fid, 'object &quot;edge list&quot; class array type int rank 0 items  %d </font>
<font color="black">', sum(nEdgesOnCell))
 fprintf(fid, 'ascii data file ocean.edge.data</font>
<font color="black">')
 fprintf(fid, 'attribute &quot;ref&quot; string &quot;positions&quot;</font>
<font color="black">')
 fprintf(fid, '</font>
<font color="red">')
 
-fprintf(fid, 'object &quot;loops list&quot; class array type int rank 0 items 80000</font>
<font color="blue">')
+fprintf(fid, 'object &quot;loops list&quot; class array type int rank 0 items %d </font>
<font color="black">', nCells)
 fprintf(fid, 'ascii data file ocean.loop.data</font>
<font color="black">')
 fprintf(fid, 'attribute &quot;ref&quot; string &quot;edges&quot;</font>
<font color="black">')
 fprintf(fid, '</font>
<font color="red">')
 
-fprintf(fid, 'object &quot;face list&quot; class array type int rank 0 items 80000</font>
<font color="blue">')
+fprintf(fid, 'object &quot;face list&quot; class array type int rank 0 items %d </font>
<font color="black">', nCells)
 fprintf(fid, 'ascii data file ocean.face.data</font>
<font color="black">')
 fprintf(fid, 'attribute &quot;ref&quot; string &quot;loops&quot;</font>
<font color="black">')
 fprintf(fid, '</font>
<font color="gray">')
 
 varName = 'scalar'
 
+% dump the sequence of data to ../OpenDX/movie/data
 for iTime=iTimeMin:iTimeMax
     
     if(iTime &gt; 1001); quit; end;
@@ -113,22 +176,52 @@
     FileName = strcat('../OpenDX/movie/data/', varName, '.', stringTime)
     F1 =  strcat('./data/', varName, '.', stringTime)
     
-    x = var(iLevel,:,iTime+nTimeShift);
-    work = reshape(x,nx,ny);
-    work(1,:)=-1499.0;
-    work(nx,:)=-1499.0;
-    x=reshape(work,1,nx*ny);
+    if field3D == 1
+        x = var(iLevel,:,iTime+nTimeShift);
+    else
+        x = var(:,iTime+nTimeShift);
+    end
     
+    % the following will mask the first and last column (entry and exit)
+    % the masking takes place in OpenDX based on mask_value
+    if periodic == 1
+        work = reshape(x,nx,ny);
+        work(1,:)= mask_value;
+        work(nx,:)= mask_value;
+        x=reshape(work,1,nx*ny);
+    end
+    
+    % the following will mask values below ocean bottom
+    % the masking takes place in OpenDX based on mask_value
+    if field3D == 1
+    for i=1:nCells
+        if maxLevelCell(i) &lt; iLevel
+            x(1,i) = mask_value;
+        end
+    end
+    end
+    
+    
+    % the following will replace small abs number with user specified value
+    if replaceSmallNumbers == 1
+        for i=1:nCells
+            r = abs(x(1,i));
+            if r &lt; eps
+                x(1,i) = eps;
+            end
+        end
+    end
+    
+   
     dlmwrite(FileName, x, 'delimiter', '\t');
     
-    fprintf(fid,'object %i  class array type float rank 0 items 80000</font>
<font color="blue">', iTime-1)
+    fprintf(fid,'object %i  class array type float rank 0 items %d </font>
<font color="black">', iTime-1, nCells)
     fprintf(fid,'data file %s</font>
<font color="black">', F1)
     fprintf(fid, 'attribute &quot;dep&quot; string &quot;faces&quot;</font>
<font color="black">')
     fprintf(fid, '</font>
<font color="gray">')
 
 end
 
-system('cp ./data/scalar.0000001 ./ocean.area.data')
 
 for iTime=iTimeMin:iTimeMax
      if(iTime &gt; 1001); quit; end;
@@ -171,4 +264,7 @@
 
 end
 
+% put some data into ocean.area.data to be visualized with snapshot.net
+system('cp ../OpenDX/movie/data/scalar.0000001 ../OpenDX/movie/ocean.area.data')
+
 fclose(fid);
\ No newline at end of file

</font>
</pre>