12 use kinds,
only: kind_real
13 use fckit_log_module,
only : fckit_log
22 REAL(kind_real),
POINTER :: band_up_lim(:)
23 REAL(kind_real),
POINTER :: sigma(:,:,:)
24 REAL(kind_real),
POINTER :: inverse(:,:,:,:)
40 CHARACTER(LEN=*) :: filename
41 INTEGER,
INTENT(IN) :: cx_nlevp
42 INTEGER,
INTENT(IN) :: cx_nlevq
46 CHARACTER(len=*),
PARAMETER :: routinename =
"Ops_GPSRO_GetBmatrix"
57 CHARACTER(len=*),
PARAMETER :: filetype_name =
"Bmatrix"
58 CHARACTER(len=20) :: prefix
59 CHARACTER(len=256) :: errormessage
60 INTEGER :: return_code
69 OPEN(unit=fileunit, file=filename, action=
'READ', status=
'OLD', iostat=return_code)
70 if (return_code /= 0)
then
71 WRITE(errormessage,
'(3A,I0)')
"Error opening ", trim(filename), &
72 ", return code = ", return_code
73 call abor1_ftn(errormessage)
80 READ (fileunit,
'(5I5)') nlevp, nlevq, nstate, nband, nseason
82 IF (cx_nlevp /= nlevp)
THEN
84 WRITE (errormessage,
'(A,I0,A,I0)')
'nlevp = ', nlevp,
' cx_nlevp = ', cx_nlevp
85 call fckit_log % error(errormessage)
86 errormessage =
'no. of pressure levels in vector and bmatrix not the same'
87 call abor1_ftn(errormessage)
91 IF (cx_nlevq /= nlevq)
THEN
93 WRITE (errormessage,
'(A,I0,A,I0)')
'nlevq = ', nlevq,
' cx_nlevq = ', cx_nlevq
94 call fckit_log % error(errormessage)
95 errormessage =
'no. of humidity levels in vector and bmatrix not the same'
96 call abor1_ftn(errormessage)
102 bmatrix % nlevp = nlevp
103 bmatrix % nlevq = nlevq
104 bmatrix % nstate = nstate
105 bmatrix % nband = nband
106 bmatrix % nseason = nseason
110 ALLOCATE (bmatrix % band_up_lim(nband))
111 ALLOCATE (bmatrix % sigma(nseason,nband,nstate))
112 ALLOCATE (bmatrix % inverse(nseason,nband,nstate,nstate))
116 READ (fileunit,
'(3F5.1)') (bmatrix % band_up_lim(i), i = 1, nband)
126 READ (fileunit,
'(10E15.6)') (bmatrix % sigma (n,m,i), i = 1, nstate)
133 READ (fileunit,
'(10E15.6)') (bmatrix % inverse (n,m,i,j), j = 1, nstate)
Set up the background error covariance matrix (B matrix).
subroutine, public ops_gpsro_getbmatrix(filename, cx_nlevp, cx_nlevq, Bmatrix)
Fortran module with various useful routines.
integer function, public ufo_utils_iogetfreeunit()
Find a free file unit.