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

Annotation of /trunk/bibio/writefield.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 109 - (hide annotations)
Wed Sep 17 10:08:00 2014 UTC (9 years, 8 months ago) by guez
Original Path: trunk/bibio/Writefield/writefield.f
File size: 2058 byte(s)
Moved a call to writefield from guide to tau2alpha. (dxdys does not
change with itau.) So dxdys does not need to be a module variable any
longer. Other variables of modules tau2alpha_m downgraded to local
variables of tau2alpha, since they were not used elsewhere.

Procedures write_field[13]d and formcoord were never called. Could
then remove int2str.

Inline writefield_gen into writefield.

CreateNewField takes an integer array argument instead of 3 scalar
integers. CreateNewField now creates a number of dimensions adapted to
the rank of the output field, instead of always 4 dimensions.

Changed names of variables of module write_field: fieldid to
ncid, fieldindex to record, fieldvarid to varid.

In writefield_gen, if index == -1, no need to call GetFieldIndex
again, we know that the result is nbfield.

In guide, moved calls to writefield for some variables inside if
first_call: those variables do not change with time. Removed ztau:
computed only to be output, does not seem meaningful. Removed
writefield for aire: does not change with time and is already in
"grilles_gcm.nc".

1 guez 108 module WriteField_m
2    
3 guez 109 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 guez 108
8     implicit none
9    
10     interface WriteField
11     module procedure WriteField3d,WriteField2d,WriteField1d
12     end interface WriteField
13    
14     private
15     public WriteField
16    
17     contains
18    
19     subroutine WriteField1d(name,Field)
20    
21 guez 109 character(len=*), intent(in):: name
22     real, intent(in):: Field(:)
23 guez 108
24 guez 109 ! 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 guez 108 end subroutine WriteField1d
42    
43     !****************************************************************
44    
45     subroutine WriteField2d(name,Field)
46    
47 guez 109 character(len=*), intent(in):: name
48     real, intent(in):: Field(:, :)
49 guez 108
50 guez 109 ! 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 guez 108 end subroutine WriteField2d
68    
69     !****************************************************************
70    
71     subroutine WriteField3d(name,Field)
72    
73 guez 109 character(len=*), intent(in):: name
74     real, intent(in):: Field(:, :, :)
75 guez 108
76 guez 109 ! 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 guez 108 end subroutine WriteField3d
94    
95     end module WriteField_m

  ViewVC Help
Powered by ViewVC 1.1.21