Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional argument to FMS2 version of get_field_size #64

Merged
merged 3 commits into from
Feb 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion config_src/infra/FMS2/MOM_io_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,14 @@ subroutine get_field_size(filename, fieldname, sizes, field_found, no_domain)
!! is a fatal error if the field is not found.
logical, optional, intent(in) :: no_domain !< If present and true, do not check for file
!! names with an appended tile number

! Local variables
type(FmsNetcdfFile_t) :: fileobj_read ! A handle to a non-domain-decomposed file for obtaining information
! about the exiting time axis entries in append mode.
logical :: success ! If true, the file was opened successfully
logical :: field_exists ! True if filename exists and field_name is in filename
integer :: i, ndims


if (FMS2_reads) then
field_exists = .false.
if (file_exists(filename)) then
Expand All @@ -627,6 +627,12 @@ subroutine get_field_size(filename, fieldname, sizes, field_found, no_domain)
"get_field_size called with too few sizes for "//trim(fieldname)//" in "//trim(filename))
call get_variable_size(fileobj_read, fieldname, sizes(1:ndims))
do i=ndims+1,size(sizes) ; sizes(i) = 0 ; enddo
! This preserves previous behavior when reading time-varying data without
! a vertical extent.
if (size(sizes)==ndims+1) then
sizes(ndims+1)=sizes(ndims)
sizes(ndims)=1
endif
endif
endif
endif
Expand Down