Changeset 1310


Ignore:
Timestamp:
10/24/17 10:51:51 (5 years ago)
Author:
ymipsl
Message:

Bug fix. Try to read axis value in a file even if not defined.

YM

File:
1 edited

Legend:

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

    r1256 r1310  
    492492 
    493493    { // Read axis value 
    494       std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second); 
    495       CArray<double,1> readAxisValue(itMapN->second); 
    496       readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true); 
    497       int begin = 0, n = itMapN->second; 
    498       if (!axis->begin.isEmpty()) begin = axis->begin.getValue(); 
    499       if (!axis->n.isEmpty()) n = axis->n.getValue(); 
    500       axis->value.resize(n); 
    501       for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i); 
     494      bool hasValue = SuperClassWriter::hasVariable(itMapN->first); 
     495      if (hasValue) 
     496      { 
     497        std::vector<StdSize> nBegin(1, 0), nSize(1, itMapN->second); 
     498        CArray<double,1> readAxisValue(itMapN->second); 
     499        readFieldVariableValue(readAxisValue, itMapN->first, nBegin, nSize, true); 
     500        int begin = 0, n = itMapN->second; 
     501        if (!axis->begin.isEmpty()) begin = axis->begin.getValue(); 
     502        if (!axis->n.isEmpty()) n = axis->n.getValue(); 
     503        axis->value.resize(n); 
     504        for (int i = 0; i < n; ++i) axis->value(i) = readAxisValue(begin + i); 
     505      } 
    502506    } 
    503507  } 
Note: See TracChangeset for help on using the changeset viewer.