<p><b>ringler@lanl.gov</b> 2009-08-22 03:04:10 -0600 (Sat, 22 Aug 2009)</p><p><br>
altered netcdf reads to reflect new ordering in output.nc<br>
<br>
diagnostic variables are not converted and viewed correctly<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/swmodel/matlab/MapDataToDx.m
===================================================================
--- trunk/swmodel/matlab/MapDataToDx.m        2009-08-21 21:28:10 UTC (rev 34)
+++ trunk/swmodel/matlab/MapDataToDx.m        2009-08-22 09:04:10 UTC (rev 35)
@@ -13,12 +13,12 @@
doVorticity = 1;
doVelocity = 1;
-[nCellsName, nCellsLength] = netcdf.inqDim(ncid,0);
-[nEdgesName, nEdgesLength] = netcdf.inqDim(ncid,1);
-[nVerticesName, nVerticesLength] = netcdf.inqDim(ncid,2);
-[nVertLevelsName, nVertLevelsLength] = netcdf.inqDim(ncid,7);
-[nTracersName, nTracersLength] = netcdf.inqDim(ncid,8);
-[TimeName, TimeLength] = netcdf.inqDim(ncid,9);
+[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);
thicknessID = netcdf.inqVarID(ncid,'h');
work = netcdf.getVar(ncid,thicknessID);
@@ -90,8 +90,8 @@
stringVert = int2str(iLevel)
FileName = strcat('../dx/', vorticityName, '.', ...
stringVert, '.', stringTime, '.', 'data')
- for iLevelex=1:nVerticesLength
- data = vorticity(iLevel,iLevelex,iTime+1);
+ for iVertex=1:nVerticesLength
+ data = vorticity(iLevel,iVertex,iTime+1);
if abs(data) < eps, data=0;, end
dlmwrite(FileName, data, ...
'precision', '%18.10e', '-append')
Modified: trunk/swmodel/matlab/MapGridToDx.m
===================================================================
--- trunk/swmodel/matlab/MapGridToDx.m        2009-08-21 21:28:10 UTC (rev 34)
+++ trunk/swmodel/matlab/MapGridToDx.m        2009-08-22 09:04:10 UTC (rev 35)
@@ -10,16 +10,16 @@
doTri = 1
doEdge = 1
-ncid = netcdf.open('../grid.nc','nc_nowrite')
+ncid = netcdf.open('../grid.nc','nc_nowrite');
if (doVor == 1)
- xV_id = netcdf.inqVarID(ncid,'xVertex')
- yV_id = netcdf.inqVarID(ncid,'yVertex')
- zV_id = netcdf.inqVarID(ncid,'zVertex')
- nEdgesOnCell_id = netcdf.inqVarID(ncid,'nEdgesOnCell')
- verticesOnCell_id = netcdf.inqVarID(ncid,'verticesOnCell')
- areaCell_id = netcdf.inqVarID(ncid,'areaCell')
+ xV_id = netcdf.inqVarID(ncid,'xVertex');
+ yV_id = netcdf.inqVarID(ncid,'yVertex');
+ zV_id = netcdf.inqVarID(ncid,'zVertex');
+ nEdgesOnCell_id = netcdf.inqVarID(ncid,'nEdgesOnCell');
+ verticesOnCell_id = netcdf.inqVarID(ncid,'verticesOnCell');
+ areaCell_id = netcdf.inqVarID(ncid,'areaCell');
xV=netcdf.getVar(ncid, xV_id);
yV=netcdf.getVar(ncid, yV_id);
@@ -28,31 +28,31 @@
verticesOnCell=netcdf.getVar(ncid, verticesOnCell_id);
areaCell = netcdf.getVar(ncid, areaCell_id);
- work=size(nEdgesOnCell(:,1))
+ work=size(nEdgesOnCell(:,1));
nCells=work(1)
if (doWrite == 1)
- system('rm -f ../dx/vor.position.data')
- system('rm -f ../dx/vor.edge.data')
- system('rm -f ../dx/vor.loop.data')
- system('rm -f ../dx/vor.face.data')
- system('rm -f ../dx/vor.area.data')
+ system('rm -f ../dx/vor.position.data');
+ system('rm -f ../dx/vor.edge.data');
+ system('rm -f ../dx/vor.loop.data');
+ system('rm -f ../dx/vor.face.data');
+ system('rm -f ../dx/vor.area.data');
iloop=0;
iedge=0;
for i=1:nCells
- dlmwrite('../dx/vor.face.data', i-1, '-append')
+ dlmwrite('../dx/vor.face.data', i-1, '-append');
dlmwrite('../dx/vor.area.data', areaCell(i), ...
- 'precision', '%18.10e', '-append')
+ 'precision', '%18.10e', '-append');
dlmwrite('../dx/vor.loop.data', iloop, ...
- 'precision', '%10i', '-append')
+ 'precision', '%10i', '-append');
edge(1:nEdgesOnCell(i)) = iedge;
for j=1:nEdgesOnCell(i)
x(1) = xV(verticesOnCell(j,i));
x(2) = yV(verticesOnCell(j,i));
x(3) = zV(verticesOnCell(j,i));
dlmwrite('../dx/vor.position.data', x, 'delimiter', '\t', ...
- 'precision', '%18.10e', '-append')
+ 'precision', '%18.10e', '-append');
edge(j) = iedge + j - 1;
end;
dlmwrite('../dx/vor.edge.data', edge(1:nEdgesOnCell(i)), ...
@@ -67,12 +67,12 @@
if (doTri == 1)
- xC_id = netcdf.inqVarID(ncid,'xCell')
- yC_id = netcdf.inqVarID(ncid,'yCell')
- zC_id = netcdf.inqVarID(ncid,'zCell')
+ xC_id = netcdf.inqVarID(ncid,'xCell');
+ yC_id = netcdf.inqVarID(ncid,'yCell');
+ zC_id = netcdf.inqVarID(ncid,'zCell');
nCellsOnVertex = 3;
- cellsOnVertex_id = netcdf.inqVarID(ncid, 'cellsOnVertex')
- areaTriangle_id = netcdf.inqVarID(ncid,'areaTriangle')
+ cellsOnVertex_id = netcdf.inqVarID(ncid, 'cellsOnVertex');
+ areaTriangle_id = netcdf.inqVarID(ncid,'areaTriangle');
xC=netcdf.getVar(ncid, xC_id);
yC=netcdf.getVar(ncid, yC_id);
@@ -80,24 +80,24 @@
cellsOnVertex=netcdf.getVar(ncid, cellsOnVertex_id);
areaTriangle = netcdf.getVar(ncid, areaTriangle_id);
- work=size(cellsOnVertex)
+ work=size(cellsOnVertex);
nVertices = work(:,2)
if (doWrite == 1)
- system('rm -f ../dx/tri.position.data')
- system('rm -f ../dx/tri.edge.data')
- system('rm -f ../dx/tri.loop.data')
- system('rm -f ../dx/tri.face.data')
- system('rm -f ../dx/tri.area.data')
+ system('rm -f ../dx/tri.position.data');
+ system('rm -f ../dx/tri.edge.data');
+ system('rm -f ../dx/tri.loop.data');
+ system('rm -f ../dx/tri.face.data');
+ system('rm -f ../dx/tri.area.data');
iloop=0;
iedge=0;
for i=1:nVertices
- dlmwrite('../dx/tri.face.data', i-1, '-append')
+ dlmwrite('../dx/tri.face.data', i-1, '-append');
dlmwrite('../dx/tri.area.data', areaTriangle(i), ...
- 'precision', '%18.10e', '-append')
+ 'precision', '%18.10e', '-append');
dlmwrite('../dx/tri.loop.data', iloop, ...
- 'precision', '%10i', '-append')
+ 'precision', '%10i', '-append');
edge(1:3) = iedge;
for j=1:nCellsOnVertex
x(1) = xC(cellsOnVertex(j,i));
</font>
</pre>