Subversion Repositories lagranto.ecmwf

Rev

Rev 46 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 46 Rev 47
Line 189... Line 189...
189
         print*,'        expected -> lon / lat / time'
189
         print*,'        expected -> lon / lat / time'
190
         print*, ( trim(dimname(i))//' / ',i=1,ndim )
190
         print*, ( trim(dimname(i))//' / ',i=1,ndim )
191
         stop
191
         stop
192
        endif
192
        endif
193
      endif
193
      endif
194
 
194
    
195
c     Check about the type of vertical levels
195
c     Check about the type of vertical levels
196
      if ( ndim.eq.4 ) then
196
      if ( ndim.eq.4 ) then
197
 
197
 
198
c         Get dimension of AK,BK
198
c         Get dimension of AK,BK
199
          varname = 'nhym'
199
          varname = 'nhym'
200
          ierr = NF90_INQ_DIMID(cdfid,varname,dimid)
200
          ierr = NF90_INQ_DIMID(cdfid,varname,dimid)
201
          ierr = nf90_inquire_dimension(cdfid, dimid,len=nakbktmp)
201
          ierr = nf90_inquire_dimension(cdfid, dimid,len=nakbktmp)
202
          IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
202
          IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
203
 
203
 
204
 
-
 
205
          varname=dimname(3)
204
          varname=dimname(3)
206
          ierr = NF90_INQ_VARID(cdfid,varname,varid)
205
          ierr = NF90_INQ_VARID(cdfid,varname,varid)
207
          IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
206
          IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
208
          ierr = nf90_get_att(cdfid, varid, "standard_name", leveltype)
207
          ierr = nf90_get_att(cdfid, varid, "standard_name", leveltype)
209
          IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
208
          IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
Line 225... Line 224...
225
      if (stat.ne.0) print*,'*** error allocating array tmp3     ***'
224
      if (stat.ne.0) print*,'*** error allocating array tmp3     ***'
226
      allocate(lon(vardim(1)),stat=stat)
225
      allocate(lon(vardim(1)),stat=stat)
227
      if (stat.ne.0) print*,'*** error allocating array lon     ***' 
226
      if (stat.ne.0) print*,'*** error allocating array lon     ***' 
228
      allocate(lat(vardim(2)),stat=stat)
227
      allocate(lat(vardim(2)),stat=stat)
229
      if (stat.ne.0) print*,'*** error allocating array lat     ***' 
228
      if (stat.ne.0) print*,'*** error allocating array lat     ***' 
230
      allocate(lev(vardim(3)),stat=stat)
-
 
231
      if (stat.ne.0) print*,'*** error allocating array lev     ***'
-
 
232
      allocate(times(vardim(4)),stat=stat)
-
 
233
      if (stat.ne.0) print*,'*** error allocating array times   ***'
-
 
234
      if ( ndim.eq.4 ) then
229
      if ( ndim.eq.4 ) then
235
        allocate(aktmp(nakbktmp),stat=stat)
230
        allocate(aktmp(nakbktmp),stat=stat)
236
        if (stat.ne.0) print*,'*** error allocating array aktmp   ***'
231
        if (stat.ne.0) print*,'*** error allocating array aktmp   ***'
237
        allocate(bktmp(nakbktmp),stat=stat)
232
        allocate(bktmp(nakbktmp),stat=stat)
238
        if (stat.ne.0) print*,'*** error allocating array bktmp   ***'
233
        if (stat.ne.0) print*,'*** error allocating array bktmp   ***'
-
 
234
        allocate(lev(vardim(3)),stat=stat)
-
 
235
        if (stat.ne.0) print*,'*** error allocating array lev     ***'
-
 
236
        allocate(times(vardim(4)),stat=stat)
-
 
237
        if (stat.ne.0) print*,'*** error allocating array times   ***'
-
 
238
      elseif ( ndim.eq.3 ) then
-
 
239
        allocate(aktmp(nakbktmp),stat=stat)
-
 
240
        if (stat.ne.0) print*,'*** error allocating array aktmp   ***'
-
 
241
        allocate(bktmp(nakbktmp),stat=stat)
-
 
242
        if (stat.ne.0) print*,'*** error allocating array bktmp   ***'
-
 
243
        allocate(lev(vardim(3)),stat=stat)
-
 
244
        allocate(times(vardim(3)),stat=stat)
-
 
245
        if (stat.ne.0) print*,'*** error allocating array times   ***'
239
      endif
246
      endif
240
 
247
 
241
c     Get domain longitudes, latitudes and levels
248
c     Get domain longitudes, latitudes and levels
242
      varname = dimname(1)
249
      varname = dimname(1)
243
      ierr = NF90_INQ_VARID(cdfid,varname,varid)
250
      ierr = NF90_INQ_VARID(cdfid,varname,varid)
Line 570... Line 577...
570
     >                               name = dimname(i) )
577
     >                               name = dimname(i) )
