source: LMDZ5/trunk/libf/bibio/nf95_put_var_m.F90 @ 1706

Last change on this file since 1706 was 1635, checked in by lguez, 12 years ago

In "dynetat0" and "dynredem_*", replaced calls to "nf_get_var*" and
"nf_put_var*" (old NetCDF 77 interface, embedded in a test of
NC_DOUBLE) by calls to "nf90_get_var" and "nf95_put_var". This
required a change of the rank of some variables in those procedures.

Updated the NetCDF95 library, included in "bibio".

Revision tested in sequential and parallel with MPI. Identical
results.

File size: 9.5 KB
Line 
1! $Id$
2module nf95_put_var_m
3
4  implicit none
5
6  interface nf95_put_var
7     module procedure nf95_put_var_FourByteReal, nf95_put_var_FourByteInt, &
8          nf95_put_var_1D_FourByteReal, nf95_put_var_1D_FourByteInt, &
9          nf95_put_var_2D_FourByteReal, nf95_put_var_3D_FourByteReal, &
10          nf95_put_var_4D_FourByteReal
11  end interface
12
13  private
14  public nf95_put_var
15
16contains
17
18  subroutine nf95_put_var_FourByteReal(ncid, varid, values, start, ncerr)
19
20    use netcdf, only: nf90_put_var
21    use handle_err_m, only: handle_err
22
23    integer, intent(in) :: ncid, varid
24    real, intent(in) :: values
25    integer, dimension(:), optional, intent(in) :: start
26    integer, intent(out), optional:: ncerr
27
28    ! Variable local to the procedure:
29    integer ncerr_not_opt
30
31    !-------------------
32
33    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
34    if (present(ncerr)) then
35       ncerr = ncerr_not_opt
36    else
37       call handle_err("nf95_put_var_FourByteReal", ncerr_not_opt, ncid, &
38            varid)
39    end if
40
41  end subroutine nf95_put_var_FourByteReal
42
43  !***********************
44
45  subroutine nf95_put_var_FourByteInt(ncid, varid, values, start, ncerr)
46
47    use netcdf, only: nf90_put_var
48    use handle_err_m, only: handle_err
49
50    integer, intent(in) :: ncid, varid
51    integer, intent(in) :: values
52    integer, dimension(:), optional, intent(in) :: start
53    integer, intent(out), optional:: ncerr
54
55    ! Variable local to the procedure:
56    integer ncerr_not_opt
57
58    !-------------------
59
60    ncerr_not_opt = nf90_put_var(ncid, varid, values, start)
61    if (present(ncerr)) then
62       ncerr = ncerr_not_opt
63    else
64       call handle_err("nf95_put_var_FourByteInt", ncerr_not_opt, ncid, &
65            varid)
66    end if
67
68  end subroutine nf95_put_var_FourByteInt
69
70  !***********************
71
72  subroutine nf95_put_var_1D_FourByteReal(ncid, varid, values, start, &
73       count_nc, stride, map, ncerr)
74
75    use netcdf, only: nf90_put_var
76    use handle_err_m, only: handle_err
77
78    integer,                         intent(in) :: ncid, varid
79    real, intent(in) :: values(:)
80    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
81    integer, intent(out), optional:: ncerr
82
83    ! Variable local to the procedure:
84    integer ncerr_not_opt
85
86    !-------------------
87
88    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
89         stride, map)
90    if (present(ncerr)) then
91       ncerr = ncerr_not_opt
92    else
93       call handle_err("nf95_put_var_1D_FourByteReal", ncerr_not_opt, ncid, &
94            varid)
95    end if
96
97  end subroutine nf95_put_var_1D_FourByteReal
98
99  !***********************
100
101  subroutine nf95_put_var_1D_FourByteInt(ncid, varid, values, start, &
102       count_nc, stride, map, ncerr)
103
104    use netcdf, only: nf90_put_var
105    use handle_err_m, only: handle_err
106
107    integer,                         intent(in) :: ncid, varid
108    integer, intent(in) :: values(:)
109    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
110    integer, intent(out), optional:: ncerr
111
112    ! Variable local to the procedure:
113    integer ncerr_not_opt
114
115    !-------------------
116
117    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
118         stride, map)
119    if (present(ncerr)) then
120       ncerr = ncerr_not_opt
121    else
122       call handle_err("nf95_put_var_1D_FourByteInt", ncerr_not_opt, ncid, &
123            varid)
124    end if
125
126  end subroutine nf95_put_var_1D_FourByteInt
127
128  !***********************
129
130  subroutine nf95_put_var_1D_EightByteReal(ncid, varid, values, start, &
131       count_nc, stride, map, ncerr)
132
133    use typesizes, only: eightByteReal
134    use netcdf, only: nf90_put_var
135    use handle_err_m, only: handle_err
136
137    integer,                         intent(in) :: ncid, varid
138    real (kind = EightByteReal),     intent(in) :: values(:)
139    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
140    integer, intent(out), optional:: ncerr
141
142    ! Variable local to the procedure:
143    integer ncerr_not_opt
144
145    !-------------------
146
147    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
148         stride, map)
149    if (present(ncerr)) then
150       ncerr = ncerr_not_opt
151    else
152       call handle_err("nf95_put_var_1D_eightByteReal", ncerr_not_opt, ncid, &
153            varid)
154    end if
155
156  end subroutine nf95_put_var_1D_EightByteReal
157
158  !***********************
159
160  subroutine nf95_put_var_2D_FourByteReal(ncid, varid, values, start, &
161       count_nc, stride, map, ncerr)
162
163    use netcdf, only: nf90_put_var
164    use handle_err_m, only: handle_err
165
166    integer,                         intent(in) :: ncid, varid
167    real, intent(in) :: values(:, :)
168    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
169    integer, intent(out), optional:: ncerr
170
171    ! Variable local to the procedure:
172    integer ncerr_not_opt
173
174    !-------------------
175
176    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
177         stride, map)
178    if (present(ncerr)) then
179       ncerr = ncerr_not_opt
180    else
181       call handle_err("nf95_put_var_2D_FourByteReal", ncerr_not_opt, ncid, &
182            varid)
183    end if
184
185  end subroutine nf95_put_var_2D_FourByteReal
186
187  !***********************
188
189  subroutine nf95_put_var_2D_EightByteReal(ncid, varid, values, start, &
190       count_nc, stride, map, ncerr)
191
192    use typesizes, only: EightByteReal
193    use netcdf, only: nf90_put_var
194    use handle_err_m, only: handle_err
195
196    integer,                         intent(in) :: ncid, varid
197    real (kind = EightByteReal), intent(in) :: values(:, :)
198    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
199    integer, intent(out), optional:: ncerr
200
201    ! Variable local to the procedure:
202    integer ncerr_not_opt
203
204    !-------------------
205
206    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
207         stride, map)
208    if (present(ncerr)) then
209       ncerr = ncerr_not_opt
210    else
211       call handle_err("nf95_put_var_2D_EightByteReal", ncerr_not_opt, ncid, &
212            varid)
213    end if
214
215  end subroutine nf95_put_var_2D_EightByteReal
216
217  !***********************
218
219  subroutine nf95_put_var_3D_FourByteReal(ncid, varid, values, start, &
220       count_nc, stride, map, ncerr)
221
222    use netcdf, only: nf90_put_var
223    use handle_err_m, only: handle_err
224
225    integer,                         intent(in) :: ncid, varid
226    real, intent(in) :: values(:, :, :)
227    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
228    integer, intent(out), optional:: ncerr
229
230    ! Variable local to the procedure:
231    integer ncerr_not_opt
232
233    !-------------------
234
235    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
236         stride, map)
237    if (present(ncerr)) then
238       ncerr = ncerr_not_opt
239    else
240       call handle_err("nf95_put_var_3D_FourByteReal", ncerr_not_opt, ncid, &
241            varid)
242    end if
243
244  end subroutine nf95_put_var_3D_FourByteReal
245
246  !***********************
247
248  subroutine nf95_put_var_3D_EightByteReal(ncid, varid, values, start, &
249       count_nc, stride, map, ncerr)
250
251    use typesizes, only: eightByteReal
252    use netcdf, only: nf90_put_var
253    use handle_err_m, only: handle_err
254
255    integer,                         intent(in) :: ncid, varid
256    real (kind = EightByteReal),     intent(in) :: values(:, :, :)
257    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
258    integer, intent(out), optional:: ncerr
259
260    ! Variable local to the procedure:
261    integer ncerr_not_opt
262
263    !-------------------
264
265    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
266         stride, map)
267    if (present(ncerr)) then
268       ncerr = ncerr_not_opt
269    else
270       call handle_err("nf95_put_var_3D_eightByteReal", ncerr_not_opt, ncid, &
271            varid)
272    end if
273
274  end subroutine nf95_put_var_3D_EightByteReal
275
276  !***********************
277
278  subroutine nf95_put_var_4D_FourByteReal(ncid, varid, values, start, &
279       count_nc, stride, map, ncerr)
280
281    use netcdf, only: nf90_put_var
282    use handle_err_m, only: handle_err
283
284    integer,                         intent(in) :: ncid, varid
285    real, intent(in) :: values(:, :, :, :)
286    integer, dimension(:), optional, intent(in) :: start, count_nc, stride, map
287    integer, intent(out), optional:: ncerr
288
289    ! Variable local to the procedure:
290    integer ncerr_not_opt
291
292    !-------------------
293
294    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
295         stride, map)
296    if (present(ncerr)) then
297       ncerr = ncerr_not_opt
298    else
299       call handle_err("nf95_put_var_4D_FourByteReal", ncerr_not_opt, ncid, &
300            varid)
301    end if
302
303  end subroutine nf95_put_var_4D_FourByteReal
304
305  !***********************
306
307  subroutine nf95_put_var_4D_EightByteReal(ncid, varid, values, start, &
308       count_nc, stride, map, ncerr)
309
310    use typesizes, only: EightByteReal
311    use netcdf, only: nf90_put_var
312    use handle_err_m, only: handle_err
313
314    integer, intent(in):: ncid, varid
315    real(kind = EightByteReal), intent(in):: values(:, :, :, :)
316    integer, dimension(:), optional, intent(in):: start, count_nc, stride, map
317    integer, intent(out), optional:: ncerr
318
319    ! Variable local to the procedure:
320    integer ncerr_not_opt
321
322    !-------------------
323
324    ncerr_not_opt = nf90_put_var(ncid, varid, values, start, count_nc, &
325         stride, map)
326    if (present(ncerr)) then
327       ncerr = ncerr_not_opt
328    else
329       call handle_err("nf95_put_var_4D_EightByteReal", ncerr_not_opt, ncid, &
330            varid)
331    end if
332
333  end subroutine nf95_put_var_4D_EightByteReal
334
335end module nf95_put_var_m
Note: See TracBrowser for help on using the repository browser.