Changeset 808 for XIOS


Ignore:
Timestamp:
12/13/15 15:43:41 (8 years ago)
Author:
ymipsl
Message:

Fix problem using rectilinear grid from file, or self-generated

  • Defining boundaries at poles was incorrect

YM

Location:
XIOS/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/domain.cpp

    r795 r808  
    501501     { 
    502502       double latStepStart = latvalue_rectilinear_read_from_file(1)-latvalue_rectilinear_read_from_file(0); 
    503        bounds_lat_start.setValue(latvalue_rectilinear_read_from_file(0) - latStepStart/2); 
     503       if (isNorthPole) bounds_lat_start.setValue(latvalue_rectilinear_read_from_file(0) ); 
     504       else bounds_lat_start.setValue(latvalue_rectilinear_read_from_file(0)-latStepStart/2 ); 
     505 
     506 
    504507       double latStepEnd = (latvalue_rectilinear_read_from_file(nj_glo-1)-latvalue_rectilinear_read_from_file(nj_glo-2)); 
    505        bounds_lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1) + latStepEnd/2); 
    506        double bounds_lat_start_pole = bounds_lat_start; 
    507        double bounds_lat_end_pole   = bounds_lat_end; 
    508        if (isNorthPole) bounds_lat_start_pole = lat_start; 
    509        if (isSouthPole) bounds_lat_end_pole   = lat_end; 
    510  
     508       if (isSouthPole) bounds_lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1)); 
     509       else bounds_lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1)+latStepEnd/2); 
     510        
     511       if (bounds_lat_start > 90.-1e-3) bounds_lat_start=90 ; 
     512       if (bounds_lat_start < -90.+1e-3) bounds_lat_start=-90 ; 
     513       if (bounds_lat_end > 90.-1e-3) bounds_lat_end=90 ; 
     514       if (bounds_lat_end < -90.+1e-3) bounds_lat_end=-90 ; 
     515       
    511516       for(j=0;j<nj;++j) 
    512517         for(i=0;i<ni;++i) 
    513518         { 
    514519           k=j*ni+i; 
    515            boundsLat(1,k) = boundsLat(2,k) = (0 == (jbegin + j)) ? bounds_lat_start_pole 
     520           boundsLat(1,k) = boundsLat(2,k) = (0 == (jbegin + j)) ? bounds_lat_start 
    516521                                                                 : (latvalue_rectilinear_read_from_file(jbegin + j)+latvalue_rectilinear_read_from_file(jbegin + j-1))/2; 
    517            boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) == nj_glo) ? bounds_lat_end_pole 
     522           boundsLat(0,k) = boundsLat(3,k) = ((jbegin + j +1) == nj_glo) ? bounds_lat_end 
    518523                                                                 : (latvalue_rectilinear_read_from_file(jbegin + j + 1)+latvalue_rectilinear_read_from_file(jbegin + j))/2; 
    519524         } 
  • XIOS/trunk/src/transformation/domain_algorithm_interpolate.cpp

    r775 r808  
    7878    bool isNorthPole = false; 
    7979    bool isSouthPole = false; 
    80     if (std::abs(poleValue - std::abs(domainSrc_->lat_start)) < NumTraits<double>::epsilon()) isNorthPole = true; 
    81     if (std::abs(poleValue - std::abs(domainSrc_->lat_end)) < NumTraits<double>::epsilon()) isSouthPole = true; 
     80 
     81    if (domainSrc_->latvalue_rectilinear_read_from_file.isEmpty()) 
     82    { 
     83      if (std::abs(poleValue - std::abs(domainSrc_->lat_start)) < NumTraits<double>::epsilon()) isNorthPole = true; 
     84      if (std::abs(poleValue - std::abs(domainSrc_->lat_end)) < NumTraits<double>::epsilon()) isSouthPole = true; 
     85    } 
     86    else 
     87    { 
     88      if (std::abs(poleValue - std::abs(domainSrc_->latvalue_rectilinear_read_from_file(0))) < NumTraits<double>::epsilon()) isNorthPole = true; 
     89      if (std::abs(poleValue - std::abs(domainSrc_->latvalue_rectilinear_read_from_file(domainSrc_->nj_glo-1))) < NumTraits<double>::epsilon()) isSouthPole = true; 
     90    } 
    8291 
    8392    nVertexSrc = constNVertex; 
Note: See TracChangeset for help on using the changeset viewer.