Changeset 1937


Ignore:
Timestamp:
09/22/20 11:49:32 (12 months ago)
Author:
ymipsl
Message:

Fix problem when using area for domain interpolation.

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp

    r1856 r1937  
    128128  CArray<double,2> boundsLonSrc(nVertexSrc,localDomainSrcSize); 
    129129  CArray<double,2> boundsLatSrc(nVertexSrc,localDomainSrcSize); 
     130  CArray<double,1> areaSrc; 
    130131 
    131132  if (domainSrc_->hasPole) srcPole[2] = 1; 
     
    178179    domainSrc_->fillInRectilinearBoundLonLat(lon_g,lat_g, boundsLonSrc, boundsLatSrc); 
    179180  } 
    180  
     181   
     182  if (domainSrc_->hasArea)  
     183  { 
     184    areaSrc.resize(niSrc*njSrc); 
     185    for (int j = 0; j < njSrc; ++j) 
     186      for (int i = 0; i < niSrc; ++i) 
     187      { 
     188        int k = j * niSrc + i; 
     189        areaSrc(k) = domainSrc_->area(i,j); 
     190      } 
     191  } 
     192   
    181193  std::map<int,std::vector<std::pair<int,double> > > interpMapValueNorthPole; 
    182194  std::map<int,std::vector<std::pair<int,double> > > interpMapValueSouthPole; 
     
    188200  CArray<double,2> boundsLonDest(nVertexDest,localDomainDestSize); 
    189201  CArray<double,2> boundsLatDest(nVertexDest,localDomainDestSize); 
     202  CArray<double,1> areaDest; 
    190203 
    191204  if (domainDest_->hasPole) dstPole[2] = 1; 
     
    269282    domainDest_->fillInRectilinearBoundLonLat(lon_g,lat_g, boundsLonDest, boundsLatDest); 
    270283  } 
    271  
     284  
     285  if (domainDest_->hasArea)  
     286  { 
     287    areaDest.resize(niDest*njDest); 
     288    for (int j = 0; j < njDest; ++j) 
     289      for (int i = 0; i < niDest; ++i) 
     290      { 
     291        int k = j * niDest + i; 
     292        areaDest(k) = domainDest_->area(i,j); 
     293      } 
     294  } 
     295  
    272296 
    273297 
     
    329353        boundsLatSrcUnmasked(n,nSrcLocalUnmasked) = boundsLatSrc(n,idx) ; 
    330354      } 
    331       if (hasSrcArea) areaSrcUnmasked(nSrcLocalUnmasked) = domainSrc_->areavalue(idx)*srcAreaFactor ; 
     355      if (hasSrcArea) areaSrcUnmasked(nSrcLocalUnmasked) = areaSrc(idx)*srcAreaFactor ; 
    332356      globalSrcUnmasked[nSrcLocalUnmasked]=globalSrc[idx] ; 
    333357      ++nSrcLocalUnmasked ; 
     
    358382        boundsLatDestUnmasked(n,nDstLocalUnmasked) = boundsLatDest(n,idx) ; 
    359383      } 
    360       if (hasDstArea) areaDstUnmasked(nDstLocalUnmasked) = domainDest_->areavalue(idx)*dstAreaFactor ; 
     384      if (hasDstArea) areaDstUnmasked(nDstLocalUnmasked) = areaDest(idx)*dstAreaFactor ; 
    361385      globalDstUnmasked[nDstLocalUnmasked]=globalDst[idx] ; 
    362386      ++nDstLocalUnmasked ; 
Note: See TracChangeset for help on using the changeset viewer.