Ignore:
Timestamp:
02/19/16 14:34:03 (8 years ago)
Author:
mhnguyen
Message:

Relaxing constraints on reading attributes from a file.

+) If there is no coordinate (lon, lat) in file, there wont be error anymore.
It's user who will provide these info.

Test
+) On Curie
+) Correct on test_remap

File:
1 edited

Legend:

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

    r811 r825  
    2828    this->timeCounterName = timeCounterName; 
    2929    if (!CNetCdfInterface::isDimExisted(this->ncidp, this->timeCounterName)) this->timeCounterName=this->getUnlimitedDimensionName() ; 
    30      
     30 
    3131  } 
    3232 
     
    6363    int varid = 0; 
    6464    int grpid = this->getGroup(path); 
    65     CNetCdfInterface::inqVarId(grpid, varname, varid); 
     65    if (this->hasVariable(varname, path)) 
     66      CNetCdfInterface::inqVarId(grpid, varname, varid); 
    6667    return varid; 
    6768  } 
     
    344345    { 
    345346      const StdString& varname = *it; 
    346       if (varname.compare(0, name.size(), name) == 0) return true; 
     347      if ((varname.compare(0, name.size(), name) == 0) && (0 != name.size())) return true; 
    347348    } 
    348349    return false; 
     
    726727                                       const CVarPath* const path) 
    727728  { 
     729    StdString lonName; 
    728730    std::list<StdString>::const_iterator itbList, itList, iteList; 
    729731    std::list<StdString> clist = this->getCoordinatesIdList(varname, path); 
     
    735737        StdString unit = this->getAttributeValue(CCFKeywords::XIOS_CF_units, &(*itList), path); 
    736738        if (CCFConvention::XIOS_CF_Longitude_units.end() != CCFConvention::XIOS_CF_Longitude_units.find(unit)) 
    737           return *itList; 
    738       } 
    739     } 
     739        { 
     740          lonName = *itList; 
     741          return lonName; 
     742        } 
     743      } 
     744    } 
     745    return lonName; 
    740746  } 
    741747 
     
    743749                                       const CVarPath* const path) 
    744750  { 
     751    StdString latName; 
    745752    std::list<StdString>::const_iterator itbList, itList, iteList; 
    746753    std::list<StdString> clist = this->getCoordinatesIdList(varname, path); 
     
    752759        StdString unit = this->getAttributeValue(CCFKeywords::XIOS_CF_units, &(*itList), path); 
    753760        if (CCFConvention::XIOS_CF_Latitude_units.end() != CCFConvention::XIOS_CF_Latitude_units.find(unit)) 
    754           return *itList; 
    755       } 
    756     } 
     761        { 
     762          latName = *itList; 
     763          return latName; 
     764        } 
     765      } 
     766    } 
     767    return latName; 
    757768  } 
    758769 
Note: See TracChangeset for help on using the changeset viewer.