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