/[lmdze]/trunk/Sources/phylmd/getso4fromfile.f
ViewVC logotype

Diff of /trunk/Sources/phylmd/getso4fromfile.f

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

revision 134 by guez, Wed Apr 29 15:47:56 2015 UTC revision 191 by guez, Mon May 9 19:56:28 2016 UTC
# Line 8  contains Line 8  contains
8    
9      ! Routine for reading SO4 data from files      ! Routine for reading SO4 data from files
10    
     USE dimens_m, ONLY: iim, jjm  
     USE dimphy, ONLY: klev  
11      USE netcdf, ONLY: nf90_nowrite      USE netcdf, ONLY: nf90_nowrite
12      USE netcdf95, ONLY: nf95_close, nf95_get_var, nf95_inq_varid, nf95_open      USE netcdf95, ONLY: nf95_close, nf95_get_var, nf95_inq_varid, &
13             nf95_inquire_dimension, nf95_inquire_variable, nf95_open
14        use nr_util, only: assert
15    
16      CHARACTER(len=*), intent(in):: cyr      CHARACTER(len=*), intent(in):: cyr
17      double precision so4(iim, jjm + 1, klev, 12)      real, intent(out):: so4(:, :, :, :) ! (iim, jjm + 1, klev, 12)
18    
19      ! Local:      ! Local:
   
20      CHARACTER(len=15) fname      CHARACTER(len=15) fname
21        INTEGER NCID, VARID, nclen(4), i
22      CHARACTER(len=6) cvar      integer, pointer:: dimids(:) ! (4)
     INTEGER START(3), COUNT(3)  
     INTEGER  NCID, VARID  
     INTEGER imth, i, j, k  
   
     double precision so4mth(iim, jjm + 1, klev)  
23    
24      !---------------------------------------------------------------------      !---------------------------------------------------------------------
25    
26      fname = 'so4.run'//cyr//'.cdf'      fname = 'aerosols' // cyr // '.nc'
27        print *, 'Reading ', fname
     write(*,*) 'reading ', fname  
28      call NF95_OPEN(fname, NF90_NOWRITE, NCID)      call NF95_OPEN(fname, NF90_NOWRITE, NCID)
29        call NF95_INQ_VARID(NCID, "SO4", VARID)
30        call nf95_inquire_variable(ncid, varid, dimids=dimids)
31    
32      DO imth=1, 12      do i = 1, 4
33         IF (imth.eq.1) THEN         call nf95_inquire_dimension(ncid, dimids(i), nclen=nclen(i))
34            cvar='SO4JAN'      end do
35         ELSEIF (imth.eq.2) THEN  
36            cvar='SO4FEB'      deallocate(dimids) ! pointer
37         ELSEIF (imth.eq.3) THEN      call assert(nclen == shape(so4), "getso4fromfile")
38            cvar='SO4MAR'      call NF95_GET_VAR(NCID, VARID, so4)
        ELSEIF (imth.eq.4) THEN  
           cvar='SO4APR'  
        ELSEIF (imth.eq.5) THEN  
           cvar='SO4MAY'  
        ELSEIF (imth.eq.6) THEN  
           cvar='SO4JUN'  
        ELSEIF (imth.eq.7) THEN  
           cvar='SO4JUL'  
        ELSEIF (imth.eq.8) THEN  
           cvar='SO4AUG'  
        ELSEIF (imth.eq.9) THEN  
           cvar='SO4SEP'  
        ELSEIF (imth.eq.10) THEN  
           cvar='SO4OCT'  
        ELSEIF (imth.eq.11) THEN  
           cvar='SO4NOV'  
        ELSEIF (imth.eq.12) THEN  
           cvar='SO4DEC'  
        ENDIF  
        start(1)=1  
        start(2)=1  
        start(3)=1  
        count(1)=iim  
        count(2)=jjm + 1  
        count(3)=klev  
        call NF95_INQ_VARID(NCID, cvar, VARID)  
        write(*,*) ncid,imth,cvar, varid  
   
        call NF95_GET_VAR(NCID, VARID, so4mth, START,COUNT)  
   
        DO k=1,klev  
           DO j=1,jjm+1  
              DO i=1,iim  
                 IF (so4mth(i,j,k).LT.0.) then  
                    write(*,*) 'this is shit'  
                    write(*,*) 'so4(',i,j,k,') =',so4mth(i,j,k)  
                 endif  
                 so4(i,j,k,imth)=so4mth(i,j,k)  
              ENDDO  
           ENDDO  
        ENDDO  
     ENDDO  
   
39      call NF95_CLOSE(NCID)      call NF95_CLOSE(NCID)
40    
41    END SUBROUTINE getso4fromfile    END SUBROUTINE getso4fromfile

Legend:
Removed from v.134  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.21