FMS  2024.03
Flexible Modeling System
fms2_io.F90
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 !> @defgroup fms2_io_mod fms2_io_mod
20 !> @ingroup fms2_io
21 !> @brief An updated library for parallel IO to replace @ref mpp_io_mod. This module contains
22 !! the public API for fms2 I/O interfaces and routines defined throughout this directory.
23 !! A conversion guide for replacing mpp/fms_io code with this module is available below.
24 
25 !> @addtogroup fms2_io_mod
26 !> @{
27 module fms2_io_mod
28 use fms_io_utils_mod
29 use netcdf_io_mod
30 use fms_netcdf_domain_io_mod
31 use fms_netcdf_unstructured_domain_io_mod
32 use blackboxio
33 use mpp_mod, only: mpp_init, input_nml_file, mpp_error, fatal
34 use mpp_domains_mod, only: mpp_domains_init
35 implicit none
36 private
37 
38 public :: unlimited
39 public :: fmsnetcdffile_t
40 public :: fmsnetcdfdomainfile_t
42 public :: open_file
43 public :: open_virtual_file
44 public :: close_file
45 public :: register_axis
47 public :: register_field
48 public :: register_restart_field
49 public :: write_data
50 public :: read_data
51 public :: write_restart
52 public :: write_new_restart
53 public :: read_restart
54 public :: read_new_restart
55 public :: global_att_exists
56 public :: variable_att_exists
59 public :: get_global_attribute
60 public :: get_variable_attribute
61 public :: get_num_dimensions
62 public :: get_dimension_names
63 public :: dimension_exists
64 public :: is_dimension_unlimited
65 public :: get_dimension_size
66 public :: get_num_variables
67 public :: get_variable_names
68 public :: variable_exists
71 public :: get_variable_size
74 public :: valid_t
75 public :: get_valid
76 public :: is_valid
79 public :: file_exists
81 public :: get_variable_sense
82 public :: get_variable_missing
83 public :: get_variable_units
84 public :: get_time_calendar
85 public :: open_check
87 public :: check_if_open
88 public :: set_fileobj_time_name
90 public :: fms2_io_init
91 public :: write_restart_bc
92 public :: read_restart_bc
93 public :: get_mosaic_tile_grid
94 public :: ascii_read
95 public :: get_mosaic_tile_file
96 public :: parse_mask_table
97 public :: get_filename_appendix
98 public :: set_filename_appendix
99 public :: get_instance_filename
101 public :: flush_file
102 !> @}
103 
104 !> @brief Opens a given netcdf or domain file.
105 !!
106 !> <br>Example usage:
107 !!
108 !! io_success = open_file(fileobj, "filename", "write")
109 !!
110 !! Opens a netcdf file of type @ref fmsnetcdffile_t at the given file path string.
111 !! File mode is set to one of "read"/"write"/"overwrite"/"append"
112 !!
113 !! io_success = open_file(fileobj, "filename", "overwrite", domain)
114 !!
115 !! Opens a domain netcdf file of type @ref fmsnetcdfdomainfile_t or
116 !! @ref fmsnetcdfunstructureddomainfile_t at the given file path name and 2D or unstructured domain.
117 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
118 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
119 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
120 !! For generic netcdf: @ref netcdf_io_mod.
121 !> @ingroup fms2_io_mod
122 interface open_file
123  module procedure netcdf_file_open_wrap
124  module procedure open_domain_file
125  module procedure open_unstructured_domain_file
126 end interface open_file
127 
128 
129 !> @brief Creates a diskless netcdf or domain file
130 !!
131 !> @return true if successful, false otherwise
132 !!
133 !> <br>Example usage:
134 !!
135 !! io_success = open_virtual_file(fileobj, "filename", pelist)
136 !!
137 !! Opens a virtual file through @ref fmsnetcdffile_t at an optional file path and pelist
138 !!
139 !! io_success = open_virtual_file(fileobj, domain, "filename")
140 !!
141 !! Opens a virtual domain file through @ref fmsnetcdfdomainfile_t or
142 !! @ref fmsnetcdfunstructureddomainfile_t for a given 2D domain at an optional path <br>
143 !!
144 !! @note For individual documentation on the listed routines, please see the appropriate helper module: @ref blackboxio
145 !> @ingroup fms2_io_mod
147  module procedure create_diskless_netcdf_file_wrap
148  module procedure create_diskless_domain_file
150 end interface open_virtual_file
151 
152 !> @brief Close a netcdf or domain file opened with @ref open_file or
153 !! @ref open_virtual_file
154 !!
155 !> <br>Example usage:
156 !!
157 !! call close_file(fileobj)
158 !!
159 !! Closes any given fileobj opened via @ref open_file or @ref open_virtual_file
160 !!
161 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
162 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
163 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
164 !! For generic netcdf: @ref netcdf_io_mod.
165 !> @ingroup fms2_io_mod
166 interface close_file
167  module procedure netcdf_file_close_wrap
168  module procedure close_domain_file
169  module procedure close_unstructured_domain_file
170 end interface close_file
171 
172 !> @brief Add a dimension to a given file
173 !!
174 !> <br>Example usage:
175 !!
176 !! call register_axis(fileobj, "lon", "x")
177 !!
178 !! Adds a dimension named "lon" associated with the x axis of the 2D domain file. For unstructured
179 !! domains no x or y axis character is provided.
180 !!
181 !! call register_axis(fileobj, "lon", n)
182 !!
183 !! Adds a dimension named "lon" with length n to a given netcdf file.<br>
184 !!
185 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
186 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
187 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
188 !! For generic netcdf: @ref netcdf_io_mod.
189 !> @ingroup fms2_io_mod
190 interface register_axis
191  module procedure netcdf_add_dimension
192  module procedure register_compressed_dimension
193  module procedure register_domain_decomposed_dimension
194  module procedure register_unstructured_dimension
195 end interface register_axis
196 
197 !> @brief Defines a new field within the given file
198 !> <br>Example usage:
199 !!
200 !! call register_field(fileobj, "lon", "double", (/"lon"/) )
201 !!
202 !! Adds a double variable named "lon" to the given file, corresponding to the
203 !! list of dimension names (which must be previously defined in the fileobj).
204 !! The size of dimension name list provided is the amount of ranks for the created
205 !! field, scalar if list not provided.
206 !!
207 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
208 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
209 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
210 !! For generic netcdf: @ref netcdf_io_mod.
211 !> @ingroup fms2_io_mod
212 interface register_field
213  module procedure netcdf_add_variable_wrap
214  module procedure register_domain_variable
216 end interface register_field
217 
218 !> @brief Similar to @ref register_field, but occupies the field with data for restarts
219 !> <br>Example usage:
220 !!
221 !! call register_restart_field(fileobj, "temperature", data_ptr, (/"lon", "time"/) )
222 !!
223 !! Creates a restart variable and sets it to the values from data_ptr, corresponding to
224 !! the list of dimension names. Rank of data_ptr must equal the amount of corresponding dimensions.
225 !!
226 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
227 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
228 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
229 !! For generic netcdf: @ref netcdf_io_mod.
230 !> @ingroup fms2_io_mod
232  module procedure netcdf_add_restart_variable_0d_wrap
233  module procedure netcdf_add_restart_variable_1d_wrap
234  module procedure netcdf_add_restart_variable_2d_wrap
235  module procedure netcdf_add_restart_variable_3d_wrap
236  module procedure netcdf_add_restart_variable_4d_wrap
237  module procedure netcdf_add_restart_variable_5d_wrap
238  module procedure register_domain_restart_variable_0d
239  module procedure register_domain_restart_variable_1d
240  module procedure register_domain_restart_variable_2d
241  module procedure register_domain_restart_variable_3d
242  module procedure register_domain_restart_variable_4d
243  module procedure register_domain_restart_variable_5d
250  module procedure register_restart_region_2d
251  module procedure register_restart_region_3d
252 end interface register_restart_field
253 
254 !> @brief Write data to a defined field within a file
255 !> <br>Example usage:
256 !!
257 !! call write_data(fileobj, "lon", data)
258 !!
259 !! Write the value(s) in data to the field named "lon"
260 !!
261 !> @ingroup fms2_io_mod
262 interface write_data
263  module procedure compressed_write_0d_wrap
264  module procedure compressed_write_1d_wrap
265  module procedure compressed_write_2d_wrap
266  module procedure compressed_write_3d_wrap
267  module procedure compressed_write_4d_wrap
268  module procedure compressed_write_5d_wrap
269  module procedure domain_write_0d
270  module procedure domain_write_1d
271  module procedure domain_write_2d
272  module procedure domain_write_3d
273  module procedure domain_write_4d
274  module procedure domain_write_5d
275  module procedure unstructured_domain_write_0d
276  module procedure unstructured_domain_write_1d
277  module procedure unstructured_domain_write_2d
278  module procedure unstructured_domain_write_3d
279  module procedure unstructured_domain_write_4d
280  module procedure unstructured_domain_write_5d
281 end interface write_data
282 
283 !> @brief Read data from a defined field in a file
284 !!
285 !> <br>Example usage:
286 !!
287 !! call read_data(fileobj, "lat", data)
288 !!
289 !! Read the values for the field "lat" from the file and write them onto data <br>
290 !!
291 !> @ingroup fms2_io_mod
292 interface read_data
293  module procedure compressed_read_0d
294  module procedure compressed_read_1d
295  module procedure compressed_read_2d
296  module procedure compressed_read_3d
297  module procedure compressed_read_4d
298  module procedure compressed_read_5d
299  module procedure domain_read_0d
300  module procedure domain_read_1d
301  module procedure domain_read_2d
302  module procedure domain_read_3d
303  module procedure domain_read_4d
304  module procedure domain_read_5d
305  module procedure unstructured_domain_read_0d
306  module procedure unstructured_domain_read_1d
307  module procedure unstructured_domain_read_2d
308  module procedure unstructured_domain_read_3d
309  module procedure unstructured_domain_read_4d
310  module procedure unstructured_domain_read_5d
311 end interface read_data
312 
313 !> @brief Writes all restart fields registered within a given restart file
314 !> <br>Example usage:
315 !!
316 !! call write_restart(fileobj)
317 !!
318 !! Writes previously registered restart fields to the given restart file
319 !!
320 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
321 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
322 !! For netcdf files with an unstructured domain: @ref fms_netcdf_unstructured_domain_io_mod.
323 !! For generic netcdf: @ref netcdf_io_mod.
324 !> @ingroup fms2_io_mod
325 interface write_restart
326  module procedure netcdf_save_restart_wrap
327  module procedure save_domain_restart
328  module procedure unstructured_write_restart
329 end interface write_restart
330 
331 !> @brief Writes all restart fields in a given restart file to a new restart file
332 !> <br>Example usage:
333 !!
334 !! call write_new_restart(fileobj, timestamp="tstring", filename="new_restartfilename")
335 !!
336 !! Creates a new restart file, with the provided timestamp and filename, out of the registered
337 !! restart fields in the given restart file.
338 !!
339 !! @note For individual documentation on the listed routines, please see the appropriate helper module: @ref blackboxio
340 !> @ingroup fms2_io_mod
342  module procedure netcdf_save_restart_wrap2
343  module procedure save_domain_restart_wrap
344  module procedure unstructured_write_restart_wrap
345 end interface write_new_restart
346 
347 !> @brief Reads in restart variables from a given file
348 !> <br>Example usage:
349 !! call read_restart(fileobj)
350 !! Reads registered restart variables from fileobj
351 !!
352 !! @note For individual documentation on the listed routines, please see the appropriate helper module.
353 !! For netcdf files with a structured domain: @ref fms_netcdf_domain_io_mod.
354 !! For generic netcdf: @ref netcdf_io_mod.
355 !> @ingroup fms2_io_mod
356 interface read_restart
357  module procedure netcdf_restore_state
358  module procedure restore_domain_state
359 end interface read_restart
360 
361 !> @brief Read registered restarts from a new file
362 !! Optionally takes directory to write to, model time and filename
363 !> <br>Example usage:
364 !! call read_new_restart(fileobj, unlimted_dimension_level)
365 !!
366 !! call read_new_restart(fileobj, unlimited_dimension_level, directory, timestamp, filename)
367 !! @note For individual documentation on the listed routines, please see the appropriate helper module: @ref blackboxio
368 !> @ingroup fms2_io_mod
370  module procedure netcdf_restore_state_wrap
371  module procedure restore_domain_state_wrap
372 end interface read_new_restart
373 
374 !> @addtogroup fms2_io_mod
375 !> @{
376 
377 logical, private :: fms2_io_is_initialized = .false. !< True after fms2_io_init is run
378 ! Namelist variables
379 integer :: ncchksz = 64*1024 !< User defined chunksize (in bytes) argument in netcdf file
380  !! creation calls. Replaces setting the NC_CHKSZ environment variable.
381 character (len = 10) :: netcdf_default_format = "64bit" !< User defined netcdf file format, acceptable values
382  !! are: "64bit", "classic", "netcdf4". This can be overwritten if you specify
383  !! "nc_format" in the open_file call
384 integer :: header_buffer_val = 16384 !< Use defined netCDF header buffer size(in bytes) used in
385  !! NF__ENDDEF
386 integer :: deflate_level = default_deflate_level !< Netcdf deflate level to use in nf90_def_var
387  !! (integer between 1 to 9)
388 logical :: shuffle = .false. !< Flag indicating whether to use the netcdf shuffle filter
389 namelist / fms2_io_nml / &
391 
392 contains
393 
394 !> @brief Reads the fms2_io_nml
395 subroutine fms2_io_init ()
396  integer :: mystat
397 
398 !> Check if the module has already been initialized
399  if (fms2_io_is_initialized) return
400 !> Call initialization routines that this module depends on
401  call mpp_init()
402  call mpp_domains_init()
403 !> Read the namelist
404  READ (input_nml_file, nml=fms2_io_nml, iostat=mystat)
405 !>Send the namelist variables to their respective modules
406  if (ncchksz .le. 0) then
407  call mpp_error(fatal, "ncchksz in fms2_io_nml must be a positive number.")
408  endif
409  if (header_buffer_val .le. 0) then
410  call mpp_error(fatal, "header_buffer_val in fms2_io_nml must be a positive number.")
411  endif
412  if (deflate_level .lt. 0 .or. deflate_level .gt. 9) then
413  call mpp_error(fatal, &
414  "deflate_level in fms2_io_nml must be a positive number between 1 and 9 as it is required by NetCDF")
415  endif
417  call blackboxio_init (ncchksz)
418 !> Mark the fms2_io as initialized
419  fms2_io_is_initialized = .true.
420 end subroutine fms2_io_init
421 
422 end module fms2_io_mod
423 !> @}
424 ! close documentation grouping
logical function, public create_diskless_netcdf_file_wrap(fileobj, pelist, path)
Wrapper to distinguish interfaces.
Definition: blackboxio.F90:364
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:596
subroutine, public unstructured_write_restart_wrap(fileobj, unlim_dim_level, directory, timestamp, filename, nc_format)
Wrapper to distinguish interfaces.
Definition: blackboxio.F90:650
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:524
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:454
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:562
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:420
subroutine, public blackboxio_init(chksz)
Accepts the namelist fms2_io_nml variables relevant to blackboxio.
Definition: blackboxio.F90:54
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:381
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:31
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:388
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:384
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:377
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:386
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:379
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:58
subroutine, public fms2_io_init()
Reads the fms2_io_nml.
Definition: fms2_io.F90:396
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:89
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:381
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:166
Opens a given netcdf or domain file.
Definition: fms2_io.F90:122
Creates a diskless netcdf or domain file.
Definition: fms2_io.F90:146
Read data from a defined field in a file.
Definition: fms2_io.F90:292
Read registered restarts from a new file Optionally takes directory to write to, model time and filen...
Definition: fms2_io.F90:369
Reads in restart variables from a given file Example usage: call read_restart(fileobj) Reads registe...
Definition: fms2_io.F90:356
Add a dimension to a given file.
Definition: fms2_io.F90:190
Defines a new field within the given file Example usage:
Definition: fms2_io.F90:212
Similar to register_field, but occupies the field with data for restarts Example usage:
Definition: fms2_io.F90:231
Write data to a defined field within a file Example usage:
Definition: fms2_io.F90:262
Writes all restart fields in a given restart file to a new restart file Example usage:
Definition: fms2_io.F90:341
Writes all restart fields registered within a given restart file Example usage:
Definition: fms2_io.F90:325
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.
logical function, public open_domain_file(fileobj, path, mode, domain, nc_format, is_restart, dont_add_res_to_filename)
Open a domain netcdf file.
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 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 register_domain_variable(fileobj, variable_name, variable_type, dimensions)
Add a domain decomposed variable.
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)
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:382
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:1127
subroutine, public get_variable_size(fileobj, variable_name, dim_sizes, broadcast)
Get the size of a variable's dimensions.
Definition: netcdf_io.F90:1684
subroutine, public netcdf_add_dimension(fileobj, dimension_name, dimension_length, is_compressed)
Add a dimension to a file.
Definition: netcdf_io.F90:862
type(valid_t) function, public get_valid(fileobj, variable_name)
Store the valid range for a variable.
Definition: netcdf_io.F90:1794
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:2280
logical function, public is_dimension_unlimited(fileobj, dimension_name, broadcast)
Determine where or not the dimension is unlimited.
Definition: netcdf_io.F90:1360
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:1751
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:2042
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:1998
integer function, public get_variable_num_dimensions(fileobj, variable_name, broadcast)
Get the number of dimensions a variable depends on.
Definition: netcdf_io.F90:1580
subroutine, public get_dimension_size(fileobj, dimension_name, dim_size, broadcast)
Get the length of a dimension.
Definition: netcdf_io.F90:1430
subroutine, public netcdf_add_variable_wrap(fileobj, variable_name, variable_type, dimensions)
Wrapper to distinguish interfaces.
Definition: netcdf_io.F90:2081
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:1175
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:1324
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:2222
subroutine, public register_compressed_dimension(fileobj, dimension_name, npes_corner, npes_nelems)
Add a compressed dimension.
Definition: netcdf_io.F90:915
logical function, public variable_att_exists(fileobj, variable_name, attribute_name, broadcast)
Determine if a variable's attribute exists.
Definition: netcdf_io.F90:1204
subroutine, public get_variable_dimension_names(fileobj, variable_name, dim_names, broadcast)
Get the name of a variable's dimensions.
Definition: netcdf_io.F90:1614
subroutine, public flush_file(fileobj)
flushes the netcdf file into disk
Definition: netcdf_io.F90:2383
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:828
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:2317
subroutine, public netcdf_save_restart_wrap(fileobj, unlim_dim_level)
Wrapper to distinguish interfaces.
Definition: netcdf_io.F90:2094
subroutine, public get_variable_names(fileobj, names, broadcast)
Get the names of the variables in a file.
Definition: netcdf_io.F90:1491
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:1267
logical function, public check_if_open(fileobj, fname)
Definition: netcdf_io.F90:2244
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:346
integer function, public get_num_variables(fileobj, broadcast)
Determine the number of variables in a file.
Definition: netcdf_io.F90:1464
subroutine, public get_unlimited_dimension_name(fileobj, dimension_name, broadcast)
Get the name of the unlimited dimension.
Definition: netcdf_io.F90:1395
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:2072
logical function, public variable_exists(fileobj, variable_name, broadcast)
Determine if a variable exists.
Definition: netcdf_io.F90:1548
integer function, public get_num_dimensions(fileobj, broadcast)
Determine the number of dimensions in a file.
Definition: netcdf_io.F90:1240
The interface is needed to accomodate pgi because it can't handle class * and there was no other way ...
Definition: netcdf_io.F90:334
Range type for a netcdf variable.
Definition: netcdf_io.F90:163