Skip to content

Commit

Permalink
Fix nudge logic (#157)
Browse files Browse the repository at this point in the history
* fix logic errors

* fix answer changes
  • Loading branch information
menzel-gfdl authored Oct 18, 2021
1 parent 4823307 commit 41efd1d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions GFDL_tools/read_climate_nudge_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ subroutine read_time ( times, units, calendar )
if( n == 1) then
time_axis = Files(n)%axes(INDEX_TIME)
call get_variable_units(fileobj, time_axis, units)
if( variable_att_exists(fileobj, time_axis, calendar) ) then
if( variable_att_exists(fileobj, time_axis, "calendar") ) then
call get_time_calendar(fileobj, time_axis, calendar)
else
calendar = 'gregorian '
Expand Down Expand Up @@ -445,16 +445,15 @@ subroutine read_climate_nudge_data_2d (itime, field, dat, is, js)
start = 1
if (present(is)) start(1) = is
if (present(js)) start(2) = js
start(3) = atime

nread = 1
nread(1) = size(dat,1)
nread(2) = size(dat,2)

allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (open_file(fileobj, trim(filenames(n)), "read", pelist=pes)) then
call read_data(fileobj, Files(n)%fields(this_index), dat, corner=start, edge_lengths=nread)
call read_data(fileobj, Files(n)%fields(this_index), dat, unlim_dim_level=atime, &
corner=start(1:2), edge_lengths=nread(1:2))
call close_file(fileobj)
endif
deallocate(pes)
Expand Down Expand Up @@ -529,17 +528,16 @@ subroutine read_climate_nudge_data_3d (itime, field, dat, is, js)
start = 1
if (present(is)) start(1) = is
if (present(js)) start(2) = js
start(4) = atime

nread = 1
nread(1) = size(dat,1)
nread(2) = size(dat,2)
nread(3) = size(dat,3)

allocate(pes(mpp_npes()))
call mpp_get_current_pelist(pes)
if (open_file(fileobj, trim(filenames(n)), "read", pelist=pes)) then
call read_data(fileobj, Files(n)%fields(this_index), dat, corner=start, edge_lengths=nread)
call read_data(fileobj, Files(n)%fields(this_index), dat, unlim_dim_level=atime, &
corner=start(1:3), edge_lengths=nread(1:3))
call close_file(fileobj)
endif
deallocate(pes)
Expand Down

0 comments on commit 41efd1d

Please sign in to comment.