FMS  2024.03
Flexible Modeling System
compressed_read.inc
1 !***********************************************************************
2 !* GNU Lesser General Public License
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* FMS is free software: you can redistribute it and/or modify it under
7 !* the terms of the GNU Lesser General Public License as published by
8 !* the Free Software Foundation, either version 3 of the License, or (at
9 !* your option) any later version.
10 !*
11 !* FMS is distributed in the hope that it will be useful, but WITHOUT
12 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 !* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 !* for more details.
15 !*
16 !* You should have received a copy of the GNU Lesser General Public
17 !* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
18 !***********************************************************************
19 !> @file
20 !> @brief Compressed read routines for @ref read_data interface
21 
22 !> @addtogroup fms2_io_mod
23 !> @{
24 
25 !> @brief I/O domain reads in data from the netcdf file and broadcasts the
26 !! data to the rest of the ranks. This routine may only be used with
27 !! variables that are "compressed".
28 subroutine compressed_read_0d(fileobj, variable_name, cdata, unlim_dim_level, &
29  corner)
30 
31  type(fmsnetcdffile_t), intent(in) :: fileobj !< File object.
32  character(len=*), intent(in) :: variable_name !< Variable name.
33  class(*), intent(inout) :: cdata !< Buffer where the
34  !! read in data will
35  !! be stored.
36  integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited
37  !! dimension.
38  integer, intent(in), optional :: corner !< Array of starting
39  !! indices describing
40  !! where the data
41  !! will be written to.
42 
43 
44  call netcdf_read_data(fileobj, variable_name, cdata, &
45  unlim_dim_level=unlim_dim_level, corner=corner, &
46  broadcast=.true.)
47 end subroutine compressed_read_0d
48 
49 
50 !> @brief I/O domain reads in data from the netcdf file and broadcasts the
51 !! data to the rest of the ranks. This routine may only be used with
52 !! variables that are "compressed".
53 subroutine compressed_read_1d(fileobj, variable_name, cdata, unlim_dim_level, &
54  corner, edge_lengths)
55 
56  type(fmsnetcdffile_t), intent(in) :: fileobj !< File object.
57  character(len=*), intent(in) :: variable_name !< Variable name.
58  class(*), dimension(:), intent(inout) :: cdata !< Buffer where the
59  !! read in data will
60  !! be stored.
61  integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited
62  !! dimension.
63  integer, dimension(:), intent(in), optional :: corner !< Array of starting
64  !! indices describing
65  !! where the data
66  !! will be written to.
67  integer, dimension(:), intent(in), optional :: edge_lengths !< The number of
68  !! elements that
69  !! will be written
70  !! in each dimension.
71 
72  call netcdf_read_data(fileobj, variable_name, cdata, &
73  unlim_dim_level=unlim_dim_level, corner=corner, &
74  edge_lengths=edge_lengths, broadcast=.true.)
75 end subroutine compressed_read_1d
76 
77 
78 !> @brief I/O domain reads in data from the netcdf file and broadcasts the
79 !! data to the rest of the ranks. This routine may only be used with
80 !! variables that are "compressed".
81 subroutine compressed_read_2d(fileobj, variable_name, cdata, unlim_dim_level, &
82  corner, edge_lengths)
83 
84  type(fmsnetcdffile_t), intent(in) :: fileobj !< File object.
85  character(len=*), intent(in) :: variable_name !< Variable name.
86  class(*), dimension(:,:), intent(inout) :: cdata !< Buffer where the
87  !! read in data will
88  !! be stored.
89  integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited
90  !! dimension.
91  integer, dimension(:), intent(in), optional :: corner !< Array of starting
92  !! indices describing
93  !! where the data
94  !! will be written to.
95  integer, dimension(:), intent(in), optional :: edge_lengths !< The number of
96  !! elements that
97  !! will be written
98  !! in each dimension.
99 
100  call netcdf_read_data(fileobj, variable_name, cdata, &
101  unlim_dim_level=unlim_dim_level, corner=corner, &
102  edge_lengths=edge_lengths, broadcast=.true.)
103 end subroutine compressed_read_2d
104 
105 
106 !> @brief I/O domain reads in data from the netcdf file and broadcasts the
107 !! data to the rest of the ranks. This routine may only be used with
108 !! variables that are "compressed".
109 subroutine compressed_read_3d(fileobj, variable_name, cdata, unlim_dim_level, &
110  corner, edge_lengths)
111 
112  type(fmsnetcdffile_t), intent(in) :: fileobj !< File object.
113  character(len=*), intent(in) :: variable_name !< Variable name.
114  class(*), dimension(:,:,:), intent(inout) :: cdata !< Buffer where the
115  !! read in data will
116  !! be stored.
117  integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited
118  !! dimension.
119  integer, dimension(:), intent(in), optional :: corner !< Array of starting
120  !! indices describing
121  !! where the data
122  !! will be written to.
123  integer, dimension(:), intent(in), optional :: edge_lengths !< The number of
124  !! elements that
125  !! will be written
126  !! in each dimension.
127 
128  call netcdf_read_data(fileobj, variable_name, cdata, &
129  unlim_dim_level=unlim_dim_level, corner=corner, &
130  edge_lengths=edge_lengths, broadcast=.true.)
131 end subroutine compressed_read_3d
132 
133 
134 !> @brief I/O domain reads in data from the netcdf file and broadcasts the
135 !! data to the rest of the ranks. This routine may only be used with
136 !! variables that are "compressed".
137 subroutine compressed_read_4d(fileobj, variable_name, cdata, unlim_dim_level, &
138  corner, edge_lengths)
139 
140  type(fmsnetcdffile_t), intent(in) :: fileobj !< File object.
141  character(len=*), intent(in) :: variable_name !< Variable name.
142  class(*), dimension(:,:,:,:), intent(inout) :: cdata !< Buffer where the
143  !! read in data will
144  !! be stored.
145  integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited
146  !! dimension.
147  integer, dimension(:), intent(in), optional :: corner !< Array of starting
148  !! indices describing
149  !! where the data
150  !! will be written to.
151  integer, dimension(:), intent(in), optional :: edge_lengths !< The number of
152  !! elements that
153  !! will be written
154  !! in each dimension.
155 
156  call netcdf_read_data(fileobj, variable_name, cdata, &
157  unlim_dim_level=unlim_dim_level, corner=corner, &
158  edge_lengths=edge_lengths, broadcast=.true.)
159 end subroutine compressed_read_4d
160 
161 
162 !> @brief I/O domain reads in data from the netcdf file and broadcasts the
163 !! data to the rest of the ranks. This routine may only be used with
164 !! variables that are "compressed".
165 subroutine compressed_read_5d(fileobj, variable_name, cdata, unlim_dim_level, &
166  corner, edge_lengths)
167 
168  type(fmsnetcdffile_t), intent(in) :: fileobj !< File object.
169  character(len=*), intent(in) :: variable_name !< Variable name.
170  class(*), dimension(:,:,:,:,:), intent(inout) :: cdata !< Buffer where the
171  !! read in data will
172  !! be stored.
173  integer, intent(in), optional :: unlim_dim_level !< Level for the unlimited
174  !! dimension.
175  integer, dimension(:), intent(in), optional :: corner !< Array of starting
176  !! indices describing
177  !! where the data
178  !! will be written to.
179  integer, dimension(:), intent(in), optional :: edge_lengths !< The number of
180  !! elements that
181  !! will be written
182  !! in each dimension.
183 
184  call netcdf_read_data(fileobj, variable_name, cdata, &
185  unlim_dim_level=unlim_dim_level, corner=corner &
186  ,edge_lengths=edge_lengths &
187  ,broadcast=.true.)
188 end subroutine compressed_read_5d
189 !> @}
subroutine compressed_read_0d(fileobj, variable_name, cdata, unlim_dim_level, corner)
I/O domain reads in data from the netcdf file and broadcasts the data to the rest of the ranks....
subroutine compressed_read_5d(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
I/O domain reads in data from the netcdf file and broadcasts the data to the rest of the ranks....
subroutine compressed_read_3d(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
I/O domain reads in data from the netcdf file and broadcasts the data to the rest of the ranks....
subroutine compressed_read_1d(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
I/O domain reads in data from the netcdf file and broadcasts the data to the rest of the ranks....
subroutine compressed_read_2d(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
I/O domain reads in data from the netcdf file and broadcasts the data to the rest of the ranks....
subroutine compressed_read_4d(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
I/O domain reads in data from the netcdf file and broadcasts the data to the rest of the ranks....