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

Diff of /trunk/misc/writefield.f

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

revision 109 by guez, Wed Sep 17 10:08:00 2014 UTC revision 110 by guez, Wed Sep 17 11:55:05 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 57  contains Line 59  contains
59      if (Index==-1) then      if (Index==-1) then
60         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
61         Index=nbfield         Index=nbfield
62           Record(Index) = 1
63      else      else
64         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
65      endif      endif
66    
67      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
68           start = (/1, 1, Record(Index)/))           start = (/1, 1, Record(Index)/))
69    
70    end subroutine WriteField2d    end subroutine WriteField2d
# Line 83  contains Line 86  contains
86      if (Index==-1) then      if (Index==-1) then
87         call CreateNewField(name, shape(field))         call CreateNewField(name, shape(field))
88         Index=nbfield         Index=nbfield
89           Record(Index) = 1
90      else      else
91         Record(Index)=Record(Index)+1         Record(Index)=Record(Index)+1
92      endif      endif
93    
94      call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &      call NF95_PUT_VAR(Ncid(Index), Varid = 1, values = Field, &
95           start = (/1, 1, 1, Record(Index)/))           start = (/1, 1, 1, Record(Index)/))
96    
97    end subroutine WriteField3d    end subroutine WriteField3d

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

  ViewVC Help
Powered by ViewVC 1.1.21