/[lmdze]/trunk/Sources/dyn3d/Guide/Read_reanalyse/read_reanalyse.f
ViewVC logotype

Diff of /trunk/Sources/dyn3d/Guide/Read_reanalyse/read_reanalyse.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 172 by guez, Wed Sep 30 15:59:14 2015 UTC revision 173 by guez, Tue Oct 6 15:57:02 2015 UTC
# Line 8  contains Line 8  contains
8    
9      ! From LMDZ4/libf/dyn3d/read_reanalyse.F, version 1.3, 2005/04/15 12:31:21      ! From LMDZ4/libf/dyn3d/read_reanalyse.F, version 1.3, 2005/04/15 12:31:21
10    
11      USE conf_guide_m, ONLY: guide_q, guide_t, guide_u, guide_v, ncep      USE conf_guide_m, ONLY: guide_q, guide_t, guide_u, guide_v
12      USE dimens_m, ONLY: iim, jjm, llm      USE dimens_m, ONLY: iim, jjm, llm
13        use nat2gcm_m, only: nat2gcm
14      USE netcdf, ONLY: nf90_nowrite      USE netcdf, ONLY: nf90_nowrite
15      USE netcdf95, ONLY: nf95_get_var, nf95_inq_dimid, nf95_inq_varid, &      USE netcdf95, ONLY: nf95_get_var, nf95_inq_dimid, nf95_inq_varid, &
16           nf95_inquire_dimension, nf95_open           nf95_inquire_dimension, nf95_open, find_coord
17      USE paramet_m, ONLY: iip1, jjp1      USE paramet_m, ONLY: iip1, jjp1
18      use reanalyse2nat_m, only: reanalyse2nat      use reanalyse2nat_m, only: reanalyse2nat
19    
# Line 22  contains Line 23  contains
23      real, intent(out):: t(:, :, :), q(:, :, :) ! (iip1, jjp1, llm)      real, intent(out):: t(:, :, :), q(:, :, :) ! (iip1, jjp1, llm)
24    
25      ! Local:      ! Local:
26      integer, save:: nlevnc      integer nlevnc
27      integer:: timestep = 0      integer:: timestep = 0
28      real pk(iip1, jjp1, llm)      real pk(iip1, jjp1, llm)
29      integer, save:: ncidu, varidu, ncidv, varidv, ncidt, varidt, ncidQ, varidQ      integer, save:: ncidu, varidu, ncidv, varidv, ncidt, varidt, ncidQ, varidQ
# Line 31  contains Line 32  contains
32      real, allocatable, save:: vnc(:, :, :) ! (iip1, jjm, nlevnc)      real, allocatable, save:: vnc(:, :, :) ! (iip1, jjm, nlevnc)
33      real, allocatable, save:: tnc(:, :, :), Qnc(:, :, :) ! (iip1, jjp1, nlevnc)      real, allocatable, save:: tnc(:, :, :), Qnc(:, :, :) ! (iip1, jjp1, nlevnc)
34      real, allocatable, save:: pl(:) ! (nlevnc)      real, allocatable, save:: pl(:) ! (nlevnc)
35        real latitude(jjm + 1)
36      logical:: first = .true.      logical:: first = .true.
37      character(len = 8) name      logical, save:: invert_y
38    
39      ! -----------------------------------------------------------------      ! -----------------------------------------------------------------
40    
41      ! Initialisation de la lecture des fichiers      ! Initialisation de la lecture des fichiers
42    
43      if (first) then      if (first) then
44         print *, 'Intitialisation de read reanalsye'         print *, 'Intitialisation de read reanalyse'
45    
46         ! Vent zonal         ! Vent zonal
47         if (guide_u) then         if (guide_u) then
# Line 77  contains Line 79  contains
79            ncid = ncidq            ncid = ncidq
80         end if         end if
81    
82         name = merge('LEVEL   ', 'PRESSURE', ncep)         call find_coord(ncid, dimid = dimid, varid = varid, std_name = "plev")
        call nf95_inq_dimid(ncid, name, dimid)  