571
        IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
578
        IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
572
        ierr = nf90_inquire_dimension(fid, dimids(i),len=vardim(i))
579
        ierr = nf90_inquire_dimension(fid, dimids(i),len=vardim(i))
573
        IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
580
        IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
574
      enddo
581
      enddo
575
    
-
 
576
 
582
 
577
c     Check whether the list of dimensions is OK
583
c     Check whether the list of dimensions is OK
578
      if (ndim .eq. 4) then
584
      if (ndim .eq. 4) then
579
          if ( ( dimname(1).ne.'lon'  ).or.
585
          if ( ( dimname(1).ne.'lon'  ).or.
580
     >       ( dimname(2).ne.'lat'  ).or.
586
     >       ( dimname(2).ne.'lat'  ).or.
Line 716... Line 722...
716
        endif
722
        endif
717
      endif
723
      endif
718
 
724
 
719
c     Read data /or set 3D pressure field) 
725
c     Read data /or set 3D pressure field) 
720
      if ( pressure.eq.0 ) then
726
      if ( pressure.eq.0 ) then
-
 
727
         if ( vardim(3).gt.1 ) then
721
         ierr = NF90_INQ_VARID(fid,fieldname,varid)
728
           ierr = NF90_INQ_VARID(fid,fieldname,varid)
722
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
729
           IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
723
         ierr = nf90_get_var(fid,varid,tmp3)
730
           ierr = nf90_get_var(fid,varid,tmp3)
-
 
731
           IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
-
 
732
         else
-
 
733
           ierr = NF90_INQ_VARID(fid,fieldname,varid)
-
 
734
           IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
-
 
735
           ierr = nf90_get_var(fid,varid,tmp2)
724
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
736
           IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
-
 
737
         endif 
725
      else
738
      else
726
         if (leveltype.eq.'hybrid_sigma_pressure' ) then
739
         if (leveltype.eq.'hybrid_sigma_pressure' ) then
727
            do i=1,vardim(1)
740
            do i=1,vardim(1)
728
              do j=1,vardim(2)
741
              do j=1,vardim(2)
729
                 do k=1,vardim(3)
742
                 do k=1,vardim(3)
Line 739... Line 752...
739
                 enddo
752
                 enddo
740
              enddo
753
              enddo
741
           enddo
754
           enddo
742
         endif
755
         endif
743
      endif
756
      endif
744
  
757
 
745
c     If the field is 2D, expand it to 3D - simple handling of 2D tracing
758
c     If the field is 2D, expand it to 3D - simple handling of 2D tracing
746
c      if ( vardim(3).eq.1 ) then
759
      if ( vardim(3).eq.1 ) then
747
c         do i=1,vardim(1)
760
         do i=1,vardim(1)
748
c            do j=1,vardim(2)
761
            do j=1,vardim(2)
749
c               do k=1,vardim(3)
-
 
750
c                  tmp3(i,j,k) = tmp3(i,j,1)
762
               tmp3(i,j,1) = tmp2(i,j)
751
c               enddo
-
 
752
c            enddo
763
            enddo
753
c         enddo
764
         enddo
754
c      endif
765
      endif
755
 
766
 
756
c     Decide whether to close arrays
767
c     Decide whether to close arrays
757
      delta = varmax(1)-varmin(1)-360.
768
      delta = varmax(1)-varmin(1)-360.
758
      if (abs(delta+dx).lt.eps) then
769
      if (abs(delta+dx).lt.eps) then
759
          closear = 1
770
          closear = 1