/[lmdze]/trunk/misc/writefield.f90
ViewVC logotype

Diff of /trunk/misc/writefield.f90

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/Sources/misc/writefield.f revision 145 by guez, Tue Jun 16 15:23:29 2015 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, nf95_sync
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        call nf95_sync(Ncid(Index))
43    
44    end subroutine WriteField1d    end subroutine WriteField1d
45    
# Line 57  contains Line 60  contains
60      if (Index==-1) then      if (Index==-1) then
61         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
62         Index=nbfield         Index=nbfield
63           Record(Index) = 1
64      else      else
65         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
66      endif      endif
67    
68      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
69           start = (/1, 1, Record(Index)/))           start = (/1, 1, Record(Index)/))
70        call nf95_sync(Ncid(Index))
71    
72    end subroutine WriteField2d    end subroutine WriteField2d
73    
# Line 83  contains Line 88  contains
88      if (Index==-1) then      if (Index==-1) then
89         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
90         Index=nbfield         Index=nbfield
91           Record(Index) = 1
92      else      else
93         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
94      endif      endif
95    
96      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
97           start = (/1, 1, 1, Record(Index)/))           start = (/1, 1, 1, Record(Index)/))
98        call nf95_sync(Ncid(Index))
99    
100    end subroutine WriteField3d    end subroutine WriteField3d
101    

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

  ViewVC Help
Powered by ViewVC 1.1.21