83         call nf95_inquire_dimension(ncid, dimid, nclen = nlevnc)         call nf95_inquire_dimension(ncid, dimid, nclen = nlevnc)
        call nf95_inq_varid(ncid, name, varid)  
84         PRINT *, 'nlevnc = ', nlevnc         PRINT *, 'nlevnc = ', nlevnc
85         allocate(unc(iip1, jjp1, nlevnc), vnc(iip1, jjm, nlevnc))         allocate(unc(iip1, jjp1, nlevnc), vnc(iip1, jjm, nlevnc))
86         allocate(tnc(iip1, jjp1, nlevnc), Qnc(iip1, jjp1, nlevnc), pl(nlevnc))         allocate(tnc(iip1, jjp1, nlevnc), Qnc(iip1, jjp1, nlevnc), pl(nlevnc))
87         call NF95_GET_VAR(ncid, varid, pl)         call NF95_GET_VAR(ncid, varid, pl)
88         pl = 100. * pl ! passage en pascal         pl = 100. * pl ! passage en pascal
89    
90           ! Read latitude values just to know their order:
91           call find_coord(ncid, varid = varid, std_name = "latitude")
92           call nf95_get_var(ncid, varid, latitude)
93           invert_y = latitude(1) < latitude(2)
94    
95         first = .false.         first = .false.
96      endif      endif
97    
98      ! lecture des champs u, v, T      ! lecture des champs u, v, T, q
99    
100      timestep = timestep + 1      timestep = timestep + 1
     unc = 0.  
     vnc = 0.  
     tnc = 0.  
     Qnc = 0.  
101    
102      ! Vent zonal      ! Vent zonal
103      if (guide_u) then      if (guide_u) then
104         call NF95_GET_VAR(ncidu, varidu, unc, start = (/1, 1, 1, timestep/))         call NF95_GET_VAR(ncidu, varidu, unc, start = (/1, 1, 1, timestep/))
105         call correctbid(iim, jjp1 * nlevnc, unc)      else
106      endif         unc = 0.
107        end if
108    
109      ! Temperature      ! Temperature
110      if (guide_T) then      if (guide_T) then
111         call NF95_GET_VAR(ncidt, varidt, tnc, start = (/1, 1, 1, timestep/))         call NF95_GET_VAR(ncidt, varidt, tnc, start = (/1, 1, 1, timestep/))
112         call correctbid(iim, jjp1 * nlevnc, tnc)      else
113      endif         tnc = 0.
114        end if
115    
116      ! Humidite      ! Humidite
117      if (guide_Q) then      if (guide_Q) then
118         call NF95_GET_VAR(ncidQ, varidQ, Qnc, start = (/1, 1, 1, timestep/))         call NF95_GET_VAR(ncidQ, varidQ, Qnc, start = (/1, 1, 1, timestep/))
119         call correctbid(iim, jjp1 * nlevnc, Qnc)      else
120      endif         Qnc = 0.
121        end if
122    
123      ! Vent meridien      ! Vent meridien
124      if (guide_v) then      if (guide_v) then
125         call NF95_GET_VAR(ncidv, varidv, vnc, start = (/1, 1, 1, timestep/))         call NF95_GET_VAR(ncidv, varidv, vnc, start = (/1, 1, 1, timestep/))
126         call correctbid(iim, jjm * nlevnc, vnc)      else
127      endif         vnc = 0.
128        end if
129    
130      call reanalyse2nat(nlevnc, psi, unc, vnc, tnc, Qnc, pl, u, v, t, Q, pk)      call reanalyse2nat(invert_y, psi, unc, vnc, tnc, Qnc, pl, u, v, t, Q, pk)
131      call nat2gcm(u, v, t, Q, pk, u, v, t, Q)      call nat2gcm(pk, u, v, t)
132    
133    end subroutine read_reanalyse    end subroutine read_reanalyse
134    

Legend:
Removed from v.172  
changed lines
  Added in v.173

  ViewVC Help
Powered by ViewVC 1.1.21