Skip to content

Commit 36c7a66

Browse files
Fix bad xgrid along zero longitude when LND grid not same as ATM (#379)
- Address issue #366 - When LND grid is not the same as ATM the xgrid is wrong along the Prime Meridian, E.g., if ATM is c96 and LND is c48, the xgrid cell areas are small by almost a factor of 2 along longitude=0 and the land mask has a spurious line along longitude=0 - The root cause is the Ocean grid is shifted right by 360 degree assuming that the land and atmos grids are the same which cause the atmXlnd exchange grid cells that are just to the left of the longitude=0 to be ignored. - The fix is to (re)apply the fixlon to shift Ocean grid based on the atmxlnd_x[l][0] rather than the atm_avg.
1 parent 5aae555 commit 36c7a66

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/make-coupler-mosaic/make_coupler_mosaic.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,15 @@ int main (int argc, char *argv[])
16621662
if(lnd_frac > MIN_AREA_FRAC) { /* over land */
16631663
/* find the overlap of atmxlnd and ocean cell */
16641664
for(l=0; l<count; l++) {
1665-
if( clip_method == GREAT_CIRCLE_CLIP )
1665+
/*Apply a longitude fix to ocean cell xo based on the center of the atmxlnd cell
1666+
Otherwise, when lnd and atm grids are not the same some exchange grids may be missed, particularly around the Prime Meridian lon=0
1667+
*/
1668+
if(!lnd_same_as_atm){
1669+
no_in = fix_lon (xo, yo, 4, atmxlnd_x[l][0]); //Shifts xo so the center to be within atmxlnd_x[l][0]-pi to atmxlnd_x[l][0]+pi,
1670+
xo_min = minval_double (no_in, xo);
1671+
xo_max = maxval_double (no_in, xo);
1672+
}
1673+
if( clip_method == GREAT_CIRCLE_CLIP )
16661674
n_out = clip_2dx2d_great_circle(atmxlnd_x[l], atmxlnd_y[l], atmxlnd_z[l], num_v[l], xo, yo, zo, 4,
16671675
x_out, y_out, z_out);
16681676
else {

0 commit comments

Comments
 (0)