V3FIT
ezspline_2netcdf.f90
1 !/////
2 ! R8 !
3 !/////
4  subroutine ezspline_2netcdf_array3_r8(n1, n2, n3, x1, x2, x3, f, filename, ier)
5  use ezspline_obj
6  use ezcdf
7  implicit none
8  integer, intent(in) :: n1, n2, n3
9  real(ezspline_r8), intent(in) :: x1(:), x2(:), x3(:), f(:, :, :)
10  character*(*), intent(in) :: filename
11  integer, intent(out) :: ier
12  integer ifail
13 
14  integer dimlens(3), ncid
15 
16  ier = 0
17  call cdfopn(ncid, filename, 'w')
18  if(ncid==0) then
19  ier = 34
20  return
21  endif
22  dimlens = (/ 1, 1, 1 /)
23  call cdfdefvar(ncid, 'n1', dimlens, 'INT', ifail)
24  call cdfdefvar(ncid, 'n2', dimlens, 'INT', ifail)
25  call cdfdefvar(ncid, 'n3', dimlens, 'INT', ifail)
26  dimlens = (/ n1, 1, 1 /)
27  call cdfdefvar(ncid, 'x1', dimlens, 'R8', ifail)
28  dimlens = (/ n2, 1, 1 /)
29  call cdfdefvar(ncid, 'x2', dimlens, 'R8', ifail)
30  dimlens = (/ n3, 1, 1 /)
31  call cdfdefvar(ncid, 'x3', dimlens, 'R8', ifail)
32  dimlens = (/ n1, n2, n3 /)
33  call cdfdefvar(ncid, 'f', dimlens, 'R8', ifail)
34  if(ifail/=0) then
35  ier = 38
36  return
37  endif
38  call cdfputvar(ncid, 'n1', n1, ifail)
39  call cdfputvar(ncid, 'n2', n2, ifail)
40  call cdfputvar(ncid, 'n3', n3, ifail)
41  call cdfputvar(ncid, 'x1', x1, ifail)
42  call cdfputvar(ncid, 'x2', x2, ifail)
43  call cdfputvar(ncid, 'x3', x3, ifail)
44  call cdfputvar(ncid, 'f', f, ifail)
45  if(ifail/=0) then
46  ier = 35
47  return
48  endif
49 
50  call cdfcls(ncid)
51 
52  end subroutine ezspline_2netcdf_array3_r8
53 
54  subroutine ezspline_2netcdf_array2_r8(n1, n2, x1, x2, f, filename, ier)
55  use ezspline_obj
56  use ezcdf
57  implicit none
58  integer, intent(in) :: n1, n2
59  real(ezspline_r8), intent(in) :: x1(:), x2(:), f(:,:)
60  character*(*), intent(in) :: filename
61  integer, intent(out) :: ier
62  integer ifail
63 
64  integer dimlens(3), ncid
65 
66  ier = 0
67  call cdfopn(ncid, filename, 'w')
68  if(ncid==0) then
69  ier = 34
70  return
71  endif
72  dimlens = (/ 1, 1, 1 /)
73  call cdfdefvar(ncid, 'n1', dimlens, 'INT', ifail)
74  call cdfdefvar(ncid, 'n2', dimlens, 'INT', ifail)
75  dimlens = (/ n1, 1, 1 /)
76  call cdfdefvar(ncid, 'x1', dimlens, 'R8', ifail)
77  dimlens = (/ n2, 1, 1 /)
78  call cdfdefvar(ncid, 'x2', dimlens, 'R8', ifail)
79  dimlens = (/ n1, n2, 1 /)
80  call cdfdefvar(ncid, 'f', dimlens, 'R8', ifail)
81  if(ifail/=0) then
82  ier = 38
83  return
84  endif
85 
86  call cdfputvar(ncid, 'n1', n1, ifail)
87  call cdfputvar(ncid, 'n2', n2, ifail)
88  call cdfputvar(ncid, 'x1', x1, ifail)
89  call cdfputvar(ncid, 'x2', x2, ifail)
90  call cdfputvar(ncid, 'f', f, ifail)
91  if(ifail/=0) then
92  ier = 35
93  return
94  endif
95 
96  call cdfcls(ncid)
97 
98  end subroutine ezspline_2netcdf_array2_r8
99 
100  subroutine ezspline_2netcdf1_r8(n1, x1, f, filename, ier)
101  use ezspline_obj
102  use ezcdf
103  implicit none
104  integer, intent(in) :: n1
105  real(ezspline_r8), intent(in) :: x1(:), f(:)
106  character*(*), intent(in) :: filename
107  integer, intent(out) :: ier
108  integer ifail
109 
110  integer dimlens(3), ncid
111 
112  ier = 0
113  call cdfopn(ncid, filename, 'w')
114  if(ncid==0) then
115  ier = 34
116  return
117  endif
118  dimlens = (/ 1, 1, 1 /)
119  call cdfdefvar(ncid, 'n1', dimlens, 'INT', ifail)
120  dimlens = (/ n1, 1, 1 /)
121  call cdfdefvar(ncid, 'x1', dimlens, 'R8', ifail)
122  dimlens = (/ n1, 1, 1 /)
123  call cdfdefvar(ncid, 'f', dimlens, 'R8', ifail)
124  if(ifail/=0) then
125  ier = 38
126  return
127  endif
128 
129  call cdfputvar(ncid, 'n1', n1, ifail)
130  call cdfputvar(ncid, 'x1', x1, ifail)
131  call cdfputvar(ncid, 'f', f, ifail)
132  if(ifail/=0) then
133  ier = 35
134  return
135  endif
136 
137  call cdfcls(ncid)
138 
139  end subroutine ezspline_2netcdf1_r8
140 
141  subroutine ezspline_2netcdf_cloud3_r8(n, x1, x2, x3, f, filename, ier)
142  use ezspline_obj
143  use ezcdf
144  implicit none
145  integer, intent(in) :: n
146  real(ezspline_r8), intent(in) :: x1(:), x2(:), x3(:), f(:)
147  character*(*), intent(in) :: filename
148  integer, intent(out) :: ier
149  integer ifail
150 
151  integer dimlens(3), ncid
152 
153  ier = 0
154  call cdfopn(ncid, filename, 'w')
155  if(ncid==0) then
156  ier = 34
157  return
158  endif
159  dimlens = (/ 1, 1, 1 /)
160  call cdfdefvar(ncid, 'n', dimlens, 'INT', ifail)
161  dimlens = (/ n, 1, 1 /)
162  call cdfdefvar(ncid, 'x1', dimlens, 'R8', ifail)
163  dimlens = (/ n, 1, 1 /)
164  call cdfdefvar(ncid, 'x2', dimlens, 'R8', ifail)
165  dimlens = (/ n, 1, 1 /)
166  call cdfdefvar(ncid, 'x3', dimlens, 'R8', ifail)
167  dimlens = (/ n, 1, 1 /)
168  call cdfdefvar(ncid, 'f', dimlens, 'R8', ifail)
169  if(ifail/=0) then
170  ier = 38
171  return
172  endif
173 
174  call cdfputvar(ncid, 'n', n, ifail)
175  call cdfputvar(ncid, 'x1', x1, ifail)
176  call cdfputvar(ncid, 'x2', x2, ifail)
177  call cdfputvar(ncid, 'x3', x3, ifail)
178  call cdfputvar(ncid, 'f', f, ifail)
179  if(ifail/=0) then
180  ier = 35
181  return
182  endif
183 
184  call cdfcls(ncid)
185 
186  end subroutine ezspline_2netcdf_cloud3_r8
187 
188  subroutine ezspline_2netcdf_cloud2_r8(n, x1, x2, f, filename, ier)
189  use ezspline_obj
190  use ezcdf
191  implicit none
192  integer, intent(in) :: n
193  real(ezspline_r8), intent(in) :: x1(:), x2(:), f(:)
194  character*(*), intent(in) :: filename
195  integer, intent(out) :: ier
196  integer ifail
197 
198  integer dimlens(3), ncid
199 
200  ier = 0
201  call cdfopn(ncid, filename, 'w')
202  if(ncid==0) then
203  ier = 34
204  return
205  endif
206  dimlens = (/ 1, 1, 1 /)
207  call cdfdefvar(ncid, 'n', dimlens, 'INT', ifail)
208  dimlens = (/ n, 1, 1 /)
209  call cdfdefvar(ncid, 'x1', dimlens, 'R8', ifail)
210  dimlens = (/ n, 1, 1 /)
211  call cdfdefvar(ncid, 'x2', dimlens, 'R8', ifail)
212  dimlens = (/ n, 1, 1 /)
213  call cdfdefvar(ncid, 'f', dimlens, 'R8', ifail)
214  if(ifail/=0) then
215  ier = 38
216  return
217  endif
218 
219  call cdfputvar(ncid, 'n', n, ifail)
220  call cdfputvar(ncid, 'x1', x1, ifail)
221  call cdfputvar(ncid, 'x2', x2, ifail)
222  call cdfputvar(ncid, 'f', f, ifail)
223  if(ifail/=0) then
224  ier = 35
225  return
226  endif
227 
228  call cdfcls(ncid)
229 
230  end subroutine ezspline_2netcdf_cloud2_r8
231 !/////
232 ! R4 !
233 !/////
234  subroutine ezspline_2netcdf_array3_r4(n1, n2, n3, x1, x2, x3, f, filename, ier)
235  use ezspline_obj
236  use ezcdf
237  implicit none
238  integer, intent(in) :: n1, n2, n3
239  real(ezspline_r4), intent(in) :: x1(:), x2(:), x3(:), f(:, :, :)
240  character*(*), intent(in) :: filename
241  integer, intent(out) :: ier
242  integer ifail
243 
244  integer dimlens(3), ncid
245 
246  ier = 0
247  call cdfopn(ncid, filename, 'w')
248  if(ncid==0) then
249  ier = 34
250  return
251  endif
252  dimlens = (/ 1, 1, 1 /)
253  call cdfdefvar(ncid, 'n1', dimlens, 'INT', ifail)
254  call cdfdefvar(ncid, 'n2', dimlens, 'INT', ifail)
255  call cdfdefvar(ncid, 'n3', dimlens, 'INT', ifail)
256  dimlens = (/ n1, 1, 1 /)
257  call cdfdefvar(ncid, 'x1', dimlens, 'R4', ifail)
258  dimlens = (/ n2, 1, 1 /)
259  call cdfdefvar(ncid, 'x2', dimlens, 'R4', ifail)
260  dimlens = (/ n3, 1, 1 /)
261  call cdfdefvar(ncid, 'x3', dimlens, 'R4', ifail)
262  dimlens = (/ n1, n2, n3 /)
263  call cdfdefvar(ncid, 'f', dimlens, 'R4', ifail)
264  if(ifail/=0) then
265  ier = 38
266  return
267  endif
268  call cdfputvar(ncid, 'n1', n1, ifail)
269  call cdfputvar(ncid, 'n2', n2, ifail)
270  call cdfputvar(ncid, 'n3', n3, ifail)
271  call cdfputvar(ncid, 'x1', x1, ifail)
272  call cdfputvar(ncid, 'x2', x2, ifail)
273  call cdfputvar(ncid, 'x3', x3, ifail)
274  call cdfputvar(ncid, 'f', f, ifail)
275  if(ifail/=0) then
276  ier = 35
277  return
278  endif
279 
280  call cdfcls(ncid)
281 
282  end subroutine ezspline_2netcdf_array3_r4
283 
284  subroutine ezspline_2netcdf_array2_r4(n1, n2, x1, x2, f, filename, ier)
285  use ezspline_obj
286  use ezcdf
287  implicit none
288  integer, intent(in) :: n1, n2
289  real(ezspline_r4), intent(in) :: x1(:), x2(:), f(:,:)
290  character*(*), intent(in) :: filename
291  integer, intent(out) :: ier
292  integer ifail
293 
294  integer dimlens(3), ncid
295 
296  ier = 0
297  call cdfopn(ncid, filename, 'w')
298  if(ncid==0) then
299  ier = 34
300  return
301  endif
302  dimlens = (/ 1, 1, 1 /)
303  call cdfdefvar(ncid, 'n1', dimlens, 'INT', ifail)
304  call cdfdefvar(ncid, 'n2', dimlens, 'INT', ifail)
305  dimlens = (/ n1, 1, 1 /)
306  call cdfdefvar(ncid, 'x1', dimlens, 'R4', ifail)
307  dimlens = (/ n2, 1, 1 /)
308  call cdfdefvar(ncid, 'x2', dimlens, 'R4', ifail)
309  dimlens = (/ n1, n2, 1 /)
310  call cdfdefvar(ncid, 'f', dimlens, 'R4', ifail)
311  if(ifail/=0) then
312  ier = 38
313  return
314  endif
315 
316  call cdfputvar(ncid, 'n1', n1, ifail)
317  call cdfputvar(ncid, 'n2', n2, ifail)
318  call cdfputvar(ncid, 'x1', x1, ifail)
319  call cdfputvar(ncid, 'x2', x2, ifail)
320  call cdfputvar(ncid, 'f', f, ifail)
321  if(ifail/=0) then
322  ier = 35
323  return
324  endif
325 
326  call cdfcls(ncid)
327 
328  end subroutine ezspline_2netcdf_array2_r4
329 
330  subroutine ezspline_2netcdf1_r4(n1, x1, f, filename, ier)
331  use ezspline_obj
332  use ezcdf
333  implicit none
334  integer, intent(in) :: n1
335  real(ezspline_r4), intent(in) :: x1(:), f(:)
336  character*(*), intent(in) :: filename
337  integer, intent(out) :: ier
338  integer ifail
339 
340  integer dimlens(3), ncid
341 
342  ier = 0
343  call cdfopn(ncid, filename, 'w')
344  if(ncid==0) then
345  ier = 34
346  return
347  endif
348  dimlens = (/ 1, 1, 1 /)
349  call cdfdefvar(ncid, 'n1', dimlens, 'INT', ifail)
350  dimlens = (/ n1, 1, 1 /)
351  call cdfdefvar(ncid, 'x1', dimlens, 'R4', ifail)
352  dimlens = (/ n1, 1, 1 /)
353  call cdfdefvar(ncid, 'f', dimlens, 'R4', ifail)
354  if(ifail/=0) then
355  ier = 38
356  return
357  endif
358 
359  call cdfputvar(ncid, 'n1', n1, ifail)
360  call cdfputvar(ncid, 'x1', x1, ifail)
361  call cdfputvar(ncid, 'f', f, ifail)
362  if(ifail/=0) then
363  ier = 35
364  return
365  endif
366 
367  call cdfcls(ncid)
368 
369  end subroutine ezspline_2netcdf1_r4
370 
371  subroutine ezspline_2netcdf_cloud3_r4(n, x1, x2, x3, f, filename, ier)
372  use ezspline_obj
373  use ezcdf
374  implicit none
375  integer, intent(in) :: n
376  real(ezspline_r4), intent(in) :: x1(:), x2(:), x3(:), f(:)
377  character*(*), intent(in) :: filename
378  integer, intent(out) :: ier
379  integer ifail
380 
381  integer dimlens(3), ncid
382 
383  ier = 0
384  call cdfopn(ncid, filename, 'w')
385  if(ncid==0) then
386  ier = 34
387  return
388  endif
389  dimlens = (/ 1, 1, 1 /)
390  call cdfdefvar(ncid, 'n', dimlens, 'INT', ifail)
391  dimlens = (/ n, 1, 1 /)
392  call cdfdefvar(ncid, 'x1', dimlens, 'R4', ifail)
393  dimlens = (/ n, 1, 1 /)
394  call cdfdefvar(ncid, 'x2', dimlens, 'R4', ifail)
395  dimlens = (/ n, 1, 1 /)
396  call cdfdefvar(ncid, 'x3', dimlens, 'R4', ifail)
397  dimlens = (/ n, 1, 1 /)
398  call cdfdefvar(ncid, 'f', dimlens, 'R4', ifail)
399  if(ifail/=0) then
400  ier = 38
401  return
402  endif
403 
404  call cdfputvar(ncid, 'n', n, ifail)
405  call cdfputvar(ncid, 'x1', x1, ifail)
406  call cdfputvar(ncid, 'x2', x2, ifail)
407  call cdfputvar(ncid, 'x3', x3, ifail)
408  call cdfputvar(ncid, 'f', f, ifail)
409  if(ifail/=0) then
410  ier = 35
411  return
412  endif
413 
414  call cdfcls(ncid)
415 
416  end subroutine ezspline_2netcdf_cloud3_r4
417 
418  subroutine ezspline_2netcdf_cloud2_r4(n, x1, x2, f, filename, ier)
419  use ezspline_obj
420  use ezcdf
421  implicit none
422  integer, intent(in) :: n
423  real(ezspline_r4), intent(in) :: x1(:), x2(:), f(:)
424  character*(*), intent(in) :: filename
425  integer, intent(out) :: ier
426  integer ifail
427 
428  integer dimlens(3), ncid
429 
430  ier = 0
431  call cdfopn(ncid, filename, 'w')
432  if(ncid==0) then
433  ier = 34
434  return
435  endif
436  dimlens = (/ 1, 1, 1 /)
437  call cdfdefvar(ncid, 'n', dimlens, 'INT', ifail)
438  dimlens = (/ n, 1, 1 /)
439  call cdfdefvar(ncid, 'x1', dimlens, 'R4', ifail)
440  dimlens = (/ n, 1, 1 /)
441  call cdfdefvar(ncid, 'x2', dimlens, 'R4', ifail)
442  dimlens = (/ n, 1, 1 /)
443  call cdfdefvar(ncid, 'f', dimlens, 'R4', ifail)
444  if(ifail/=0) then
445  ier = 38
446  return
447  endif
448 
449  call cdfputvar(ncid, 'n', n, ifail)
450  call cdfputvar(ncid, 'x1', x1, ifail)
451  call cdfputvar(ncid, 'x2', x2, ifail)
452  call cdfputvar(ncid, 'f', f, ifail)
453  if(ifail/=0) then
454  ier = 35
455  return
456  endif
457 
458  call cdfcls(ncid)
459 
460  end subroutine ezspline_2netcdf_cloud2_r4