Changeset 782 for XIOS/trunk/src/io/nc4_data_input.cpp
- Timestamp:
- 11/12/15 16:33:03 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/io/nc4_data_input.cpp
r777 r782 202 202 \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file 203 203 \param [in] emelentPosition position of domain in grid 204 \param [in] fieldId id (or name) associated with the grid 204 205 */ 205 206 void CNc4DataInput::readDomainAttributeValueFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap, … … 227 228 else if (this->isCurvilinear(fieldId)) 228 229 { 229 230 int ni = domain->ni; 231 int nj = domain->nj; 232 std::vector<StdSize> nBeginLatLon(2), nSizeLatLon(2); 233 nBeginLatLon[0] = domain->jbegin.getValue(); nBeginLatLon[1] = domain->ibegin.getValue(); 234 nSizeLatLon[0] = nj; nSizeLatLon[1] = ni; 235 236 StdString latName = this->getLatCoordName(fieldId); 237 domain->latvalue_2d.resize(ni,nj); 238 readFieldVariableValue(domain->latvalue_2d, latName, nBeginLatLon, nSizeLatLon); 239 StdString lonName = this->getLonCoordName(fieldId); 240 domain->lonvalue_2d.resize(ni,nj); 241 readFieldVariableValue(domain->lonvalue_2d, lonName, nBeginLatLon, nSizeLatLon); 242 243 StdString boundsLatName = this->getBoundsId(latName); 244 if (0 == boundsLatName.compare("")) 245 ERROR("CNc4DataInput::readDomainAttributeValueFromFile(...)", 246 << "Field '" << fieldId << std::endl 247 << "Trying to read attributes from curvilinear grid." 248 << "Latitude variable " << latName << " does not have bounds."); 249 StdString boundsLonName = this->getBoundsId(lonName); 250 if (0 == boundsLonName.compare("")) 251 ERROR("CNc4DataInput::readDomainAttributeValueFromFile(...)", 252 << "Field '" << fieldId << std::endl 253 << "Trying to read attributes from curvilinear grid." 254 << "Longitude variable " << lonName << " does not have bounds."); 255 256 domain->nvertex.setValue(4); 257 std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 258 nBeginBndsLatLon[0] = domain->jbegin.getValue(); nSizeBndsLatLon[0] = nj; 259 nBeginBndsLatLon[1] = domain->ibegin.getValue(); nSizeBndsLatLon[1] = ni; 260 nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = 4; 261 262 domain->bounds_lat_2d.resize(4,ni,nj); 263 readFieldVariableValue(domain->bounds_lat_2d, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 264 domain->bounds_lon_2d.resize(4,ni,nj); 265 readFieldVariableValue(domain->bounds_lon_2d, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 230 266 } 231 267 else if (this->isUnstructured(fieldId)) … … 236 272 237 273 /*! 238 Read attribute sof a domain from a file274 Read attribute value of a domain from a file 239 275 \param [in] domain domain whose attributes are read from the file 240 276 \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file 241 277 \param [in] emelentPosition position of domain in grid 278 \param [in] fieldId id (or name) associated with the grid 242 279 */ 243 280 void CNc4DataInput::readDomainAttributesFromFile(CDomain* domain, std::map<StdString, StdSize>& dimSizeMap, … … 251 288 itMapNi = itMapNj; ++itMapNi; 252 289 253 if (this->isRectilinear(fieldId) )290 if (this->isRectilinear(fieldId) || this->isCurvilinear(fieldId)) 254 291 { 255 292 domain->nj_glo.setValue(itMapNj->second); 256 293 domain->ni_glo.setValue((itMapNi)->second); 257 }258 else if (this->isCurvilinear(fieldId))259 {260 261 294 } 262 295 else if (this->isUnstructured(fieldId)) … … 271 304 \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file 272 305 \param [in] emelentPosition position of axis in grid 306 \param [in] fieldId id (or name) associated with the grid 273 307 */ 274 308 void CNc4DataInput::readAxisAttributesFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap, … … 282 316 283 317 /*! 284 Read attribute sof an axis from a file318 Read attribute value of an axis from a file 285 319 \param [in] axis axis whose attributes are read from the file 286 320 \param [in] dimSizeMap Dimensions and and their corresponding names and size read from file 287 321 \param [in] emelentPosition position of axis in grid 322 \param [in] fieldId id (or name) associated with the grid 288 323 */ 289 324 void CNc4DataInput::readAxisAttributeValueFromFile(CAxis* axis, std::map<StdString, StdSize>& dimSizeMap, … … 306 341 } 307 342 308 void CNc4DataInput::readFieldVariableValue(CArray<double,1>& var, const StdString& varId,309 const std::vector<StdSize>& nBegin,310 const std::vector<StdSize>& nSize,311 bool forceIndependent)312 {313 if (SuperClass::type==MULTI_FILE || !isCollective) return;314 315 bool openCollective = isCollective;316 if (forceIndependent) openCollective = !isCollective;317 switch (SuperClass::type)318 {319 case MULTI_FILE:320 SuperClassWriter::getData(var, varId, openCollective, 0);321 break;322 case ONE_FILE:323 {324 SuperClassWriter::getData(var, varId, openCollective, 0, &nBegin, &nSize);325 break;326 }327 }328 }329 330 343 void CNc4DataInput::closeFile_(void) 331 344 {
Note: See TracChangeset
for help on using the changeset viewer.