-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from AlexanderRichert-NOAA/add_testing_Oct2023
Extend testing (splat, sptrung, sptrungv, sppad, splaplac)
- Loading branch information
Showing
15 changed files
with
245 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sptrungv* files were generated from ip's './test_vector_grib1_4 "205" "4"' test case and modifying spectral_interp_mod.F90 to write out UI, VI, RLAT, and RLON immediately before the SPTRUNGV call, and UO and VO immediately after. | ||
|
||
sptrung* files were generated from ip's 'test_scalar_grib2_4 "-1" "4"' test case and modifying spectral_interp_mod.F90 to write out GI. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
! This is a test from the NCEPLIBS-sp project. | ||
! | ||
! This test tests the splaplac() subrroutine. | ||
! | ||
! Alex Richert, Oct 2023 | ||
PROGRAM TEST_SPLAPLAC | ||
IMPLICIT NONE | ||
|
||
INTEGER I, M, J, QSIZE, QD2SIZE | ||
REAL, ALLOCATABLE :: ENN1(:), Q(:), QD2(:), QREF(:), REF(:), QD2REF(:) | ||
REAL :: TOL=1E-7 | ||
|
||
M=2 | ||
|
||
DO I=0,1 | ||
QSIZE=(M+1)*((I+1)*M+2) | ||
QD2SIZE=(M+1)*((I+1)*M+2) | ||
ALLOCATE(QD2REF(QD2SIZE)) | ||
IF (I.EQ.0) THEN | ||
QD2REF=(/0.0,0.0,-0.25,-0.333,-0.417,-0.5,-0.583,-0.667, & | ||
-0.75,-0.833,-0.917,-1.0/) | ||
ELSEIF (I.EQ.1) THEN | ||
QD2REF=(/0.0,0.0,-0.167,-0.222,-0.278,-0.333,-0.389,-0.444, & | ||
-0.5,-0.556,-0.611,-0.667,-0.722,-0.778,-0.833,-0.889,-0.944,-1.0/) | ||
ENDIF | ||
ALLOCATE(ENN1((M+1)*((I+1)*M+2)/2)) | ||
ENN1=1.0 | ||
ALLOCATE(Q(QSIZE)) | ||
ALLOCATE(QREF(QSIZE)) | ||
ALLOCATE(QD2(QD2SIZE)) | ||
DO J=1,QSIZE | ||
Q(J) = REAL(J)/REAL(QSIZE) | ||
ENDDO | ||
QREF=Q | ||
CALL SPLAPLAC(I,M,ENN1,Q,QD2,1) | ||
IF (.NOT.ALL(ABS(QD2-QD2REF).LT.1E-2)) STOP 1 | ||
Q=-999.9 | ||
CALL SPLAPLAC(I,M,ENN1,Q,QD2,-1) | ||
IF (.NOT.ALL(ABS(Q(3:)-QREF(3:)).LT.TOL)) STOP 2 | ||
DEALLOCATE(QD2REF) | ||
DEALLOCATE(ENN1) | ||
DEALLOCATE(Q) | ||
DEALLOCATE(QREF) | ||
DEALLOCATE(QD2) | ||
ENDDO !DO I | ||
|
||
END PROGRAM TEST_SPLAPLAC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
! This is a test from the NCEPLIBS-sp project. | ||
! | ||
! This test tests the sppad() subrroutine. | ||
! | ||
! Alex Richert, Oct 2023 | ||
PROGRAM TEST_SPPAD | ||
IMPLICIT NONE | ||
|
||
INTEGER WHICH, I, IMAX1, IMAX2 | ||
INTEGER, DIMENSION(6) :: I1=(/0,1,0,0,1,1/), I2=(/0,1,0,1,0,1/) | ||
INTEGER, DIMENSION(6) :: M1=(/384,384,1,1,1,1/), M2=(/384,384,2,2,2,2/) | ||
REAL, ALLOCATABLE :: Q1(:), Q2(:) | ||
REAL :: TINI=TINY(1.0) | ||
REAL, DIMENSION(18) :: W4REF, W6REF | ||
|
||
W4REF=(/1.0/6.0,1.0/3.0,0.5,2.0/3.0,0.0,0.0, & | ||
5.0/6.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0/) | ||
W6REF=(/0.1250,0.25,0.375,0.5,0.0,0.0,0.625,0.75,0.875,1.0, & | ||
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0/) | ||
|
||
DO WHICH=1,6 | ||
IMAX1=(M1(WHICH)+1)*((I1(WHICH)+1)*M1(WHICH)+2) | ||
IMAX2=(M2(WHICH)+1)*((I2(WHICH)+1)*M2(WHICH)+2) | ||
IF ((WHICH.LE.2) .AND. (IMAX1.NE.IMAX2)) STOP 1 | ||
ALLOCATE(Q1(1:IMAX1)) | ||
ALLOCATE(Q2(1:IMAX2)) | ||
! Make all test values positive to distinguish from padding zeros | ||
DO I=1,IMAX1 | ||
Q1(I)=REAL(I)/REAL(IMAX1) | ||
ENDDO | ||
CALL SPPAD(I1(WHICH),M1(WHICH),Q1,I2(WHICH),M2(WHICH),Q2) | ||
! When I1==I2, the arrays should be unchanged | ||
IF ((WHICH.EQ.1).AND.(.NOT.ALL(ABS(Q1-Q2).LT.TINI))) STOP 2 | ||
IF ((WHICH.EQ.2).AND.(.NOT.ALL(ABS(Q1-Q2).LT.TINI))) STOP 3 | ||
! Non-pad values (i.e., non-zeros) should be unchanged | ||
IF (.NOT. ALL(ABS(Q1-PACK(Q2,Q2>TINI)).LT.TINI)) STOP 4 | ||
IF (WHICH.EQ.4) THEN | ||
IF (.NOT.ALL(ABS(Q2-W4REF).LT.TINI)) STOP 5 | ||
ENDIF | ||
IF (WHICH.EQ.6) THEN | ||
IF (.NOT.ALL(ABS(Q2-W6REF).LT.TINI)) STOP 6 | ||
ENDIF | ||
DEALLOCATE(Q1) | ||
DEALLOCATE(Q2) | ||
ENDDO ! WHICH=1,6 | ||
|
||
END PROGRAM TEST_SPPAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
! This is a test from the NCEPLIBS-sp project. | ||
! | ||
! This test tests the sptrung() subrroutine. | ||
! | ||
! Alex Richert, Oct 2023 | ||
program test_sptrung | ||
implicit none | ||
|
||
INTEGER :: I | ||
INTEGER :: IROMB=0, MAXWV=89 | ||
INTEGER :: IDRTI=256, IMAXI=360, JMAXI=180 | ||
INTEGER,parameter :: KM=1 | ||
INTEGER :: NO=4, IPRIME=181, ISKIPI=1, JSKIPI=360 | ||
INTEGER,parameter :: MI=64800, MO=4 | ||
REAL :: RLAT(MO),RLON(MO) | ||
REAL :: GI(MI,KM) | ||
REAL :: GO(MO,KM) | ||
REAL :: GOREF(MO,KM) | ||
REAL*4 :: RDGI(MI,KM) | ||
REAL :: X=0.0 | ||
REAL :: TINI=4e-3 | ||
|
||
|
||
OPEN (12, file="data/sptrung.gi.in", form='unformatted', recl=MI*KM*4, convert='little_endian') | ||
READ (12) RDGI | ||
CLOSE (12) | ||
|
||
GI = REAL(RDGI) | ||
|
||
GOREF(:,1) = (/77.3174667,70.4562683,72.8935242,51.0591698/) | ||
RLAT = (/45.0,35.0,40.0,35.0/) | ||
RLON = (/-100.0,-100.0,-90.0,-120.0/) | ||
|
||
CALL SPTRUNG(IROMB,MAXWV,IDRTI,IMAXI,JMAXI,KM,NO, & | ||
IPRIME,ISKIPI,JSKIPI,MI,MO,0,0,0,RLAT,RLON, & | ||
GI,GO) | ||
|
||
DO I=1,MO | ||
IF (ABS(GO(I,KM)-GOREF(I,KM)) .GT. TINI) STOP 1 | ||
ENDDO | ||
|
||
end program test_sptrung |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
! This is a test from the NCEPLIBS-sp project. | ||
! | ||
! This test tests the sptrungv() subrroutine. | ||
! | ||
! Alex Richert, Oct 2023 | ||
program test_sptrungv | ||
implicit none | ||
|
||
! | ||
! | ||
INTEGER :: I | ||
INTEGER :: IROMB=0, MAXWV=89 | ||
INTEGER :: IDRTI=0, IMAXI=360, JMAXI=181 | ||
INTEGER,parameter :: KM=1 | ||
INTEGER :: NO=26553, IPRIME=1, ISKIPI=1, JSKIPI=-360 | ||
INTEGER,parameter :: MI=65160, MO=26553 | ||
REAL :: RLAT(MO),RLON(MO) | ||
REAL :: UI(MI,KM),VI(MI,KM) | ||
REAL :: UO(MO,KM),VO(MO,KM) | ||
REAL :: UOREF(MO,KM),VOREF(MO,KM) | ||
REAL*4 :: RDRLAT(MO),RDRLON(MO) | ||
REAL*4 :: RDUI(MI,KM),RDVI(MI,KM) | ||
REAL*4 :: RDUOREF(MO,KM),RDVOREF(MO,KM) | ||
REAL :: X=0.0 | ||
REAL :: TOL=1e-2 | ||
|
||
OPEN (12, file="data/sptrungv.uv.in", access='direct', recl=MI*KM*4, convert='little_endian') | ||
READ (12, rec=1) RDUI | ||
READ (12, rec=2) RDVI | ||
CLOSE (12) | ||
|
||
OPEN (13, file="data/sptrungv.ll.in", access="direct", recl=MO*4, convert='little_endian') | ||
READ (13, rec=1) RDRLAT | ||
READ (13, rec=2) RDRLON | ||
CLOSE (13) | ||
|
||
OPEN (14, file="data/sptrungv.uv.out", access="direct", recl=MO*KM*4, convert='little_endian') | ||
READ (14, rec=1) RDUOREF | ||
READ (14, rec=2) RDVOREF | ||
CLOSE (14) | ||
|
||
UI = REAL(RDUI) | ||
VI = REAL(RDVI) | ||
RLAT = REAL(RDRLAT) | ||
RLON = REAL(RDRLON) | ||
UOREF = REAL(RDUOREF) | ||
VOREF = REAL(RDVOREF) | ||
|
||
CALL SPTRUNGV(IROMB,MAXWV,IDRTI,IMAXI,JMAXI,KM,NO, & | ||
IPRIME,ISKIPI,JSKIPI,MI,MO,0,0,0,RLAT,RLON, & | ||
UI,VI,.TRUE.,UO,VO,.FALSE.,X,X,.FALSE.,X,X) | ||
|
||
DO I=1, MO | ||
IF (ABS(UO(I,KM)-RDUOREF(I,KM)) .GT. TOL) STOP 1 | ||
IF (ABS(VO(I,KM)-RDVOREF(I,KM)) .GT. TOL) STOP 2 | ||
ENDDO | ||
|
||
end program test_sptrungv |