Skip to content

Commit 8d8c84c

Browse files
committed
Add bug fix for latlon projection
This bug fix is from Michel Bechtold and Samuel Scherrer. See PR NASA-LIS#1415.
1 parent d927928 commit 8d8c84c

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lis/interp/map_utils.F90

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ module map_utils
145145
! Brent L. Shaw, NOAA/FSL (CSU/CIRA)
146146
! 09 Apr 2001 - Added compare\_projections routine to compare two
147147
! sets of projection parameters.
148+
! 30 Jun 2021 - Michel Bechtold, Samuel Scherrer, bug fix for latlon projection
149+
! occurred at edges of subdomains in parallel mode
148150

149151
implicit none
150152

@@ -681,6 +683,7 @@ SUBROUTINE llij_gauss(lat, lon, proj, i, j)
681683
slon360 = proj%lon1
682684
ENDIF
683685
deltalon = lon360 - slon360
686+
IF (deltalon .LT. 0) deltalon = deltalon + 360.
684687

685688
! Compute i/j
686689
i = deltalon/proj%dlon + 1.
@@ -1131,7 +1134,7 @@ SUBROUTINE llij_latlon(lat, lon, proj, i, j)
11311134

11321135
REAL :: deltalat
11331136
REAL :: deltalon
1134-
REAL :: lon360
1137+
REAL :: lon360,slon360
11351138

11361139

11371140
! Compute deltalat and deltalon as the difference between the input
@@ -1146,10 +1149,18 @@ SUBROUTINE llij_latlon(lat, lon, proj, i, j)
11461149
ELSE
11471150
lon360 = lon
11481151
ENDIF
1149-
deltalon = lon360 - proj%lon1
1150-
! IF (deltalon .LT. 0) deltalon = deltalon + 360.
1151-
IF (deltalon .LT. -0.001) deltalon = deltalon + 360.
1152-
IF (deltalon .LT. 0) deltalon = Abs(deltalon)
1152+
! deltalon = lon360 - proj%lon1
1153+
! IF (deltalon .LT. 0) deltalon = deltalon + 360.
1154+
! MB: June,2021: deltalon+360 causes
1155+
! bug at edges of subdomains in parallel mode.
1156+
! Correct handling is like done in llij_gauss
1157+
IF (proj%lon1 .LT. 0) THEN
1158+
slon360 = proj%lon1 + 360.
1159+
ELSE
1160+
slon360 = proj%lon1
1161+
ENDIF
1162+
deltalon = lon360 - slon360
1163+
IF (deltalon .LT. 0) deltalon = deltalon + 360.
11531164

11541165
! Compute i/j
11551166
i = deltalon/proj%dlon + 1.

0 commit comments

Comments
 (0)