Changeset 1486


Ignore:
Timestamp:
04/20/18 14:33:46 (3 years ago)
Author:
oabramkina
Message:

XIOS_DEV_CMIP: minor modifications for reading UGRID.

Using attribute nvertex defined by a user and not deduced from metadata of a file being read.
Taking into account the fact that the bounds attribute is not required by UGRID.

Location:
XIOS/dev/XIOS_DEV_CMIP6/src
Files:
4 edited

Legend:

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

    r1485 r1486  
    1111{ 
    1212  CNc4DataInput::CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, 
    13                                bool readMetaDataPar /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 
     13                               bool readMetaDataPar /*= false*/, bool ugridConvention /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 
    1414    : SuperClass() 
    1515    , SuperClassWriter(filename, &comm_file, multifile, readMetaDataPar, timeCounterName) 
     
    1717    , filename(filename) 
    1818    , isCollective(isCollective) 
     19    , ugridConvention(ugridConvention) 
    1920    , readMetaDataDomains_(), readValueDomains_() 
    2021    , readMetaDataAxis_(), readValueAxis_() 
     
    419420      StdString boundsLonName = this->getBoundsId(lonName); 
    420421 
    421       int nbVertex = this->getNbVertex(fieldId); 
     422      if (ugridConvention && domain->nvertex.isEmpty()) 
     423      { 
     424        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
     425          << " Attribute nvertex must be specified for domain " << domain->getDomainOutputName() 
     426          << " read from UGRID file " << this->filename << " ."<< std::endl); 
     427      } 
     428//      int nbVertex = this->getNbVertex(fieldId); 
     429      int nbVertex = (ugridConvention) ? domain->nvertex : this->getNbVertex(fieldId); 
    422430      if (!domain->nvertex.isEmpty() && (domain->nvertex != nbVertex)) 
    423431      { 
  • XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.hpp

    r1485 r1486  
    2424    /// Constructors /// 
    2525    CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true, 
    26                   bool readMetaDataPar = false, const StdString& timeCounterName = "time_counter"); 
     26                  bool readMetaDataPar = false, bool ugridConvention = false, const StdString& timeCounterName = "time_counter"); 
    2727    CNc4DataInput(const CNc4DataInput& dataInput);       // Not implemented. 
    2828    CNc4DataInput(const CNc4DataInput* const dataInput); // Not implemented. 
     
    7373    const StdString filename; 
    7474    bool isCollective; 
     75    bool ugridConvention; 
    7576  }; // class CNc4DataInput 
    7677 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp

    r1457 r1486  
    14981498               << "Since 'bounds_lat_2d' is defined, 'latvalue_2d' must be defined too." << std::endl); 
    14991499 
    1500        hasBounds = true; 
     1500       // In case of reading UGRID bounds values are not required 
     1501       hasBounds = (!bounds_lat_1d.isEmpty() || !bounds_lat_2d.isEmpty() ); 
    15011502     } 
    15021503     else if (hasBoundValues) 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/file.cpp

    r1485 r1486  
    661661 
    662662      if (isOpen) data_out->closeFile(); 
    663       if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), readComm, multifile, isCollective, readMetaDataPar)); 
    664       else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), readComm, multifile, isCollective, readMetaDataPar, time_counter_name)); 
     663      bool ugridConvention = !convention.isEmpty() ? (convention == convention_attr::UGRID) : false; 
     664      if (time_counter_name.isEmpty()) 
     665        data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), readComm, multifile, isCollective, readMetaDataPar, ugridConvention)); 
     666      else 
     667        data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), readComm, multifile, isCollective, readMetaDataPar, ugridConvention, time_counter_name)); 
    665668      isOpen = true; 
    666669    } 
Note: See TracChangeset for help on using the changeset viewer.