FMS  2025.04
Flexible Modeling System
fms2_io.F90
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 !> @defgroup fms2_io_mod fms2_io_mod
19 !> @ingroup fms2_io
20 !> @brief An updated library for parallel IO to replace @ref mpp_io_mod. This module contains
21 !! the public API for fms2 I/O interfaces and routines defined throughout this directory.
22 !! A conversion guide for replacing mpp/fms_io code with this module is available below.
23 
24 !> @addtogroup fms2_io_mod
25 !> @{
26 module fms2_io_mod
27 use fms_io_utils_mod
28 use netcdf_io_mod
29 use fms_netcdf_domain_io_mod
30 use fms_netcdf_unstructured_domain_io_mod
31 use blackboxio
32 use mpp_mod, only: mpp_init, input_nml_file, mpp_error, fatal
33 use mpp_domains_mod, only: mpp_domains_init
34 implicit none
35 private
36 
37 public :: unlimited
38 public :: fmsnetcdffile_t
39 public :: fmsnetcdfdomainfile_t
41 public :: open_file
42 public :: open_virtual_file
43 public :: close_file
44 public :: register_axis
46 public :: register_field
47 public :: register_restart_field
48 public :: write_data
49 public :: read_data
50 public :: write_restart
51 public :: write_new_restart
52 public :: read_restart
53 public :: read_new_restart
54 public :: global_att_exists
55 public :: variable_att_exists
58 public :: get_global_attribute
59 public :: get_variable_attribute
60 public :: get_num_dimensions
61 public :: get_dimension_names
62 public :: dimension_exists
63 public :: is_dimension_unlimited
64 public :: get_dimension_size
65 public :: get_num_variables
66 public :: get_variable_names
67 public :: variable_exists
70 public :: get_variable_size
73 public :: valid_t
74 public :: get_valid
75 public :: is_valid
78 public :: file_exists
80 public :: get_variable_sense
81 public :: get_variable_missing
82 public :: get_variable_units
83 public :: get_time_calendar
84 public :: open_check
86 public :: check_if_open
87 public :: set_fileobj_time_name
89 public :: fms2_io_init
90 public :: write_restart_bc
91 public :: read_restart_bc
92 public :: get_mosaic_tile_grid
93 public :: ascii_read
94 public :: get_mosaic_tile_file
95 public :: parse_mask_table
96 public :: get_filename_appendix
97 public :: set_filename_appendix
98 public :: get_instance_filename
100 public :: flush_file
101 !> @}
102 
103 !> @brief Opens a given netcdf or domain file.
104 !!
105 !> <br>Example usage:
106 !!
107 !! io_success = open_file(fileobj, "filename", "write")
108 !!
109 !! Opens a netcdf file of type @ref fmsnetcdffile_t at the given file path string.
110 !! File mode is set to one of "read"/"write"/"overwrite"/"append"
111 !!
112 !! io_success = open_file(fileobj, "filename", "overwrite", domain)
113 !!
114 !! Opens a domain netcdf file of type @ref fmsnetcdfdomainfile_t or
115 !! @ref fmsnetcdfunstructureddomainfile_t at the given file path name and 2D or unstructured domain.
116 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
117 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
118 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
119 !! For generic netcdf: @ref netcdf_io_mod.
120 !> @ingroup fms2_io_mod
121 interface open_file
122  module procedure netcdf_file_open_wrap
123  module procedure open_domain_file
124  module procedure open_unstructured_domain_file
125 end interface open_file
126 
127 
128 !> @brief Creates a diskless netcdf or domain file
129 !!
130 !> @return true if successful, false otherwise
131 !!
132 !> <br>Example usage:
133 !!
134 !! io_success = open_virtual_file(fileobj, "filename", pelist)
135 !!
136 !! Opens a virtual file through @ref fmsnetcdffile_t at an optional file path and pelist
137 !!
138 !! io_success = open_virtual_file(fileobj, domain, "filename")
139 !!
140 !! Opens a virtual domain file through @ref fmsnetcdfdomainfile_t or
141 !! @ref fmsnetcdfunstructureddomainfile_t for a given 2D domain at an optional path <br>
142 !!
143 !! @note For individual documentation on the listed routines, please see the appropriate helper module: @ref blackboxio
144 !> @ingroup fms2_io_mod
146  module procedure create_diskless_netcdf_file_wrap
147  module procedure create_diskless_domain_file
149 end interface open_virtual_file
150 
151 !> @brief Close a netcdf or domain file opened with @ref open_file or
152 !! @ref open_virtual_file
153 !!
154 !> <br>Example usage:
155 !!
156 !! call close_file(fileobj)
157 !!
158 !! Closes any given fileobj opened via @ref open_file or @ref open_virtual_file
159 !!
160 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
161 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
162 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
163 !! For generic netcdf: @ref netcdf_io_mod.
164 !> @ingroup fms2_io_mod
165 interface close_file
166  module procedure netcdf_file_close_wrap
167  module procedure close_domain_file
168  module procedure close_unstructured_domain_file
169 end interface close_file
170 
171 !> @brief Add a dimension to a given file
172 !!
173 !> <br>Example usage:
174 !!
175 !! call register_axis(fileobj, "lon", "x")
176 !!
177 !! Adds a dimension named "lon" associated with the x axis of the 2D domain file. For unstructured
178 !! domains no x or y axis character is provided.
179 !!
180 !! call register_axis(fileobj, "lon", n)
181 !!
182 !! Adds a dimension named "lon" with length n to a given netcdf file.<br>
183 !!
184 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
185 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
186 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
187 !! For generic netcdf: @ref netcdf_io_mod.
188 !> @ingroup fms2_io_mod
189 interface register_axis
190  module procedure netcdf_add_dimension
191  module procedure register_compressed_dimension
192  module procedure register_domain_decomposed_dimension
193  module procedure register_unstructured_dimension
194 end interface register_axis
195 
196 !> @brief Defines a new field within the given file
197 !> <br>Example usage:
198 !!
199 !! call register_field(fileobj, "lon", "double", (/"lon"/) )
200 !!
201 !! Adds a double variable named "lon" to the given file, corresponding to the
202 !! list of dimension names (which must be previously defined in the fileobj).
203 !! The size of dimension name list provided is the amount of ranks for the created
204 !! field, scalar if list not provided.
205 !!
206 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
207 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
208 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
209 !! For generic netcdf: @ref netcdf_io_mod.
210 !> @ingroup fms2_io_mod
211 interface register_field
212  module procedure netcdf_add_variable_wrap
213  module procedure register_domain_variable
215 end interface register_field
216 
217 !> @brief Similar to @ref register_field, but occupies the field with data for restarts
218 !> <br>Example usage:
219 !!
220 !! call register_restart_field(fileobj, "temperature", data_ptr, (/"lon", "time"/) )
221 !!
222 !! Creates a restart variable and sets it to the values from data_ptr, corresponding to
223 !! the list of dimension names. Rank of data_ptr must equal the amount of corresponding dimensions.
224 !!
225 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
226 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
227 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
228 !! For generic netcdf: @ref netcdf_io_mod.
229 !> @ingroup fms2_io_mod
231  module procedure netcdf_add_restart_variable_0d_wrap
232  module procedure netcdf_add_restart_variable_1d_wrap
233  module procedure netcdf_add_restart_variable_2d_wrap
234  module procedure netcdf_add_restart_variable_3d_wrap
235  module procedure netcdf_add_restart_variable_4d_wrap
236  module procedure netcdf_add_restart_variable_5d_wrap
237  module procedure register_domain_restart_variable_0d
238  module procedure register_domain_restart_variable_1d
239  module procedure register_domain_restart_variable_2d
240  module procedure register_domain_restart_variable_3d
241  module procedure register_domain_restart_variable_4d
242  module procedure register_domain_restart_variable_5d
249  module procedure register_restart_region_2d
250  module procedure register_restart_region_3d
251 end interface register_restart_field
252 
253 !> @brief Write data to a defined field within a file
254 !> <br>Example usage:
255 !!
256 !! call write_data(fileobj, "lon", data)
257 !!
258 !! Write the value(s) in data to the field named "lon"
259 !!
260 !> @ingroup fms2_io_mod
261 interface write_data
262  module procedure compressed_write_0d_wrap
263  module procedure compressed_write_1d_wrap
264  module procedure compressed_write_2d_wrap
265  module procedure compressed_write_3d_wrap
266  module procedure compressed_write_4d_wrap
267  module procedure compressed_write_5d_wrap
268  module procedure domain_write_0d
269  module procedure domain_write_1d
270  module procedure domain_write_2d
271  module procedure domain_write_3d
272  module procedure domain_write_4d
273  module procedure domain_write_5d
274  module procedure unstructured_domain_write_0d
275  module procedure unstructured_domain_write_1d
276  module procedure unstructured_domain_write_2d
277  module procedure unstructured_domain_write_3d
278  module procedure unstructured_domain_write_4d
279  module procedure unstructured_domain_write_5d
280 end interface write_data
281 
282 !> @brief Read data from a defined field in a file
283 !!
284 !> <br>Example usage:
285 !!
286 !! call read_data(fileobj, "lat", data)
287 !!
288 !! Read the values for the field "lat" from the file and write them onto data <br>
289 !!
290 !> @ingroup fms2_io_mod
291 interface read_data
292  module procedure compressed_read_0d
293  module procedure compressed_read_1d
294  module procedure compressed_read_2d
295  module procedure compressed_read_3d
296  module procedure compressed_read_4d
297  module procedure compressed_read_5d
298  module procedure domain_read_0d
299  module procedure domain_read_1d
300  module procedure domain_read_2d
301  module procedure domain_read_3d
302  module procedure domain_read_4d
303  module procedure domain_read_5d
304  module procedure unstructured_domain_read_0d
305  module procedure unstructured_domain_read_1d
306  module procedure unstructured_domain_read_2d
307  module procedure unstructured_domain_read_3d
308  module procedure unstructured_domain_read_4d
309  module procedure unstructured_domain_read_5d
310 end interface read_data
311 
312 !> @brief Writes all restart fields registered within a given restart file
313 !> <br>Example usage:
314 !!
315 !! call write_restart(fileobj)
316 !!
317 !! Writes previously registered restart fields to the given restart file
318 !!
319 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
320 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
321 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
322 !! For generic netcdf: @ref netcdf_io_mod.
323 !> @ingroup fms2_io_mod
324 interface write_restart
325  module procedure netcdf_save_restart_wrap
326  module procedure save_domain_restart
327  module procedure unstructured_write_restart
328 end interface write_restart
329 
330 !> @brief Writes all restart fields in a given restart file to a new restart file
331 !> <br>Example usage:
332 !!
333 !! call write_new_restart(fileobj, timestamp="tstring", filename="new_restartfilename")
334 !!
335 !! Creates a new restart file, with the provided timestamp and filename, out of the registered
336 !! restart fields in the given restart file.
337 !!
338 !! @note For individual documentation on the listed routines, please see the appropriate helper module: @ref blackboxio
339 !> @ingroup fms2_io_mod
341  module procedure netcdf_save_restart_wrap2
342  module procedure save_domain_restart_wrap
343  module procedure unstructured_write_restart_wrap
344 end interface write_new_restart
345 
346 !> @brief Reads in restart variables from a given file
347 !> <br>Example usage:
348 !! call read_restart(fileobj)
349 !! Reads registered restart variables from fileobj
350 !!
351 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
352 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
353 !! For generic netcdf: @ref netcdf_io_mod.
354 !> @ingroup fms2_io_mod
355 interface read_restart
356  module procedure netcdf_restore_state
357  module procedure restore_domain_state
358 end interface read_restart
359 
360 !> @brief Read registered restarts from a new file
361 !! Optionally takes directory to write to, model time and filename
362 !> <br>Example usage:
363 !! call read_new_restart(fileobj, unlimted_dimension_level)
364 !!
365 !! call read_new_restart(fileobj, unlimited_dimension_level, directory, timestamp, filename)
366 !! @note For individual documentation on the listed routines, please see the appropriate helper module: @ref blackboxio
367 !> @ingroup fms2_io_mod
369  module procedure netcdf_restore_state_wrap
370  module procedure restore_domain_state_wrap
371 end interface read_new_restart
372 
373 !> @addtogroup fms2_io_mod
374 !> @{
375 
376 logical, private :: fms2_io_is_initialized = .false. !< True after fms2_io_init is run
377 ! Namelist variables
378 integer :: ncchksz = 64*1024 !< User defined chunksize (in bytes) argument in netcdf file
379  !! creation calls. Replaces setting the NC_CHKSZ environment variable.
380 character (len = 10) :: netcdf_default_format = "64bit" !< User defined netcdf file format, acceptable values
381  !! are: "64bit", "classic", "netcdf4". This can be overwritten if you specify
382  !! "nc_format" in the open_file call
383 integer :: header_buffer_val = 16384 !< Use defined netCDF header buffer size(in bytes) used in
384  !! NF__ENDDEF
385 integer :: deflate_level = default_deflate_level !< Netcdf deflate level to use in nf90_def_var
386  !! (integer between 1 to 9)
387 logical :: shuffle = .false. !< Flag indicating whether to use the netcdf shuffle filter
388 namelist / fms2_io_nml / &
390 
391 contains
392 
393 !> @brief Reads the fms2_io_nml
394 subroutine fms2_io_init ()
395  integer :: mystat
396 
397 !> Check if the module has already been initialized
398  if (fms2_io_is_initialized) return
399 !> Call initialization routines that this module depends on
400  call mpp_init()
401  call mpp_domains_init()
402 !> Read the namelist
403  READ (input_nml_file, nml=fms2_io_nml, iostat=mystat)
404 !>Send the namelist variables to their respective modules
405  if (ncchksz .le. 0) then
406  call mpp_error(fatal, "ncchksz in fms2_io_nml must be a positive number.")
407  endif
408  if (header_buffer_val .le. 0) then
409  call mpp_error(fatal, "header_buffer_val in fms2_io_nml must be a positive number.")
410  endif
411  if (deflate_level .lt. 0 .or. deflate_level .gt. 9) then
412  call mpp_error(fatal, &
413  "deflate_level in fms2_io_nml must be a positive number between 1 and 9 as it is required by NetCDF")
414  endif
416  call blackboxio_init (ncchksz)
417 !> Mark the fms2_io as initialized
418  fms2_io_is_initialized = .true.
419 end subroutine fms2_io_init
420 
421 end module fms2_io_mod
422 !> @}
423 ! close documentation grouping
logical function, public create_diskless_netcdf_file_wrap(fileobj, pelist, path)
Wrapper to distinguish interfaces.
Definition: blackboxio.F90:363
logical function, public create_diskless_unstructured_domain_file(fileobj, domain, path)
Create a "diskless" netcdf file to act as a buffer to support our "register data to a file wi...
Definition: blackboxio.F90:595
subroutine, public unstructured_write_restart_wrap(fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
Wrapper to distinguish interfaces.
Definition: blackboxio.F90:649
subroutine, public save_domain_restart_wrap(fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
Loop through registered restart variables and write them to a netcdf file.
Definition: blackboxio.F90:523
logical function, public create_diskless_domain_file(fileobj, domain, path)
Create a "diskless" netcdf file to act as a buffer to support our "register data to a file wi...
Definition: blackboxio.F90:453
subroutine, public restore_domain_state_wrap(fileobj, unlim_dim_level, directory, timestamp, filename, ignore_checksum)
Loop through registered restart variables and read them from a netcdf file.
Definition: blackboxio.F90:561
subroutine, public netcdf_restore_state_wrap(fileobj, unlim_dim_level, directory, timestamp, filename)
Loop through registered restart variables and read them from a netcdf file.
Definition: blackboxio.F90:419
subroutine, public blackboxio_init(chksz)
Accepts the namelist fms2_io_nml variables relevant to blackboxio.
Definition: blackboxio.F90:53
subroutine, public netcdf_save_restart_wrap2(fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
Support for writing new restarts from a diskless file.
Definition: blackboxio.F90:380
subroutine unstructured_domain_read_4d(fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
Wrapper to distinguish interfaces.
subroutine unstructured_domain_write_2d(fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine compressed_write_1d_wrap(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine compressed_write_5d_wrap(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine register_unstructured_domain_restart_variable_4d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine domain_read_0d(fileobj, variable_name, vdata, unlim_dim_level, corner)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
Definition: domain_read.inc:30
subroutine domain_write_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
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 register_domain_restart_variable_3d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine unstructured_domain_read_3d(fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
Wrapper to distinguish interfaces.
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....
logical shuffle
Flag indicating whether to use the netcdf shuffle filter.
Definition: fms2_io.F90:387
subroutine unstructured_domain_write_3d(fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine domain_write_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine compressed_write_0d_wrap(fileobj, variable_name, cdata, unlim_dim_level, corner)
Wrapper to distinguish interfaces.
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 register_domain_restart_variable_1d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine domain_write_1d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine register_unstructured_domain_restart_variable_2d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
integer header_buffer_val
Use defined netCDF header buffer size(in bytes) used in NF__ENDDEF.
Definition: fms2_io.F90:383
subroutine domain_write_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
logical, private fms2_io_is_initialized
True after fms2_io_init is run.
Definition: fms2_io.F90:376
subroutine unstructured_domain_write_0d(fileobj, variable_name, variable_data, unlim_dim_level, corner)
Wrapper to distinguish interfaces.
subroutine unstructured_domain_read_0d(fileobj, variable_name, buf, unlim_dim_level, corner, broadcast)
Wrapper to distinguish interfaces.
subroutine register_domain_restart_variable_5d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
integer deflate_level
Netcdf deflate level to use in nf90_def_var (integer between 1 to 9)
Definition: fms2_io.F90:385
subroutine unstructured_domain_write_4d(fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine compressed_write_2d_wrap(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine register_unstructured_domain_restart_variable_3d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
integer ncchksz
User defined chunksize (in bytes) argument in netcdf file creation calls. Replaces setting the NC_CHK...
Definition: fms2_io.F90:378
subroutine compressed_write_4d_wrap(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine domain_write_0d(fileobj, variable_name, vdata, unlim_dim_level, corner)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine unstructured_domain_read_5d(fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
Wrapper to distinguish interfaces.
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....
subroutine domain_write_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine domain_read_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine unstructured_domain_read_2d(fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
Wrapper to distinguish interfaces.
subroutine register_domain_restart_variable_4d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine domain_read_1d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
Definition: domain_read.inc:57
subroutine, public fms2_io_init()
Reads the fms2_io_nml.
Definition: fms2_io.F90:395
subroutine register_unstructured_domain_restart_variable_1d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine compressed_write_3d_wrap(fileobj, variable_name, cdata, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine register_unstructured_domain_restart_variable_5d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine unstructured_domain_write_1d(fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine domain_read_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
Definition: domain_read.inc:88
subroutine domain_read_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
subroutine unstructured_domain_write_5d(fileobj, variable_name, variable_data, unlim_dim_level, corner, edge_lengths)
Wrapper to distinguish interfaces.
subroutine register_unstructured_domain_restart_variable_0d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine domain_read_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
I/O domain root reads in a domain decomposed variable at a specific unlimited dimension level and sca...
character(len=10) netcdf_default_format
User defined netcdf file format, acceptable values are: "64bit", "classic", "netcdf4"....
Definition: fms2_io.F90:380
subroutine register_domain_restart_variable_0d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine unstructured_domain_read_1d(fileobj, variable_name, buf, unlim_dim_level, corner, edge_lengths, broadcast)
Wrapper to distinguish interfaces.
subroutine register_domain_restart_variable_2d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
Close a netcdf or domain file opened with open_file or open_virtual_file.
Definition: fms2_io.F90:165
Opens a given netcdf or domain file.
Definition: fms2_io.F90:121
Creates a diskless netcdf or domain file.
Definition: fms2_io.F90:145
Read data from a defined field in a file.
Definition: fms2_io.F90:291
Read registered restarts from a new file Optionally takes directory to write to, model time and filen...
Definition: fms2_io.F90:368
Reads in restart variables from a given file Example usage: call read_restart(fileobj) Reads registe...
Definition: fms2_io.F90:355
Add a dimension to a given file.
Definition: fms2_io.F90:189
Defines a new field within the given file Example usage:
Definition: fms2_io.F90:211
Similar to register_field, but occupies the field with data for restarts Example usage:
Definition: fms2_io.F90:230
Write data to a defined field within a file Example usage:
Definition: fms2_io.F90:261
Writes all restart fields in a given restart file to a new restart file Example usage:
Definition: fms2_io.F90:340
Writes all restart fields registered within a given restart file Example usage:
Definition: fms2_io.F90:324
subroutine, public get_instance_filename(name_in, name_out)
Adds the filename_appendix to name_in and sets it as name_out.
subroutine, public ascii_read(ascii_filename, ascii_var, num_lines, max_length)
Read the ascii text from filename ascii_filenameinto string array ascii_var
logical function, public file_exists(path)
Determine if a file exists.
subroutine, public open_check(flag, fname)
subroutine, public nullify_filename_appendix()
Clears the filename_appendix module variable.
subroutine, public get_filename_appendix(string_out)
Writes filename appendix to "string_out".
subroutine, public set_filename_appendix(string_in)
Save "string_in" as a module variable that will added to the filename of the restart files.
subroutine, public save_domain_restart(fileobj, unlim_dim_level)
Loop through registered restart variables and write them to a netcdf file.
logical function, public is_dimension_registered(fileobj, dimension_name)
Determine whether a domain-decomposed dimension has been registered to the file object.
subroutine, public get_global_io_domain_indices(fileobj, dimname, is, ie, indices)
Get starting/ending global indices of the I/O domain for a domain decomposed file.
subroutine, public register_domain_variable(fileobj, variable_name, variable_type, dimensions, chunksizes)
Add a domain decomposed variable.
logical function, public open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, dont_add_res_to_filename, use_netcdf_mpi)
Open a domain netcdf file.
subroutine, public get_mosaic_tile_grid(grid_file, mosaic_file, domain, tile_count)
Read a mosaic_file and get the grid filename for the current tile or for the tile specified.
subroutine, public register_domain_decomposed_dimension(fileobj, dim_name, xory, domain_position)
Add a dimension to a file associated with a two-dimensional domain.
subroutine, public close_domain_file(fileobj)
Close a domain netcdf file.
subroutine, public restore_domain_state(fileobj, unlim_dim_level, ignore_checksum)
Loop through registered restart variables and read them from a netcdf file.
subroutine, public get_compute_domain_dimension_indices(fileobj, dimname, indices)
Return an array of compute domain indices.
subroutine, public register_unstructured_dimension(fileobj, dim_name)
Add an unstructured dimension.
logical function, public open_unstructured_domain_file(fileobj, path, mode, domain, nc_format, is_restart, dont_add_res_to_filename)
Open a netcdf file that is associated with an unstructured domain.
subroutine, public close_unstructured_domain_file(fileobj)
Wrapper to distinguish interfaces.
subroutine, public register_unstructured_domain_variable(fileobj, variable_name, variable_type, dimensions, chunksizes)
Wrapper to distinguish interfaces.
subroutine, public unstructured_write_restart(fileobj, unlim_dim_level)
Wrapper to distinguish interfaces.
subroutine mpp_domains_init(flags)
Initialize domain decomp package.
subroutine mpp_init(flags, localcomm, test_level, alt_input_nml_path)
Initialize the mpp_mod module. Must be called before any usage.
Error handler.
Definition: mpp.F90:381
subroutine, public netcdf_restore_state(fileobj, unlim_dim_level)
Loop through registered restart variables and read them from a netcdf file.
Definition: netcdf_io.F90:1145
subroutine, public get_variable_size(fileobj, variable_name, dim_sizes, broadcast)
Get the size of a variable's dimensions.
Definition: netcdf_io.F90:1702
subroutine, public netcdf_add_dimension(fileobj, dimension_name, dimension_length, is_compressed)
Add a dimension to a file.
Definition: netcdf_io.F90:875
type(valid_t) function, public get_valid(fileobj, variable_name)
Store the valid range for a variable.
Definition: netcdf_io.F90:1812
subroutine, public read_restart_bc(fileobj, unlim_dim_level, ignore_checksum)
Loop through the registered restart variables (including regional variables) and read them from the n...
Definition: netcdf_io.F90:2299
logical function, public is_dimension_unlimited(fileobj, dimension_name, broadcast)
Determine where or not the dimension is unlimited.
Definition: netcdf_io.F90:1378
integer function, public get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast)
Get the index of a variable's unlimited dimensions.
Definition: netcdf_io.F90:1769
logical function, public netcdf_file_open_wrap(fileobj, path, mode, nc_format, pelist, is_restart, dont_add_res_to_filename)
Wrapper to distinguish interfaces.
Definition: netcdf_io.F90:2060
subroutine, public compressed_start_and_count(fileobj, nelems, npes_start, npes_count)
Gathers a compressed arrays size and offset for each pe.
Definition: netcdf_io.F90:2016
integer function, public get_variable_num_dimensions(fileobj, variable_name, broadcast)
Get the number of dimensions a variable depends on.
Definition: netcdf_io.F90:1598
subroutine, public get_dimension_size(fileobj, dimension_name, dim_size, broadcast)
Get the length of a dimension.
Definition: netcdf_io.F90:1448
subroutine netcdf_add_restart_variable_5d_wrap(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Wrapper to distinguish interfaces.
subroutine netcdf_add_restart_variable_1d_wrap(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Wrapper to distinguish interfaces.
logical function, public global_att_exists(fileobj, attribute_name, broadcast)
Determine if a global attribute exists.
Definition: netcdf_io.F90:1193
subroutine netcdf_add_restart_variable_0d_wrap(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Wrapper to distinguish interfaces.
subroutine netcdf_add_restart_variable_3d_wrap(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Wrapper to distinguish interfaces.
subroutine register_restart_region_3d(fileobj, variable_name, vdata, indices, global_size, pelist, is_root_pe, x_halo, y_halo, jshift, ishift, is_optional)
Registers a regional 3D variable and stores the information needed.
logical function, public dimension_exists(fileobj, dimension_name, broadcast)
Determine if a dimension exists.
Definition: netcdf_io.F90:1342
logical function, public is_registered_to_restart(fileobj, variable_name)
Determine if a variable has been registered to a restart file..
Definition: netcdf_io.F90:2241
subroutine, public register_compressed_dimension(fileobj, dimension_name, npes_corner, npes_nelems)
Add a compressed dimension.
Definition: netcdf_io.F90:928
logical function, public variable_att_exists(fileobj, variable_name, attribute_name, broadcast)
Determine if a variable's attribute exists.
Definition: netcdf_io.F90:1222
subroutine, public get_variable_dimension_names(fileobj, variable_name, dim_names, broadcast)
Get the name of a variable's dimensions.
Definition: netcdf_io.F90:1632
subroutine, public flush_file(fileobj)
flushes the netcdf file into disk
Definition: netcdf_io.F90:2402
subroutine netcdf_add_restart_variable_4d_wrap(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Wrapper to distinguish interfaces.
subroutine, public register_unlimited_compressed_axis(fileobj, dimension_name, dimension_length)
Add a "compressed" unlimited dimension to a netcdf file.
Definition: netcdf_io.F90:841
subroutine, public netcdf_add_variable_wrap(fileobj, variable_name, variable_type, dimensions, chunksizes)
Wrapper to distinguish interfaces.
Definition: netcdf_io.F90:2099
subroutine, public write_restart_bc(fileobj, unlim_dim_level)
Loop through the registered restart variables (including regional variables) and write them to the ne...
Definition: netcdf_io.F90:2336
subroutine, public netcdf_save_restart_wrap(fileobj, unlim_dim_level)
Wrapper to distinguish interfaces.
Definition: netcdf_io.F90:2113
subroutine, public get_variable_names(fileobj, names, broadcast)
Get the names of the variables in a file.
Definition: netcdf_io.F90:1509
subroutine netcdf_add_restart_variable_2d_wrap(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Wrapper to distinguish interfaces.
subroutine, public get_dimension_names(fileobj, names, broadcast)
Get the names of the dimensions in a file.
Definition: netcdf_io.F90:1285
logical function, public check_if_open(fileobj, fname)
Definition: netcdf_io.F90:2263
subroutine, public netcdf_io_init(chksz, header_buffer_val, netcdf_default_format, deflate_level, shuffle)
Accepts the namelist fms2_io_nml variables relevant to netcdf_io_mod.
Definition: netcdf_io.F90:351
integer function, public get_num_variables(fileobj, broadcast)
Determine the number of variables in a file.
Definition: netcdf_io.F90:1482
subroutine, public get_unlimited_dimension_name(fileobj, dimension_name, broadcast)
Get the name of the unlimited dimension.
Definition: netcdf_io.F90:1413
subroutine register_restart_region_2d(fileobj, variable_name, vdata, indices, global_size, pelist, is_root_pe, x_halo, y_halo, jshift, ishift, is_optional)
Registers a regional 2D variable and stores the information needed.
subroutine, public netcdf_file_close_wrap(fileobj)
Wrapper to distinguish interfaces.
Definition: netcdf_io.F90:2090
logical function, public variable_exists(fileobj, variable_name, broadcast)
Determine if a variable exists.
Definition: netcdf_io.F90:1566
integer function, public get_num_dimensions(fileobj, broadcast)
Determine the number of dimensions in a file.
Definition: netcdf_io.F90:1258
The interface is needed to accomodate pgi because it can't handle class * and there was no other way ...
Definition: netcdf_io.F90:339
Range type for a netcdf variable.
Definition: netcdf_io.F90:167