Changeset 1413


Ignore:
Timestamp:
01/25/18 18:35:58 (3 years ago)
Author:
oabramkina
Message:

Reverting changes made in r1310 for local domain read of curvilinear and unstructured domains.
A possible bug in cases when the number of grid points is smaller than the number of clients. To be corrected.

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

Legend:

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

    r1410 r1413  
    264264    if ((CDomain::type_attr::rectilinear == domain->type)) 
    265265    { 
    266       // Ok, try to read some attributes such as longitude and latitude 
     266      // Ok, try to read some f.. attributes such as longitude and latitude 
    267267      bool hasLat = SuperClassWriter::hasVariable(itMapNj->first); 
    268268      if (hasLat) 
     
    283283    else if ((CDomain::type_attr::curvilinear == domain->type)) 
    284284    { 
    285       int ni, nj; 
     285      int ni = domain->ni; 
     286      int nj = domain->nj; 
    286287      std::vector<StdSize> nBeginLatLon(2), nSizeLatLon(2); 
    287  
    288       if (domain->ni.isEmpty()) 
    289       { 
    290         ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
    291           << " Value of attribute ni should be defined for domain " << domain->getDomainOutputName() 
    292           << " in file " << this->filename << "." 
    293           << " The value can be provided by a user or generated automatically by XIOS." 
    294           << " Functionality generate_rectilinear_domain can also be used for curvilinear domains." 
    295           << std::endl); 
    296       } 
    297  
    298       if (domain->nj.isEmpty()) 
    299       { 
    300         ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
    301           << " Value of attribute nj should be defined for domain " << domain->getDomainOutputName() 
    302           << " in file " << this->filename << "." 
    303           << " The value can be provided by a user or generated automatically by XIOS." 
    304           << " Functionality generate_rectilinear_domain can also be used for curvilinear domains." 
    305           << std::endl); 
    306       } 
    307  
    308       if (domain->ibegin.isEmpty()) 
    309       { 
    310         ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
    311           << " Value of attribute ibegin should be defined for domain " << domain->getDomainOutputName() 
    312           << " in file " << this->filename << "." 
    313           << " The value can be provided by a user or generated automatically by XIOS." 
    314           << " Functionality generate_rectilinear_domain can also be used for curvilinear domains." 
    315           << std::endl); 
    316       } 
    317  
    318       if (domain->jbegin.isEmpty()) 
    319       { 
    320         ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
    321           << " Value of attribute jbegin should be defined for domain " << domain->getDomainOutputName() 
    322           << " in file " << this->filename << "." 
    323           << " The value can be provided by a user or generated automatically by XIOS." 
    324           << " Functionality generate_rectilinear_domain can also be used for curvilinear domains." 
    325           << std::endl); 
    326       } 
    327  
    328       ni = domain->ni; 
    329       nj = domain->nj; 
    330       nBeginLatLon[0] = domain->jbegin; nBeginLatLon[1] = domain->ibegin; 
    331       nSizeLatLon[0]  = nj; nSizeLatLon[1] = ni; 
    332 //      ni = domain->ni_glo; 
    333 //      nj = domain->nj_glo; 
    334 //      nBeginLatLon[0] = 0; nBeginLatLon[1] = 0; 
    335 //      nSizeLatLon[0]  = domain->nj_glo.getValue(); nSizeLatLon[1] = domain->ni_glo.getValue(); 
     288      nBeginLatLon[0] = 0; nBeginLatLon[1] = 0; 
     289      nSizeLatLon[0]  = domain->nj_glo.getValue(); nSizeLatLon[1] = domain->ni_glo.getValue(); 
    336290 
    337291      StdString latName = this->getLatCoordName(fieldId); 
    338292      if (SuperClassWriter::hasVariable(latName)) 
    339293      { 
    340         domain->latvalue_curvilinear_read_from_file.resize(ni,nj); 
     294        domain->latvalue_curvilinear_read_from_file.resize(domain->ni_glo,domain->nj_glo); 
    341295        readFieldVariableValue(domain->latvalue_curvilinear_read_from_file, latName, nBeginLatLon, nSizeLatLon); 
    342296      } 
     
    344298      if (SuperClassWriter::hasVariable(lonName)) 
    345299      { 
    346         domain->lonvalue_curvilinear_read_from_file.resize(ni,nj); 
     300        domain->lonvalue_curvilinear_read_from_file.resize(domain->ni_glo,domain->nj_glo); 
    347301        readFieldVariableValue(domain->lonvalue_curvilinear_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 
    348302      } 
     
    366320 
    367321      std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 
    368       nBeginBndsLatLon[0] = domain->jbegin; nSizeBndsLatLon[0] = domain->nj.getValue(); 
    369       nBeginBndsLatLon[1] = domain->ibegin; nSizeBndsLatLon[1] = domain->ni.getValue(); 
     322      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue(); 
     323      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue(); 
    370324      nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 
    371 //      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue(); 
    372 //      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue(); 
    373 //      nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 
    374325 
    375326      if (SuperClassWriter::hasVariable(boundsLatName)) 
    376327      { 
    377         domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex,ni,nj); 
     328        domain->bounds_latvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni_glo,domain->nj_glo); 
    378329        readFieldVariableValue(domain->bounds_latvalue_curvilinear_read_from_file, boundsLatName, nBeginBndsLatLon, nSizeBndsLatLon); 
    379330 
     
    381332      if (SuperClassWriter::hasVariable(boundsLonName))  
    382333      { 
    383         domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex,ni,nj); 
     334        domain->bounds_lonvalue_curvilinear_read_from_file.resize(nbVertex,domain->ni_glo,domain->nj_glo); 
    384335        readFieldVariableValue(domain->bounds_lonvalue_curvilinear_read_from_file, boundsLonName, nBeginBndsLatLon, nSizeBndsLatLon); 
    385336      }       
     
    387338    else if ((CDomain::type_attr::unstructured == domain->type))// || (this->isUnstructured(fieldId))) 
    388339    { 
    389       if (domain->ni.isEmpty()) 
    390       { 
    391         ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
    392           << " Value of attribute ni should be defined for domain " << domain->getDomainOutputName() 
    393           << " in file " << this->filename << "." 
    394           << std::endl); 
    395       } 
    396  
    397       if (domain->ibegin.isEmpty()) 
    398       { 
    399         ERROR("void CNc4DataInput::readDomainAttributeValueFromFile(...)", 
    400           << " Value of attribute ibegin should be defined for domain " << domain->getDomainOutputName() 
    401           << " in file " << this->filename << "." 
    402           << std::endl); 
    403       } 
    404  
    405       int ni; 
    406340      std::vector<StdSize> nBeginLatLon(1,0), nSizeLatLon(1,0); 
    407  
    408       ni = domain->ni; 
    409       nBeginLatLon[0] = domain->ibegin; 
    410 //      ni = domain->ni_glo; 
    411 //      nBeginLatLon[0] = 0; 
    412       nSizeLatLon[0] = ni; 
     341      nSizeLatLon[0]  = domain->ni_glo.getValue(); 
     342      CArray<double,1> globalLonLat(domain->ni_glo.getValue()); 
    413343 
    414344      StdString latName = this->getLatCoordName(fieldId); 
    415345      if (SuperClassWriter::hasVariable(latName)) 
    416346      { 
    417         domain->latvalue_unstructured_read_from_file.resize(ni); 
     347        domain->latvalue_unstructured_read_from_file.resize(domain->ni_glo); 
    418348        readFieldVariableValue(domain->latvalue_unstructured_read_from_file, latName, nBeginLatLon, nSizeLatLon);   
    419349      } 
     
    422352      if (SuperClassWriter::hasVariable(lonName)) //(0 != lonName.compare("")) 
    423353      { 
    424         domain->lonvalue_unstructured_read_from_file.resize(ni); 
     354        // readFieldVariableValue(globalLonLat, lonName, nBeginLatLon, nSizeLatLon); 
     355        domain->lonvalue_unstructured_read_from_file.resize(domain->ni_glo); 
    425356        readFieldVariableValue(domain->lonvalue_unstructured_read_from_file, lonName, nBeginLatLon, nSizeLatLon); 
    426357      } 
     
    444375 
    445376      std::vector<StdSize> nBeginBndsLatLon(2), nSizeBndsLatLon(2); 
    446  
    447       nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni.getValue(); 
    448       nBeginBndsLatLon[1] = domain->ibegin.getValue(); nSizeBndsLatLon[1] = nbVertex; 
    449 //      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni_glo.getValue(); 
    450 //      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex; 
    451  
    452         if (SuperClassWriter::hasVariable(boundsLatName)) 
     377      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->ni_glo.getValue(); 
     378      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = nbVertex; 
     379 
     380      if (SuperClassWriter::hasVariable(boundsLatName))  
    453381      { 
    454382        domain->bounds_latvalue_unstructured_read_from_file.resize(nSizeBndsLatLon[1], nSizeBndsLatLon[0]); 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp

    r1410 r1413  
    256256 
    257257   /*! 
    258      Redistribute RECTILINEAR or CURVILINEAR domain with a number of local domains. 
     258     Redistribute RECTILINEAR domain with a number of local domains. 
    259259   All attributes ni,nj,ibegin,jbegin (if defined) will be rewritten 
    260260   The optional attributes lonvalue, latvalue will be added. Because this function only serves (for now) 
     
    531531   void CDomain::fillInCurvilinearLonLat() 
    532532   { 
    533  
    534533     if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty()) 
    535534     { 
     
    537536       for (int jdx = 0; jdx < nj; ++jdx) 
    538537        for (int idx = 0; idx < ni; ++idx) 
    539             lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx, jdx); 
    540 //            lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 
     538         lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 
    541539 
    542540       lonvalue_curvilinear_read_from_file.free(); 
     
    548546       for (int jdx = 0; jdx < nj; ++jdx) 
    549547        for (int idx = 0; idx < ni; ++idx) 
    550             latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx, jdx); 
    551 //            latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 
     548         latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 
    552549 
    553550       latvalue_curvilinear_read_from_file.free(); 
     
    560557        for (int idx = 0; idx < ni; ++idx) 
    561558          for (int ndx = 0; ndx < nvertex; ++ndx) 
    562               bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx, jdx); 
    563 //              bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 
     559         bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 
    564560 
    565561       bounds_lonvalue_curvilinear_read_from_file.free(); 
     
    572568        for (int idx = 0; idx < ni; ++idx) 
    573569          for (int ndx = 0; ndx < nvertex; ++ndx) 
    574               bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx, jdx); 
    575 //              bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 
     570            bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 
    576571 
    577572       bounds_latvalue_curvilinear_read_from_file.free(); 
     
    589584     { 
    590585       i_index.resize(ni); 
    591 //       for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; 
     586       for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; 
    592587     } 
    593588 
     
    596591        lonvalue_1d.resize(ni); 
    597592        for (int idx = 0; idx < ni; ++idx) 
    598 //          lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(i_index(idx)); 
    599           lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(idx); 
     593          lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(i_index(idx)); 
    600594 
    601595        // We dont need these values anymore, so just delete them 
     
    607601        latvalue_1d.resize(ni); 
    608602        for (int idx = 0; idx < ni; ++idx) 
    609 //          latvalue_1d(idx) =  latvalue_unstructured_read_from_file(i_index(idx)); 
    610           latvalue_1d(idx) =  latvalue_unstructured_read_from_file(idx); 
     603          latvalue_1d(idx) =  latvalue_unstructured_read_from_file(i_index(idx)); 
    611604 
    612605        // We dont need these values anymore, so just delete them 
     
    620613        for (int idx = 0; idx < ni; ++idx) 
    621614          for (int jdx = 0; jdx < nbVertex; ++jdx) 
    622 //            bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, i_index(idx)); 
    623             bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, idx); 
     615            bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, i_index(idx)); 
    624616 
    625617        // We dont need these values anymore, so just delete them 
     
    633625        for (int idx = 0; idx < ni; ++idx) 
    634626          for (int jdx = 0; jdx < nbVertex; ++jdx) 
    635 //            bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, i_index(idx)); 
    636             bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, idx); 
     627            bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, i_index(idx)); 
    637628 
    638629        // We dont need these values anymore, so just delete them 
Note: See TracChangeset for help on using the changeset viewer.