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

FMS 2 I/O logic errors in read_climate_nudge_data_init #137

Closed
menzel-gfdl opened this issue Sep 9, 2021 · 2 comments
Closed

FMS 2 I/O logic errors in read_climate_nudge_data_init #137

menzel-gfdl opened this issue Sep 9, 2021 · 2 comments

Comments

@menzel-gfdl
Copy link
Contributor

Describe the bug
There is an indexing error here:

if (trim(Files(n)%axes(j)) .eq. trim(required_axis_names(j))) then

As written, this line assumes that the dimensions in input file appear in the same order as the required_axis_names. This in general will not be true. Also, this code does not store the time axis data correctly. How exactly does the code determine the time axis? Is it required to be the only unlimited dimension?

To Reproduce
Attempt to run a "nudged" experiment. A few different fatal or fortran errors are possible. Some come from here:

subroutine check_resolution (axis_len)
integer, intent(in) :: axis_len(:)
if (size(axis_len(:)) .lt. 2) then
call error_mesg ('read_climate_nudge_data_mod', 'incorrect number of array dimensions', FATAL)
endif
if (axis_len(1) .ne. global_axis_size(INDEX_LON)) then
call error_mesg ('read_climate_nudge_data_mod', 'incorrect array dimension one', FATAL)
endif
if (axis_len(2) .ne. global_axis_size(INDEX_LAT)) then
call error_mesg ('read_climate_nudge_data_mod', 'incorrect array dimension two', FATAL)
endif
if (size(axis_len(:)) .gt. 3) then
if (axis_len(3) .ne. global_axis_size(INDEX_LEV)) then
call error_mesg ('read_climate_nudge_data_mod', 'incorrect array dimension three', FATAL)
endif
endif
end subroutine check_resolution

I have also seen intrinsic fortran errors in the get_cal_time function from FMS, because if the wrong axis is identified as the time axis, the units may have less than 10 - 15 characters causing a buffer overflow.

Expected behavior
The routine should correctly identify the time, lon, lat and lev axes.

System Environment
This was first seen using the intel 18 compiler on the Gaea hpc system.

Additional context
I believe I have a fix, and will create a pull request.

@menzel-gfdl menzel-gfdl mentioned this issue Sep 9, 2021
6 tasks
@bensonr
Copy link
Contributor

bensonr commented Sep 9, 2021

@menzel-gfdl - thanks for creating a fix/patch. This must be a use case for which we do not have a test within the RTS system for GFDL models at this point in time.

@laurenchilutti
Copy link
Contributor

Fixed by PR #138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants