Changeset 899
- Timestamp:
- 07/12/16 18:13:01 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/domain.cpp
r895 r899 512 512 boundsLon.resize(nvertexValue,ni*nj); 513 513 514 double lonStepStart = lon(1)-lon(0); 515 bounds_lon_start=lon(0) - lonStepStart/2; 516 double lonStepEnd = lon(ni_glo-1)-lon(ni_glo-2); 517 bounds_lon_end=lon(ni_glo-1) + lonStepEnd/2; 518 double errorBoundsLon = std::abs(360-std::abs(bounds_lon_end-bounds_lon_start)); 519 520 // if errorBoundsLon is reasonably small (0.1 x cell size) consider it as closed in longitude 521 if (errorBoundsLon < std::abs(lonStepStart)*1e-1 || errorBoundsLon < std::abs(lonStepEnd)*1e-1 ) 522 { 523 bounds_lon_start= (lon(0) + lon(ni_glo-1)-360)/2 ; 524 bounds_lon_end= (lon(0) +360 + lon(ni_glo-1))/2 ; 525 } 526 514 if (ni_glo>1) 515 { 516 double lonStepStart = lon(1)-lon(0); 517 bounds_lon_start=lon(0) - lonStepStart/2; 518 double lonStepEnd = lon(ni_glo-1)-lon(ni_glo-2); 519 bounds_lon_end=lon(ni_glo-1) + lonStepEnd/2; 520 double errorBoundsLon = std::abs(360-std::abs(bounds_lon_end-bounds_lon_start)); 521 522 // if errorBoundsLon is reasonably small (0.1 x cell size) consider it as closed in longitude 523 if (errorBoundsLon < std::abs(lonStepStart)*1e-1 || errorBoundsLon < std::abs(lonStepEnd)*1e-1 ) 524 { 525 bounds_lon_start= (lon(0) + lon(ni_glo-1)-360)/2 ; 526 bounds_lon_end= (lon(0) +360 + lon(ni_glo-1))/2 ; 527 } 528 } 529 else 530 { 531 if (bounds_lon_start.isEmpty()) bounds_lon_start=-180. ; 532 if (bounds_lon_end.isEmpty()) bounds_lon_end=180.-1e-8 ; 533 } 534 527 535 for(j=0;j<nj;++j) 528 536 for(i=0;i<ni;++i) … … 544 552 // lat boundaries beyond pole the assimilate it to pole 545 553 // lat boundarie is relativelly close to pole (0.1 x cell size) assimilate it to pole 546 double latStepStart = lat(1)-lat(0); 547 if (isNorthPole) bounds_lat_start=lat(0); 554 if (nj_glo>1) 555 { 556 double latStepStart = lat(1)-lat(0); 557 if (isNorthPole) bounds_lat_start=lat(0); 558 else 559 { 560 bounds_lat_start=lat(0)-latStepStart/2; 561 if (bounds_lat_start >= 90 ) bounds_lat_start=90 ; 562 else if (bounds_lat_start <= -90 ) bounds_lat_start=-90 ; 563 else if (bounds_lat_start <= 90 && bounds_lat_start >= lat(0)) 564 { 565 if ( std::abs(90-bounds_lat_start) <= 0.1*std::abs(latStepStart)) bounds_lat_start=90 ; 566 } 567 else if (bounds_lat_start >= -90 && bounds_lat_start <= lat(0)) 568 { 569 if ( std::abs(-90 - bounds_lat_start) <= 0.1*std::abs(latStepStart)) bounds_lat_start=-90 ; 570 } 571 } 572 573 double latStepEnd = lat(nj_glo-1)-lat(nj_glo-2); 574 if (isSouthPole) bounds_lat_end=lat(nj_glo-1); 575 else 576 { 577 bounds_lat_end=lat(nj_glo-1)+latStepEnd/2; 578 579 if (bounds_lat_end >= 90 ) bounds_lat_end=90 ; 580 else if (bounds_lat_end <= -90 ) bounds_lat_end=-90 ; 581 else if (bounds_lat_end <= 90 && bounds_lat_end >= lat(nj_glo-1)) 582 { 583 if ( std::abs(90-bounds_lat_end) <= 0.1*std::abs(latStepEnd)) bounds_lat_end=90 ; 584 } 585 else if (bounds_lat_end >= -90 && bounds_lat_end <= lat(nj_glo-1)) 586 { 587 if ( std::abs(-90 - bounds_lat_end) <= 0.1*std::abs(latStepEnd)) bounds_lat_end=-90 ; 588 } 589 } 590 } 548 591 else 549 592 { 550 bounds_lat_start=lat(0)-latStepStart/2; 551 if (bounds_lat_start >= 90 ) bounds_lat_start=90 ; 552 else if (bounds_lat_start <= -90 ) bounds_lat_start=-90 ; 553 else if (bounds_lat_start <= 90 && bounds_lat_start >= lat(0)) 554 { 555 if ( std::abs(90-bounds_lat_start) <= 0.1*std::abs(latStepStart)) bounds_lat_start=90 ; 556 } 557 else if (bounds_lat_start >= -90 && bounds_lat_start <= lat(0)) 558 { 559 if ( std::abs(-90 - bounds_lat_start) <= 0.1*std::abs(latStepStart)) bounds_lat_start=-90 ; 560 } 561 } 562 563 double latStepEnd = lat(nj_glo-1)-lat(nj_glo-2); 564 if (isSouthPole) bounds_lat_end=lat(nj_glo-1); 565 else 566 { 567 bounds_lat_end=lat(nj_glo-1)+latStepEnd/2; 568 569 if (bounds_lat_end >= 90 ) bounds_lat_end=90 ; 570 else if (bounds_lat_end <= -90 ) bounds_lat_end=-90 ; 571 else if (bounds_lat_end <= 90 && bounds_lat_end >= lat(nj_glo-1)) 572 { 573 if ( std::abs(90-bounds_lat_end) <= 0.1*std::abs(latStepEnd)) bounds_lat_end=90 ; 574 } 575 else if (bounds_lat_end >= -90 && bounds_lat_end <= lat(nj_glo-1)) 576 { 577 if ( std::abs(-90 - bounds_lat_end) <= 0.1*std::abs(latStepEnd)) bounds_lat_end=-90 ; 578 } 593 if (bounds_lat_start.isEmpty()) bounds_lon_start=-90. ; 594 if (bounds_lat_end.isEmpty()) bounds_lat_end=90 ; 579 595 } 580 596
Note: See TracChangeset
for help on using the changeset viewer.