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

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

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

revision 108 by guez, Tue Sep 16 14:00:41 2014 UTC revision 109 by guez, Wed Sep 17 10:08:00 2014 UTC
# Line 1  Line 1 
1  module WriteField_m  module WriteField_m
2    
3    use writefield_gen_m, only: writefield_gen    USE write_field, ONLY: ncid, record, varid, nbfield
4      use CreateNewField_m, only: CreateNewField
5      use GetFieldIndex_m, only: GetFieldIndex
6      USE netcdf95, ONLY: nf95_put_var
7    
8    implicit none    implicit none
9    
# Line 14  module WriteField_m Line 17  module WriteField_m
17  contains  contains
18    
19    subroutine WriteField1d(name,Field)    subroutine WriteField1d(name,Field)
     character(len=*) :: name  
     real, dimension(:) :: Field  
     integer, dimension(1) :: Dim  
20    
21      Dim=shape(Field)      character(len=*), intent(in):: name
22      call WriteField_gen(name,Field,Dim(1),1,1)      real, intent(in):: Field(:)
23    
24        ! Local:
25        integer index
26    
27        !-------------------------------------------
28    
29        Index=GetFieldIndex(name)
30    
31        if (Index==-1) then
32           call CreateNewField(name, shape(field))
33           Index=nbfield
34        else
35           Record(Index)=Record(Index)+1
36        endif
37    
38        call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &
39             start = (/1, Record(Index)/))
40    
41    end subroutine WriteField1d    end subroutine WriteField1d
42    
43    !****************************************************************    !****************************************************************
44    
45    subroutine WriteField2d(name,Field)    subroutine WriteField2d(name,Field)
     character(len=*) :: name  
     real, dimension(:,:) :: Field  
     integer, dimension(2) :: Dim  
46    
47      Dim=shape(Field)      character(len=*), intent(in):: name
48      call WriteField_gen(name,Field,Dim(1),Dim(2),1)      real, intent(in):: Field(:, :)
49    
50        ! Local:
51        integer index
52    
53        !-------------------------------------------
54    
55        Index=GetFieldIndex(name)
56    
57        if (Index==-1) then
58           call CreateNewField(name, shape(field))
59           Index=nbfield
60        else
61           Record(Index)=Record(Index)+1
62        endif
63    
64        call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &
65             start = (/1, 1, Record(Index)/))
66    
67    end subroutine WriteField2d    end subroutine WriteField2d
68    
69    !****************************************************************    !****************************************************************
70    
71    subroutine WriteField3d(name,Field)    subroutine WriteField3d(name,Field)
     character(len=*) :: name  
     real, dimension(:,:,:) :: Field  
     integer, dimension(3) :: Dim  
72    
73      Dim=shape(Field)      character(len=*), intent(in):: name
74      call WriteField_gen(name,Field,Dim(1),Dim(2),Dim(3))      real, intent(in):: Field(:, :, :)
75    
76        ! Local:
77        integer index
78    
79        !-------------------------------------------
80    
81        Index=GetFieldIndex(name)
82    
83        if (Index==-1) then
84           call CreateNewField(name, shape(field))
85           Index=nbfield
86        else
87           Record(Index)=Record(Index)+1
88        endif
89    
90        call NF95_PUT_VAR(Ncid(Index), Varid(Index), Field, &
91             start = (/1, 1, 1, Record(Index)/))
92    
93    end subroutine WriteField3d    end subroutine WriteField3d
94    

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

  ViewVC Help
Powered by ViewVC 1.1.21