Changeset 1445


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

Changes concerning reading of a grid.

With introduction of new grid attributes and relaxing certain conditions on naming of attribues and coordinates in revisions r1430 and r1435, the algorithm on determining the type of a domain needed to be adjusted.

Tests: all three types of domain with various additional dimensions (scalar and axis with/without value/label).

Location:
XIOS/dev/XIOS_DEV_CMIP6/src/io
Files:
2 edited

Legend:

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

    r1444 r1445  
    501501    { 
    502502      const StdString& coord = *it; 
    503       if (this->hasVariable(coord, path) && !this->isTemporal(coord, path)) 
     503      if (this->hasVariable(coord, path) && !this->isTemporal(coord, path) && this->isLonOrLat(coord, path)) 
    504504      { 
    505505        std::map<StdString, StdSize> dimvar = this->getDimensions(&coord, path); 
    506506        if ((dimvar.size() == 1)) 
    507507        { 
    508           // Check that the coordinate is not a scalar label 
    509           StdString dimTmp = dimvar.begin()->first; 
    510           if (dimTmp.compare("str_len") != 0) 
    511           { 
    512             dimVarList.insert(dimvar.begin()->first); 
    513             continue; 
    514           } 
     508          dimVarList.insert(dimvar.begin()->first); 
     509          continue; 
    515510        } 
    516         else 
    517           return false; 
    518       } 
    519     } 
    520  
     511      } 
     512    } 
    521513    return (dimVarList.size() != 1); 
    522514  } 
     
    534526    { 
    535527      const StdString& coord = *it; 
    536       if (this->hasVariable(coord, path) && !this->isTemporal(coord, path)) 
     528      if (this->hasVariable(coord, path) && !this->isTemporal(coord, path) && this->isLonOrLat(coord, path)) 
    537529      { 
    538530        std::map<StdString, StdSize> dimvar = this->getDimensions(&coord, path); 
     
    561553    { 
    562554      const StdString& coord = *it; 
    563       if (this->hasVariable(coord, path) && !this->isTemporal(coord, path)) 
     555      if (this->hasVariable(coord, path) && !this->isTemporal(coord, path) && this->isLonOrLat(coord, path)) 
    564556      { 
    565557        std::map<StdString, StdSize> dimvar = this->getDimensions(&coord, path); 
     
    791783      return *(++(++clist.rbegin())); 
    792784  } 
     785 
     786  bool CINetCDF4::isLonOrLat(const StdString& varname, const CVarPath* const path) 
     787  { 
     788  if (this->hasAttribute(CCFKeywords::XIOS_CF_units, &varname, path)) 
     789  { 
     790    StdString unit = this->getAttributeValue(CCFKeywords::XIOS_CF_units, &varname, path); 
     791    return (CCFConvention::XIOS_CF_Latitude_units.end() != CCFConvention::XIOS_CF_Latitude_units.find(unit) 
     792            || CCFConvention::XIOS_CF_Longitude_units.end() != CCFConvention::XIOS_CF_Longitude_units.find(unit)); 
     793    } 
     794  } 
     795 
    793796} // namespace xios 
  • XIOS/dev/XIOS_DEV_CMIP6/src/io/inetcdf4.hpp

    r802 r1445  
    135135      bool isCellGrid(const StdString& name, const CVarPath* const path = NULL); 
    136136 
     137      bool isLonOrLat(const StdString& varname, const CVarPath* const path = NULL); 
     138 
    137139    protected: 
    138140      /// Getters /// 
Note: See TracChangeset for help on using the changeset viewer.