Ignore:
Timestamp:
10/02/18 11:05:38 (5 years ago)
Author:
oabramkina
Message:

Bugfix on domain zoom for curvilinear domains with 1D lon/lat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_zoom.cpp

    r1553 r1583  
    6363  // Calculate the size of local domain 
    6464  int ind, indLocSrc, indLocDest, iIdxSrc, jIdxSrc, destIBegin = -1, destJBegin = -1, niDest = 0, njDest = 0, ibeginDest, jbeginDest ; 
    65   int indGloDest, indGloSrc, niGloSrc = domainSrc_->ni_glo, iSrc, jSrc; 
     65  int indGloDest, indGloSrc, niGloSrc = domainSrc_->ni_glo, iSrc, jSrc, nvertex = 0; 
    6666  for (int j = 0; j < domainSrc_->nj.getValue(); j++) 
    6767  { 
     
    119119      domainDest_->latvalue_1d.resize(niDest); 
    120120    } 
     121    else if (domainDest_->type == CDomain::type_attr::curvilinear) 
     122    { 
     123      domainDest_->lonvalue_1d.resize(niDest*njDest); 
     124      domainDest_->latvalue_1d.resize(niDest*njDest); 
     125    } 
    121126  } 
    122127  else if (!domainSrc_->lonvalue_2d.isEmpty()) 
     
    128133  if (domainSrc_->hasBounds) 
    129134  { 
    130     if (!domainSrc_->bounds_lon_2d.isEmpty()) 
    131     { 
    132       domainDest_->bounds_lon_2d.resize(domainDest_->nvertex, niDest, njDest); 
    133       domainDest_->bounds_lon_2d.resize(domainDest_->nvertex, niDest, njDest); 
    134     } 
    135     else if (!domainSrc_->bounds_lon_1d.isEmpty()) 
    136     { 
    137       domainDest_->bounds_lon_1d.resize(domainDest_->nvertex, niDest); 
    138       domainDest_->bounds_lon_1d.resize(domainDest_->nvertex, niDest); 
     135    nvertex = domainSrc_->nvertex; 
     136    domainDest_->nvertex.setValue(nvertex); 
     137    if (!domainSrc_->bounds_lon_1d.isEmpty()) 
     138    { 
     139      if (domainDest_->type == CDomain::type_attr::rectilinear) 
     140      { 
     141        domainDest_->bounds_lon_1d.resize(nvertex, niDest); 
     142        domainDest_->bounds_lat_1d.resize(nvertex, njDest); 
     143      } 
     144      else if (domainDest_->type == CDomain::type_attr::unstructured) 
     145      { 
     146        domainDest_->bounds_lon_1d.resize(nvertex, niDest); 
     147        domainDest_->bounds_lat_1d.resize(nvertex, niDest); 
     148      } 
     149      else if (domainDest_->type == CDomain::type_attr::curvilinear) 
     150      { 
     151        domainDest_->bounds_lon_1d.resize(nvertex, niDest*njDest); 
     152        domainDest_->bounds_lat_1d.resize(nvertex, niDest*njDest); 
     153      } 
     154    } 
     155    else if (!domainSrc_->bounds_lon_2d.isEmpty()) 
     156    { 
     157      domainDest_->bounds_lon_2d.resize(nvertex, niDest, njDest); 
     158      domainDest_->bounds_lat_2d.resize(nvertex, niDest, njDest); 
    139159    } 
    140160  } 
     
    168188        domainDest_->area(iDest,jDest) = domainSrc_->area(iSrc,jSrc); 
    169189 
     190      if (domainSrc_->hasLonLat) 
     191      { 
     192        if (!domainSrc_->latvalue_1d.isEmpty()) 
     193        { 
     194          if (domainDest_->type == CDomain::type_attr::rectilinear) 
     195          { 
     196            domainDest_->latvalue_1d(jDest) = domainSrc_->latvalue_1d(jSrc); 
     197          } 
     198          else 
     199          { 
     200            domainDest_->lonvalue_1d(indLocDest) = domainSrc_->lonvalue_1d(ind); 
     201            domainDest_->latvalue_1d(indLocDest) = domainSrc_->latvalue_1d(ind); 
     202          } 
     203        } 
     204        else if (!domainSrc_->latvalue_2d.isEmpty()) 
     205        { 
     206          domainDest_->lonvalue_2d(iDest,jDest) = domainSrc_->lonvalue_2d(iSrc,jSrc); 
     207          domainDest_->latvalue_2d(iDest,jDest) = domainSrc_->latvalue_2d(iSrc,jSrc); 
     208        } 
     209      } 
     210 
    170211      if (domainSrc_->hasBounds) 
    171212      { 
    172         if (!domainSrc_->bounds_lon_2d.isEmpty()) 
    173         { 
    174           for (int n = 0; n < domainSrc_->nvertex; ++n) 
     213        if (!domainSrc_->bounds_lon_1d.isEmpty()) 
     214        { 
     215          if (domainDest_->type == CDomain::type_attr::rectilinear) 
     216          { 
     217            for (int n = 0; n < nvertex; ++n) 
     218              domainDest_->bounds_lat_1d(n,jDest) = domainSrc_->bounds_lat_1d(n,jSrc); 
     219          } 
     220          else 
     221          { 
     222            for (int n = 0; n < nvertex; ++n) 
     223            { 
     224              domainDest_->bounds_lon_1d(n,indLocDest) = domainSrc_->bounds_lon_1d(n,ind); 
     225              domainDest_->bounds_lat_1d(n,indLocDest) = domainSrc_->bounds_lat_1d(n,ind); 
     226            } 
     227          } 
     228        } 
     229        else if (!domainSrc_->bounds_lon_2d.isEmpty()) 
     230        { 
     231          for (int n = 0; n < nvertex; ++n) 
    175232          { 
    176233            domainDest_->bounds_lon_2d(n,iDest,jDest) = domainSrc_->bounds_lon_2d(n,iSrc,jSrc); 
     
    178235          } 
    179236        } 
    180         else if (!domainSrc_->bounds_lon_1d.isEmpty()) 
    181         { 
    182           for (int n = 0; n < domainSrc_->nvertex; ++n) 
    183           { 
    184             domainDest_->bounds_lon_1d(n,iDest) = domainSrc_->bounds_lon_1d(n,iSrc); 
    185             domainDest_->bounds_lat_1d(n,iDest) = domainSrc_->bounds_lat_1d(n,iSrc); 
    186           } 
    187         } 
    188       } 
    189  
    190       if (domainSrc_->hasLonLat) 
    191       { 
    192         if (domainDest_->type == CDomain::type_attr::rectilinear) 
    193         { 
    194           domainDest_->latvalue_1d(jDest) = domainSrc_->latvalue_1d(jSrc); 
    195         } 
    196         else if (domainDest_->type == CDomain::type_attr::curvilinear) 
    197         { 
    198           domainDest_->lonvalue_2d(iDest,jDest) = domainSrc_->lonvalue_2d(iSrc,jSrc); 
    199           domainDest_->latvalue_2d(iDest,jDest) = domainSrc_->latvalue_2d(iSrc,jSrc); 
    200         } 
     237 
    201238      } 
    202239 
    203240      transMap[indGloDest].push_back(indGloSrc); 
    204241      transWeight[indGloDest].push_back(1.0); 
    205  
    206     } 
    207     if (domainSrc_->hasLonLat) 
    208     { 
    209       if (domainDest_->type == CDomain::type_attr::unstructured) 
     242    } 
     243 
     244    if (domainSrc_->hasLonLat && !domainSrc_->latvalue_1d.isEmpty()) 
     245    { 
     246      if (domainDest_->type == CDomain::type_attr::rectilinear) 
    210247      { 
    211248        domainDest_->lonvalue_1d(iDest) = domainSrc_->lonvalue_1d(iSrc); 
    212         domainDest_->latvalue_1d(iDest) = domainSrc_->latvalue_1d(iSrc); 
    213       } 
    214       else if (domainDest_->type == CDomain::type_attr::rectilinear) 
    215       { 
    216         domainDest_->lonvalue_1d(iDest) = domainSrc_->lonvalue_1d(iSrc); 
     249      } 
     250    } 
     251 
     252    if (domainSrc_->hasBounds && !domainSrc_->bounds_lon_1d.isEmpty()) 
     253    { 
     254      if (domainDest_->type == CDomain::type_attr::rectilinear) 
     255      { 
     256        for (int n = 0; n < nvertex; ++n) 
     257          domainDest_->bounds_lon_1d(n,iDest) = domainSrc_->bounds_lon_1d(n,iSrc); 
    217258      } 
    218259    } 
Note: See TracChangeset for help on using the changeset viewer.