Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed a problem with id values getting shifted by one. We count from …
Browse files Browse the repository at this point in the history
…0 because the central body is always 0
  • Loading branch information
daminton committed Dec 10, 2022
1 parent 5d72cf4 commit 7553ca4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ module subroutine netcdf_read_particle_info_system(self, nc, param, plmask, tpma
call pl%info(i)%set_value(status="ACTIVE")
end do
allocate(plind(npl))
plind(:) = pack([(i, i = 1, idmax)], plmask(:))
plind(:) = pack([(i, i = 0, idmax-1)], plmask(:))
end if
if (ntp > 0) then
tp%status(:) = ACTIVE
Expand All @@ -817,16 +817,16 @@ module subroutine netcdf_read_particle_info_system(self, nc, param, plmask, tpma
call tp%info(i)%set_value(status="ACTIVE")
end do
allocate(tpind(ntp))
tpind(:) = pack([(i, i = 1, idmax)], tpmask(:))
tpind(:) = pack([(i, i = 0, idmax-1)], tpmask(:))
end if

call check( nf90_get_var(nc%id, nc%id_varid, itemp), "netcdf_read_particle_info_system nf90_getvar id_varid" )
cb%id = itemp(1)
pl%id(:) = pack(itemp, plmask)
tp%id(:) = pack(itemp, tpmask)
cb%id = 0
pl%id(:) = pack([(i,i=1,idmax)],plmask)
tp%id(:) = pack([(i,i=1,idmax)],tpmask)
pl%id(:) = pack([(i,i=0,idmax-1)],plmask)
tp%id(:) = pack([(i,i=0,idmax-1)],tpmask)

call check( nf90_get_var(nc%id, nc%name_varid, ctemp, count=[NAMELEN, idmax]), "netcdf_read_particle_info_system nf90_getvar name_varid" )
call cb%info%set_value(name=ctemp(1))
Expand Down

0 comments on commit 7553ca4

Please sign in to comment.