/[lmdze]/trunk/Sources/bibio/writefield.f
ViewVC logotype

Diff of /trunk/Sources/bibio/writefield.f

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

trunk/bibio/Writefield/writefield.f revision 109 by guez, Wed Sep 17 10:08:00 2014 UTC trunk/bibio/writefield.f revision 113 by guez, Thu Sep 18 19:56:46 2014 UTC
# Line 1  Line 1 
1  module WriteField_m  module WriteField_m
2    
3    USE write_field, ONLY: ncid, record, varid, nbfield    use CreateNewField_m, only: CreateNewField, ncid, nbfield, MaxWriteField
   use CreateNewField_m, only: CreateNewField  
4    use GetFieldIndex_m, only: GetFieldIndex    use GetFieldIndex_m, only: GetFieldIndex
5    USE netcdf95, ONLY: nf95_put_var    USE netcdf95, ONLY: nf95_put_var
6    
7    implicit none    implicit none
8    
9      integer, save:: Record(MaxWriteField)
10    
11    interface WriteField    interface WriteField
12       module procedure WriteField3d,WriteField2d,WriteField1d       module procedure WriteField3d,WriteField2d,WriteField1d
13    end interface WriteField    end interface WriteField
# Line 31  contains Line 32  contains
32      if (Index==-1) then      if (Index==-1) then
33         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
34         Index=nbfield         Index=nbfield
35           Record(Index) = 1
36      else      else
37         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
38      endif      endif
39    
40      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
41           start = (/1, Record(Index)/))           start = (/1, Record(Index)/))
42    
43    end subroutine WriteField1d    end subroutine WriteField1d
# Line 44  contains Line 46  contains
46    
47    subroutine WriteField2d(name,Field)    subroutine WriteField2d(name,Field)
48    
49        use netcdf, only: nf90_sync
50    
51      character(len=*), intent(in):: name      character(len=*), intent(in):: name
52      real, intent(in):: Field(:, :)      real, intent(in):: Field(:, :)
53    
54      ! Local:      ! Local:
55      integer index      integer index, status
56    
57      !-------------------------------------------      !-------------------------------------------
58    
# Line 57  contains Line 61  contains
61      if (Index==-1) then      if (Index==-1) then
62         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
63         Index=nbfield         Index=nbfield
64           Record(Index) = 1
65      else      else
66         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
67      endif      endif
68    
69      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
70           start = (/1, 1, Record(Index)/))           start = (/1, 1, Record(Index)/))
71        status = nf90_sync(Ncid(Index))
72    
73    end subroutine WriteField2d    end subroutine WriteField2d
74    
# Line 83  contains Line 89  contains
89      if (Index==-1) then      if (Index==-1) then
90         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
91         Index=nbfield         Index=nbfield
92           Record(Index) = 1
93      else      else
94         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
95      endif      endif
96    
97      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
98           start = (/1, 1, 1, Record(Index)/))           start = (/1, 1, 1, Record(Index)/))
99    
100    end subroutine WriteField3d    end subroutine WriteField3d

Legend:
Removed from v.109  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.21