source: lmdz_wrf/WRFV3/external/io_netcdf/module_wrfsi_static.F90 @ 1

Last change on this file since 1 was 1, checked in by lfita, 10 years ago
  • -- --- Opening of the WRF+LMDZ coupling repository --- -- -

WRF: version v3.3
LMDZ: version v1818

More details in:

File size: 3.2 KB
Line 
1MODULE wrfsi_static
2
3!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
4CONTAINS
5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6  SUBROUTINE open_wrfsi_static(dataroot,cdfid)
7 
8    IMPLICIT NONE
9    INCLUDE "netcdf.inc"
10    CHARACTER(LEN=*), INTENT(IN)   :: dataroot
11    INTEGER, INTENT(OUT)           :: cdfid
12    CHARACTER(LEN=255)            :: staticfile
13    LOGICAL                       :: static_exists
14    INTEGER                       :: status
15
16    staticfile = TRIM(dataroot) // '/static/static.wrfsi'
17    INQUIRE(FILE=staticfile, EXIST=static_exists)
18    IF (static_exists) THEN
19      status = NF_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'
23      END IF
24
25    ELSE
26
27!mp
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 = NF_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'
38      END IF
39                    ELSE
40
41      PRINT '(A)', 'rotlat Static file not found, either: ', staticfile
42      STOP 'open_wrfsi_static'
43                    ENDIF
44
45        ENDIF
46
47    RETURN
48  END SUBROUTINE open_wrfsi_static     
49!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
50  SUBROUTINE get_wrfsi_static_dims(dataroot, nx, ny)
51 
52    ! Subroutine to return the horizontal dimensions of WRF static file
53    ! contained in the input dataroot
54
55    IMPLICIT NONE
56    INCLUDE "netcdf.inc"
57    CHARACTER(LEN=*), INTENT(IN)  :: dataroot
58    INTEGER         , INTENT(OUT) :: nx
59    INTEGER         , INTENT(OUT) :: ny
60
61    INTEGER                       :: cdfid,vid, status
62
63    CALL open_wrfsi_static(dataroot,cdfid)
64    status = NF_INQ_DIMID(cdfid, 'x', vid)
65    status = NF_INQ_DIMLEN(cdfid, vid, nx)
66    status = NF_INQ_DIMID(cdfid, 'y', vid)
67    status = NF_INQ_DIMLEN(cdfid, vid, ny)
68      PRINT '(A,I5,A,I5)', 'WRF X-dimension = ',nx, &
69        ' WRF Y-dimension = ',ny 
70    status = NF_CLOSE(cdfid) 
71    RETURN
72  END SUBROUTINE get_wrfsi_static_dims     
73!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
74  SUBROUTINE get_wrfsi_static_2d(dataroot, varname, data)
75
76    IMPLICIT NONE
77    INCLUDE "netcdf.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(:,:)
82 
83    INTEGER                             :: cdfid, vid, status
84   
85    CALL open_wrfsi_static(dataroot,cdfid)
86    status = NF_INQ_VARID(cdfid,varname,vid)
87    status = NF_GET_VAR_REAL(cdfid,vid,data)
88    IF (status .NE. NF_NOERR) THEN
89      PRINT '(A)', 'Problem getting 2D data.'
90    ENDIF
91    status = NF_CLOSE(cdfid)
92    RETURN
93  END SUBROUTINE get_wrfsi_static_2d   
94!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
95 
96END MODULE wrfsi_static
Note: See TracBrowser for help on using the repository browser.