Skip to content

Commit

Permalink
Merge branch 'develop' into release/MAPL-v3
Browse files Browse the repository at this point in the history
  • Loading branch information
mathomp4 committed Nov 12, 2024
2 parents 5ac1078 + 18567fa commit 74ae24c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Allow update offsets of ±timestep in ExtData2G
- Minor revision (and generalization) of grid-def for GSI purposes
- Trajectory sampler: fix a bug when group_name does not exist in netCDF file and a bug that omitted the first time point

### Changed

Expand Down
41 changes: 24 additions & 17 deletions base/Plain_netCDF_Time.F90
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,21 @@ subroutine get_v1d_netcdf_R8(filename, name, array, Xdim, group_name, rc)
real(REAL64), dimension(Xdim), intent(out) :: array
integer, optional, intent(out) :: rc
integer :: status
integer :: ncid, varid, ncid2
integer :: ncid, varid, ncid2, ncid_sv

call check_nc_status(nf90_open(trim(fileName), NF90_NOWRITE, ncid), _RC)
ncid_sv = ncid

if(present(group_name)) then
ncid2= ncid
call check_nc_status(nf90_inq_ncid(ncid2, group_name, ncid), _RC)
if(group_name/='') then
ncid2= ncid
call check_nc_status(nf90_inq_ncid(ncid2, group_name, ncid), _RC)
end if
end if
call check_nc_status(nf90_inq_varid(ncid, name, varid), _RC)
call check_nc_status(nf90_get_var(ncid, varid, array), _RC)
if(present(group_name)) then
call check_nc_status(nf90_close(ncid2), _RC)
else
call check_nc_status(nf90_close(ncid), _RC)
end if

call check_nc_status(nf90_close(ncid_sv), _RC)
_RETURN(_SUCCESS)

end subroutine get_v1d_netcdf_R8
Expand All @@ -256,9 +257,11 @@ subroutine get_v1d_netcdf_R8_complete(filename, varname, array, att_name, att_va
call check_nc_status(nf90_open(trim(fileName), NF90_NOWRITE, ncid), _RC)
ncid_sv = ncid
if(present(group_name)) then
call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
! mod
ncid = ncid_grp
if(group_name/='') then
call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
! mod
ncid = ncid_grp
end if
end if
call check_nc_status(nf90_inq_varid(ncid, varname, varid), _RC)
call check_nc_status(nf90_get_var(ncid, varid, array), _RC)
Expand Down Expand Up @@ -296,9 +299,11 @@ subroutine get_att_real_netcdf(filename, varname, att_name, att_value, group_nam
call check_nc_status(nf90_open(trim(fileName), NF90_NOWRITE, ncid), _RC)
ncid_sv = ncid
if(present(group_name)) then
call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
! overwrite
ncid = ncid_grp
if(group_name/='') then
call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
! overwrite
ncid = ncid_grp
end if
end if
call check_nc_status(nf90_inq_varid(ncid, varname, varid), _RC)
call check_nc_status(nf90_get_att(ncid, varid, att_name, att_value), _RC)
Expand All @@ -324,9 +329,11 @@ subroutine get_att_char_netcdf(filename, varname, att_name, att_value, group_nam
call check_nc_status(nf90_open(trim(fileName), NF90_NOWRITE, ncid), _RC)
ncid_sv = ncid
if(present(group_name)) then
call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
! overwrite
ncid = ncid_grp
if(group_name/='') then
call check_nc_status(nf90_inq_ncid(ncid, group_name, ncid_grp), _RC)
! overwrite
ncid = ncid_grp
end if
end if
call check_nc_status(nf90_inq_varid(ncid, varname, varid), _RC)
call check_nc_status(nf90_get_att(ncid, varid, att_name, att_value), _RC)
Expand Down
9 changes: 0 additions & 9 deletions gridcomps/History/Sampler/MAPL_TrajectoryMod_smod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -734,20 +734,11 @@
times_R8_full(1), times_R8_full(nend))
call lgr%debug ('%a %i20 %i20', 'jt1, jt2 [final intercepted position]', jt1, jt2)


! if (jt1==jt2) then
! _FAIL('Epoch Time is too small, empty grid is generated, increase Epoch')
! endif

!-- shift the zero item to index 1
zero_obs = .false.
if (jt1/=jt2) then
zero_obs = .false.
if (jt1==0) jt1=1
else
! at most one obs point exist, set it .true.
zero_obs = .true.
!! if (jt1==0) jt1=1
end if

!
Expand Down

0 comments on commit 74ae24c

Please sign in to comment.