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

Commit

Permalink
if j2rp2 or j4rp4 are not found, set them to 0. if they are found, ge…
Browse files Browse the repository at this point in the history
…t the value
  • Loading branch information
cwishard committed Nov 14, 2022
1 parent dc508d4 commit d820924
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ module function netcdf_read_frame_system(self, iu, param) result(ierr)
! Return
integer(I4B) :: ierr !! Error code: returns 0 if the read is successful
! Internals
integer(I4B) :: tslot, idmax, npl_check, ntp_check, nplm_check, t_max, str_max
integer(I4B) :: tslot, idmax, npl_check, ntp_check, nplm_check, t_max, str_max, status
real(DP), dimension(:), allocatable :: rtemp
integer(I4B), dimension(:), allocatable :: itemp
logical, dimension(:), allocatable :: validmask, tpmask, plmask
Expand Down Expand Up @@ -717,8 +717,19 @@ module function netcdf_read_frame_system(self, iu, param) result(ierr)
! if (npl > 0) pl%Q(:) = pack(rtemp, plmask)
! end if

call check( nf90_get_var(iu%ncid, iu%j2rp2_varid, cb%j2rp2, start=[tslot]), "netcdf_read_frame_system nf90_getvar j2rp2_varid" )
call check( nf90_get_var(iu%ncid, iu%j4rp4_varid, cb%j4rp4, start=[tslot]), "netcdf_read_frame_system nf90_getvar j4rp4_varid" )
status = nf90_inq_varid(iu%ncid, J2RP2_VARNAME, iu%j2rp2_varid)
if (status == nf90_noerr) then
call check( nf90_get_var(iu%ncid, iu%j2rp2_varid, cb%j2rp2, start=[tslot]), "netcdf_read_frame_system nf90_getvar j2rp2_varid" )
else
cb%j2rp2 = 0.0_DP
end if

status = nf90_inq_varid(iu%ncid, J4RP4_VARNAME, iu%j4rp4_varid)
if (status == nf90_noerr) then
call check( nf90_get_var(iu%ncid, iu%j4rp4_varid, cb%j4rp4, start=[tslot]), "netcdf_read_frame_system nf90_getvar j4rp4_varid" )
else
cb%j4rp4 = 0.0_DP
end if

call self%read_particle_info(iu, param, plmask, tpmask)

Expand Down

0 comments on commit d820924

Please sign in to comment.