Changeset 1437


Ignore:
Timestamp:
02/22/18 10:46:48 (6 years ago)
Author:
oabramkina
Message:

Bugfix for writing of axes: writing of axis values were attempted when values were not provided.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp

    r1436 r1437  
    13661366            { 
    13671367              if (axis->label.isEmpty()) 
    1368                 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); 
    1369  
    1370               if (!axis->bounds.isEmpty() && axis->label.isEmpty()) 
    13711368              { 
     1369                if (!axis->value.isEmpty()) 
     1370                  SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); 
     1371 
     1372                if (!axis->bounds.isEmpty()) 
     1373                { 
    13721374                  axis_bounds.resize(2, indexToWrite.numElements()); 
    13731375                  for (int i = 0; i < nbWritten; ++i) 
     
    13851387                    } 
    13861388                  } 
    1387  
    1388                 SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0); 
     1389                  SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0); 
     1390                } 
    13891391              } 
    1390  
    1391               // Need to check after 
    1392               if (!axis->label.isEmpty()) 
     1392              else 
    13931393                SuperClassWriter::writeData(axis_label, axisid, isCollective, 0); 
    13941394 
     
    14061406 
    14071407              if (axis->label.isEmpty()) 
    1408                 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count); 
    1409  
    1410               if (!axis->bounds.isEmpty() && axis->label.isEmpty()) 
    14111408              { 
    1412                 axis_bounds.resize(2, indexToWrite.numElements()); 
    1413                 for (int i = 0; i < nbWritten; ++i) 
     1409                if (!axis->value.isEmpty()) 
     1410                  SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count); 
     1411 
     1412                if (!axis->bounds.isEmpty()) 
    14141413                { 
    1415                   if (i < axis->bounds.columns()) 
     1414                  axis_bounds.resize(2, indexToWrite.numElements()); 
     1415                  for (int i = 0; i < nbWritten; ++i) 
    14161416                  { 
    1417                     axis_bounds(0, i) = axis->bounds(0, int(indexToWrite(i))); 
    1418                     axis_bounds(1, i) = axis->bounds(1, int(indexToWrite(i))); 
     1417                    if (i < axis->bounds.columns()) 
     1418                    { 
     1419                      axis_bounds(0, i) = axis->bounds(0, int(indexToWrite(i))); 
     1420                      axis_bounds(1, i) = axis->bounds(1, int(indexToWrite(i))); 
     1421                    } 
     1422                    else 
     1423                    { 
     1424                      axis_bounds(0, i) = 0.; 
     1425                      axis_bounds(1, i) = 0.; 
     1426                    } 
    14191427                  } 
    1420                   else 
    1421                   { 
    1422                     axis_bounds(0, i) = 0.; 
    1423                     axis_bounds(1, i) = 0.; 
    1424                   } 
     1428                  SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds); 
    14251429                } 
    1426                 SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds); 
    14271430              } 
    1428  
    1429               // Need to check after 
    1430               if (!axis->label.isEmpty()) 
     1431              else 
    14311432              { 
    14321433                std::vector<StdSize> startLabel(2), countLabel(2); 
Note: See TracChangeset for help on using the changeset viewer.