Skip to content

Commit

Permalink
Refixing starts/counts for pio puts
Browse files Browse the repository at this point in the history
The starts/counts for puts where the vars (1d/2d/3d) had no time
dimensions were wrong, i.e., always had an extra start/count
corresponding to the time dimension. Now we have the starts/counts
for time dimension only when the var is supposed to have
multiple timesteps.

This fix (part of PR #2772) was accidentally reverted by PR #3012.
  • Loading branch information
dqwu committed Sep 9, 2019
1 parent 51d8425 commit b58e384
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions components/mosart/src/riverroute/RtmIO.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,8 @@ subroutine ncd_io_int_var1_nf(varname, data, flag, ncid, readvar, nt)

elseif (flag == 'write') then

start = 0
count = 0
if (present(nt)) then
start(1) = 1
count(1) = size(data)
Expand All @@ -1100,8 +1102,6 @@ subroutine ncd_io_int_var1_nf(varname, data, flag, ncid, readvar, nt)
else
start(1) = 1
count(1) = size(data)
start(2) = 1
count(2) = 1
end if
call ncd_inqvid (ncid, varname, varid, vardesc)
status = pio_put_var(ncid, varid, start, count, data)
Expand Down Expand Up @@ -1153,6 +1153,8 @@ subroutine ncd_io_log_var1_nf(varname, data, flag, ncid, readvar, nt)

elseif (flag == 'write') then

start = 0
count = 0
if (present(nt)) then
start(1) = 1
count(1) = size(data)
Expand All @@ -1161,8 +1163,6 @@ subroutine ncd_io_log_var1_nf(varname, data, flag, ncid, readvar, nt)
else
start(1) = 1
count(1) = size(data)
start(2) = 1
count(2) = 1
end if
call ncd_inqvid (ncid, varname, varid, vardesc)
allocate( idata(size(data)) )
Expand Down Expand Up @@ -1214,16 +1214,16 @@ subroutine ncd_io_real_var1_nf(varname, data, flag, ncid, readvar, nt)

elseif (flag == 'write') then

start = 0
count = 0
if (present(nt)) then
start(1) = 1
start(2) = nt
count(1) = size(data)
count(2) = 1
else
start(1) = 1
start(2) = 1
count(1) = size(data)
count(2) = 1
end if
call ncd_inqvid (ncid, varname, varid, vardesc)
status = pio_put_var(ncid, varid, start, count, data)
Expand Down Expand Up @@ -1330,6 +1330,8 @@ subroutine ncd_io_int_var2_nf(varname, data, flag, ncid, readvar, nt)

elseif (flag == 'write') then

start = 0
count = 0
if (present(nt)) then
start(1) = 1
start(2) = 1
Expand All @@ -1340,10 +1342,8 @@ subroutine ncd_io_int_var2_nf(varname, data, flag, ncid, readvar, nt)
else
start(1) = 1
start(2) = 1
start(3) = 1
count(1) = size(data, dim=1)
count(2) = size(data, dim=2)
count(3) = 1
end if
call ncd_inqvid(ncid, varname, varid, vardesc)
status = pio_put_var(ncid, varid, start, count, data)
Expand Down Expand Up @@ -1389,6 +1389,8 @@ subroutine ncd_io_real_var2_nf(varname, data, flag, ncid, readvar, nt)

elseif (flag == 'write') then

start = 0
count = 0
if (present(nt)) then
start(1) = 1
start(2) = 1
Expand All @@ -1399,10 +1401,8 @@ subroutine ncd_io_real_var2_nf(varname, data, flag, ncid, readvar, nt)
else
start(1) = 1
start(2) = 1
start(3) = 1
count(1) = size(data, dim=1)
count(2) = size(data, dim=2)
count(3) = 1
end if
call ncd_inqvid (ncid, varname, varid, vardesc)
status = pio_put_var(ncid, varid, start, count, data)
Expand Down

0 comments on commit b58e384

Please sign in to comment.