interpolation error near the ground ( procx,procy>1 and east/.../north_add_in>1 ) – in #10: INT2LM

in #10: INT2LM

<p> ok; (I think )I found the error. I would be grateful if somebody familiar with the source code could check it. Or should I contact the “Current Code Owner”? </p> <p> Inside the ‘src_decomposition.f90’ inside the ‘ <span class="caps"> SUBROUTINE </span> decompose_cm’, there are local variables ‘nzbounds_e, nzbounds_w, nzbounds_s, nzbounds_n’. Normally these have the value 2, and cause 2 additional pixels on each side of the respective coarse grid (which are needed later on during interpolation). </p> <p> But if ‘east/…/north_add_in’ are used these ‘nzbounds_?’ are set to zero and cause (during the end of the 3rd Section of the subroutine) a too small coarse “sub”-grid. </p> <p> I changed it so that the 2 additional pixels are still taken but afterwards a check is made, that caps the value to (1,ie_in_tot) and (1,je_in_tot) </p> !&lt; ZENTEK nzbounds_e = 2 nzbounds_w = 2 nzbounds_s = 2 nzbounds_n = 2 !ZENTEK&gt; ! looking for southern grid point DO j = 1, je_in_tot IF (latitudes_in(j) &gt;= zminlat) THEN jzstart_in = j-nzbounds_s-1 EXIT ENDIF ENDDO ! looking for northern grid point DO j = 1, je_in_tot IF (latitudes_in(j) &gt; zmaxlat) THEN jzend_in = j+nzbounds_n EXIT ENDIF ENDDO ! looking for western grid point DO i = 1, ie_in_tot IF (longitudes_in(i) &gt;= zminlon) THEN izstart_in = i-nzbounds_e-1 EXIT ENDIF ENDDO ! looking for eastern grid point DO i = 1, ie_in_tot IF (longitudes_in(i) &gt; zmaxlon) THEN izend_in = i+nzbounds_w EXIT ENDIF ENDDO !&lt; ZENTEK IF (jzstart_in &lt; 1) THEN jzstart_in = 1 ENDIF IF (jzend_in &gt; ie_in_tot ) THEN jzend_in = ie_in_tot ENDIF IF (izstart_in &lt; 1) THEN izstart_in = 1 ENDIF IF (izend_in &gt; ie_in_tot) THEN izend_in = ie_in_tot ENDIF !ZENTEK&gt; <p> All in all I think these 4+3*4 lines should solve the problem. </p> <p> Leaving only the small error directly over the south pole, which can be ‘workarounded’(*) by the 3 lines of code from my last post. </p>

  @rolfzentek in #14467c7

<p> ok; (I think )I found the error. I would be grateful if somebody familiar with the source code could check it. Or should I contact the “Current Code Owner”? </p> <p> Inside the ‘src_decomposition.f90’ inside the ‘ <span class="caps"> SUBROUTINE </span> decompose_cm’, there are local variables ‘nzbounds_e, nzbounds_w, nzbounds_s, nzbounds_n’. Normally these have the value 2, and cause 2 additional pixels on each side of the respective coarse grid (which are needed later on during interpolation). </p> <p> But if ‘east/…/north_add_in’ are used these ‘nzbounds_?’ are set to zero and cause (during the end of the 3rd Section of the subroutine) a too small coarse “sub”-grid. </p> <p> I changed it so that the 2 additional pixels are still taken but afterwards a check is made, that caps the value to (1,ie_in_tot) and (1,je_in_tot) </p> !&lt; ZENTEK nzbounds_e = 2 nzbounds_w = 2 nzbounds_s = 2 nzbounds_n = 2 !ZENTEK&gt; ! looking for southern grid point DO j = 1, je_in_tot IF (latitudes_in(j) &gt;= zminlat) THEN jzstart_in = j-nzbounds_s-1 EXIT ENDIF ENDDO ! looking for northern grid point DO j = 1, je_in_tot IF (latitudes_in(j) &gt; zmaxlat) THEN jzend_in = j+nzbounds_n EXIT ENDIF ENDDO ! looking for western grid point DO i = 1, ie_in_tot IF (longitudes_in(i) &gt;= zminlon) THEN izstart_in = i-nzbounds_e-1 EXIT ENDIF ENDDO ! looking for eastern grid point DO i = 1, ie_in_tot IF (longitudes_in(i) &gt; zmaxlon) THEN izend_in = i+nzbounds_w EXIT ENDIF ENDDO !&lt; ZENTEK IF (jzstart_in &lt; 1) THEN jzstart_in = 1 ENDIF IF (jzend_in &gt; ie_in_tot ) THEN jzend_in = ie_in_tot ENDIF IF (izstart_in &lt; 1) THEN izstart_in = 1 ENDIF IF (izend_in &gt; ie_in_tot) THEN izend_in = ie_in_tot ENDIF !ZENTEK&gt; <p> All in all I think these 4+3*4 lines should solve the problem. </p> <p> Leaving only the small error directly over the south pole, which can be ‘workarounded’(*) by the 3 lines of code from my last post. </p>

ok; (I think )I found the error. I would be grateful if somebody familiar with the source code could check it. Or should I contact the “Current Code Owner”?

Inside the ‘src_decomposition.f90’ inside the ‘ SUBROUTINE decompose_cm’, there are local variables ‘nzbounds_e, nzbounds_w, nzbounds_s, nzbounds_n’. Normally these have the value 2, and cause 2 additional pixels on each side of the respective coarse grid (which are needed later on during interpolation).

But if ‘east/…/north_add_in’ are used these ‘nzbounds_?’ are set to zero and cause (during the end of the 3rd Section of the subroutine) a too small coarse “sub”-grid.

I changed it so that the 2 additional pixels are still taken but afterwards a check is made, that caps the value to (1,ie_in_tot) and (1,je_in_tot)

!< ZENTEK nzbounds_e = 2 nzbounds_w = 2 nzbounds_s = 2 nzbounds_n = 2 !ZENTEK> ! looking for southern grid point DO j = 1, je_in_tot IF (latitudes_in(j) >= zminlat) THEN jzstart_in = j-nzbounds_s-1 EXIT ENDIF ENDDO ! looking for northern grid point DO j = 1, je_in_tot IF (latitudes_in(j) > zmaxlat) THEN jzend_in = j+nzbounds_n EXIT ENDIF ENDDO ! looking for western grid point DO i = 1, ie_in_tot IF (longitudes_in(i) >= zminlon) THEN izstart_in = i-nzbounds_e-1 EXIT ENDIF ENDDO ! looking for eastern grid point DO i = 1, ie_in_tot IF (longitudes_in(i) > zmaxlon) THEN izend_in = i+nzbounds_w EXIT ENDIF ENDDO !< ZENTEK IF (jzstart_in < 1) THEN jzstart_in = 1 ENDIF IF (jzend_in > ie_in_tot ) THEN jzend_in = ie_in_tot ENDIF IF (izstart_in < 1) THEN izstart_in = 1 ENDIF IF (izend_in > ie_in_tot) THEN izend_in = ie_in_tot ENDIF !ZENTEK>

All in all I think these 4+3*4 lines should solve the problem.

Leaving only the small error directly over the south pole, which can be ‘workarounded’(*) by the 3 lines of code from my last post.