3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6 SUBROUTINE open_wrfsi_static(dataroot,cdfid)
9 # include "pnetcdf.inc"
10 CHARACTER(LEN=*), INTENT(IN) :: dataroot
11 INTEGER, INTENT(OUT) :: cdfid
12 CHARACTER(LEN=255) :: staticfile
13 LOGICAL :: static_exists
16 staticfile = TRIM(dataroot) // '/static/static.wrfsi'
17 INQUIRE(FILE=staticfile, EXIST=static_exists)
18 IF (static_exists) THEN
19 status = nfmpi_open(TRIM(staticfile),NF_NOWRITE,cdfid)
20 IF (status .NE. NF_NOERR) THEN
21 PRINT '(A,I5)', 'NetCDF error opening WRF static file: ',status
22 STOP 'open_wrfsi_static'
28 ! search for rotlat version??
29 ! PRINT '(A)', 'Static file not found ', staticfile
30 ! PRINT '(A)', 'Look for NMM version'
31 staticfile = TRIM(dataroot) // '/static/static.wrfsi.rotlat'
32 INQUIRE(FILE=staticfile, EXIST=static_exists)
33 IF (static_exists) THEN
34 status = nfmpi_open(TRIM(staticfile),NF_NOWRITE,cdfid)
35 IF (status .NE. NF_NOERR) THEN
36 PRINT '(A,I5)', 'NetCDF error opening WRF static file: ',status
37 STOP 'open_wrfsi_static'
41 PRINT '(A)', 'rotlat Static file not found, either: ', staticfile
42 STOP 'open_wrfsi_static'
48 END SUBROUTINE open_wrfsi_static
49 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
50 SUBROUTINE get_wrfsi_static_dims(dataroot, nx, ny)
52 ! Subroutine to return the horizontal dimensions of WRF static file
53 ! contained in the input dataroot
56 # include "pnetcdf.inc"
57 CHARACTER(LEN=*), INTENT(IN) :: dataroot
58 INTEGER , INTENT(OUT) :: nx
59 INTEGER , INTENT(OUT) :: ny
61 INTEGER :: cdfid,vid, status
63 CALL open_wrfsi_static(dataroot,cdfid)
64 status = nfmpi_inq_dimid(cdfid, 'x', vid)
65 status = nfmpi_inq_dimlen(cdfid, vid, nx)
66 status = nfmpi_inq_dimid(cdfid, 'y', vid)
67 status = nfmpi_inq_dimlen(cdfid, vid, ny)
68 PRINT '(A,I5,A,I5)', 'WRF X-dimension = ',nx, &
69 ' WRF Y-dimension = ',ny
70 status = nfmpi_close(cdfid)
72 END SUBROUTINE get_wrfsi_static_dims
73 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
74 SUBROUTINE get_wrfsi_static_2d(dataroot, varname, data)
77 # include "pnetcdf.inc"
78 ! Gets any 2D variable from the static file
79 CHARACTER(LEN=*), INTENT(IN) :: dataroot
80 CHARACTER(LEN=*), INTENT(IN) :: varname
81 REAL, INTENT(OUT) :: data(:,:)
83 INTEGER :: cdfid, vid, status
85 CALL open_wrfsi_static(dataroot,cdfid)
86 status = nfmpi_inq_varid(cdfid,varname,vid)
87 status = nfmpi_get_var_real(cdfid,vid,data)
88 IF (status .NE. NF_NOERR) THEN
89 PRINT '(A)', 'Problem getting 2D data.'
91 status = nfmpi_close(cdfid)
93 END SUBROUTINE get_wrfsi_static_2d
94 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
96 END MODULE wrfsi_static