Changeset 1487


Ignore:
Timestamp:
04/20/18 15:04:38 (3 years ago)
Author:
oabramkina
Message:

Trunk: 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/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/nc4_data_input.cpp

    r1257 r1487  
    1010namespace xios 
    1111{ 
    12   CNc4DataInput::CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 
     12  CNc4DataInput::CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, bool ugridConvention /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 
    1313    : SuperClass() 
    1414    , SuperClassWriter(filename, &comm_file, multifile, timeCounterName) 
     
    1616    , filename(filename) 
    1717    , isCollective(isCollective) 
     18    , ugridConvention(ugridConvention) 
    1819    , readMetaDataDomains_(), readValueDomains_() 
    1920    , readMetaDataAxis_(), readValueAxis_() 
     
    360361      StdString boundsLonName = this->getBoundsId(lonName); 
    361362 
    362       int nbVertex = this->getNbVertex(fieldId); 
     363      if (ugridConvention && domain->nvertex.isEmpty()) 
     364      { 
     365        ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
     366          << " Attribute nvertex must be specified for domain " << domain->getDomainOutputName() 
     367          << " read from UGRID file " << this->filename << " ."<< std::endl); 
     368      } 
     369//      int nbVertex = this->getNbVertex(fieldId); 
     370      int nbVertex = (ugridConvention) ? domain->nvertex : this->getNbVertex(fieldId); 
    363371      if (!domain->nvertex.isEmpty() && (domain->nvertex != nbVertex)) 
    364372      { 
  • XIOS/trunk/src/io/nc4_data_input.hpp

    r967 r1487  
    2424    /// Constructors /// 
    2525    CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true, 
    26                   const StdString& timeCounterName = "time_counter"); 
     26                  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/trunk/src/node/domain.cpp

    r1262 r1487  
    13691369               << "Since 'bounds_lat_2d' is defined, 'latvalue_2d' must be defined too." << std::endl); 
    13701370 
    1371        hasBounds = true; 
     1371       //hasBounds = true; 
     1372       // In case of reading UGRID bounds values are not required 
     1373       hasBounds = (!bounds_lat_1d.isEmpty() || !bounds_lat_2d.isEmpty() ); 
    13721374     } 
    13731375     else 
  • XIOS/trunk/src/node/file.cpp

    r1358 r1487  
    597597 
    598598      if (isOpen) data_out->closeFile(); 
    599       if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective)); 
    600       else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, time_counter_name)); 
     599      bool ugridConvention = !convention.isEmpty() ? (convention == convention_attr::UGRID) : false; 
     600      if (time_counter_name.isEmpty()) data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, ugridConvention)); 
     601      else data_in = shared_ptr<CDataInput>(new CNc4DataInput(oss.str(), fileComm, multifile, isCollective, ugridConvention, time_counter_name)); 
    601602      isOpen = true; 
    602603    } 
Note: See TracChangeset for help on using the changeset viewer.