1 | !********************************************************************** |
---|
2 | ! Copyright 2016 * |
---|
3 | ! Andreas Stohl, Massimo Cassiani, Petra Seibert, A. Frank, * |
---|
4 | ! Gerhard Wotawa, Caroline Forster, Sabine Eckhardt, John Burkhart, * |
---|
5 | ! Harald Sodemann * |
---|
6 | ! * |
---|
7 | ! This file is part of FLEXPART-NorESM * |
---|
8 | ! * |
---|
9 | ! FLEXPART-NorESM is free software: you can redistribute it * |
---|
10 | ! and/or modify * |
---|
11 | ! it under the terms of the GNU General Public License as published by* |
---|
12 | ! the Free Software Foundation, either version 3 of the License, or * |
---|
13 | ! (at your option) any later version. * |
---|
14 | ! * |
---|
15 | ! FLEXPART-NorESM is distributed in the hope that it will be useful, * |
---|
16 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
17 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
18 | ! GNU General Public License for more details. * |
---|
19 | ! * |
---|
20 | ! You should have received a copy of the GNU General Public License * |
---|
21 | ! along with FLEXPART-NorESM. * |
---|
22 | ! If not, see <http://www.gnu.org/licenses/>. * |
---|
23 | !********************************************************************** |
---|
24 | |
---|
25 | subroutine allocatedumarray(ndims,lendim_exp,maxdim,vartype) |
---|
26 | |
---|
27 | !***************************************************************************** |
---|
28 | ! * |
---|
29 | ! This routine allocate temporary variables for reading netcdf input * |
---|
30 | ! files from NorESM * |
---|
31 | ! * |
---|
32 | ! Author: * |
---|
33 | ! M. Cassiani 2016 * |
---|
34 | ! * |
---|
35 | ! * |
---|
36 | !***************************************************************************** |
---|
37 | ! * |
---|
38 | ! Variables: * |
---|
39 | ! vartype type of variable * |
---|
40 | ! ndims number of dimensions 0,1,2,3 * |
---|
41 | ! lendim_exp expeceted elemnts in the dimension * |
---|
42 | ! vartype * |
---|
43 | ! Constants: * |
---|
44 | ! * |
---|
45 | !***************************************************************************** |
---|
46 | |
---|
47 | use noresm_variables |
---|
48 | implicit none |
---|
49 | include 'netcdf.inc' |
---|
50 | integer ndims,lendim_exp(maxdim),maxdim,vartype |
---|
51 | |
---|
52 | if (vartype.eq.nf_double) then |
---|
53 | if (ndims.eq.0) then |
---|
54 | dumvar=dble(0.0) |
---|
55 | |
---|
56 | else if (ndims.eq.1) then |
---|
57 | call allocatedumarray1D(ndims,lendim_exp,maxdim) |
---|
58 | else if (ndims.eq.2) then |
---|
59 | call allocatedumarray2D(ndims,lendim_exp,maxdim) |
---|
60 | else if (ndims.eq.3) then |
---|
61 | call allocatedumarray3D(ndims,lendim_exp,maxdim) |
---|
62 | else if (ndims.eq.4) then |
---|
63 | call allocatedumarray4D(ndims,lendim_exp,maxdim) |
---|
64 | end if |
---|
65 | |
---|
66 | else if (vartype.eq.nf_float) then |
---|
67 | if (ndims.eq.0) then |
---|
68 | dumvar_real=0.0 |
---|
69 | else if (ndims.eq.1) then |
---|
70 | call allocatedumarray1D_real(ndims,lendim_exp,maxdim) |
---|
71 | else if (ndims.eq.2) then |
---|
72 | call allocatedumarray2D_real(ndims,lendim_exp,maxdim) |
---|
73 | else if (ndims.eq.3) then |
---|
74 | call allocatedumarray3D_real(ndims,lendim_exp,maxdim) |
---|
75 | else if (ndims.eq.4) then |
---|
76 | call allocatedumarray4D_real(ndims,lendim_exp,maxdim) |
---|
77 | end if |
---|
78 | |
---|
79 | else if (vartype.eq.nf_int) then |
---|
80 | if (ndims.eq.0) then |
---|
81 | dumvar_int=0.0 |
---|
82 | else if (ndims.eq.1) then |
---|
83 | call allocatedumarray1D_int(ndims,lendim_exp,maxdim) |
---|
84 | else if (ndims.eq.2) then |
---|
85 | call allocatedumarray2D_int(ndims,lendim_exp,maxdim) |
---|
86 | else if (ndims.eq.3) then |
---|
87 | call allocatedumarray3D_int(ndims,lendim_exp,maxdim) |
---|
88 | !else if (ndims.eq.4) then |
---|
89 | ! call allocatedumarray4D_int(ndims,lendim_exp,maxdim) |
---|
90 | end if |
---|
91 | |
---|
92 | else if (vartype.eq.nf_char) then |
---|
93 | if (ndims.eq.1) then |
---|
94 | call allocatedumarray1D_char(ndims,lendim_exp,maxdim) |
---|
95 | else if (ndims.eq.2) then |
---|
96 | call allocatedumarray2D_char(ndims,lendim_exp,maxdim) |
---|
97 | end if |
---|
98 | end if |
---|
99 | return |
---|
100 | end |
---|