Skip to content

Commit

Permalink
code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
metdyn committed Jun 21, 2024
1 parent 2b335c5 commit 31e69bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
32 changes: 4 additions & 28 deletions gridcomps/History/Sampler/MAPL_StationSamplerMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,10 @@ function new_StationSampler_readfile (bundle, filename, nskip_line, GENSTATE, rc
call ESMF_FieldBundleGet(bundle,grid=grid,_RC)
sampler%LS_ds = sampler%LSF%create_locstream_on_proc(grid=grid,_RC)

!
! init ofile
sampler%ofile=''
sampler%obs_written=0
sampler%level_by_level = .false. ! .true.
sampler%level_by_level = .false.

_RETURN(_SUCCESS)
end function new_StationSampler_readfile
Expand Down Expand Up @@ -391,7 +390,6 @@ subroutine add_metadata_route_handle (this,items,bundle,timeInfo,vdata,rc)
iter = this%items%begin()
do while (iter /= this%items%end())
item => iter%get()
!!print*, 'list item%xname', trim(item%xname)
if (item%itemType == ItemTypeScalar) then
call this%create_variable(item%xname,_RC)
else if (item%itemType == ItemTypeVector) then
Expand All @@ -415,7 +413,6 @@ subroutine add_metadata_route_handle (this,items,bundle,timeInfo,vdata,rc)
call ESMF_FieldGet( chunk_field, localDE=0, farrayPtr=pt2, _RC )
pt1=0.0
pt2=0.0
!! print*, 'shape(pt1 LS_ds)', shape(pt1)
call ESMF_FieldRedistStore(src_field,chunk_field,this%RH,_RC)
call ESMF_FieldDestroy(src_field,noGarbage=.true.,_RC)
call ESMF_FieldDestroy(chunk_field,noGarbage=.true.,_RC)
Expand Down Expand Up @@ -462,7 +459,6 @@ subroutine create_metadata_variable(this,vname,rc)
case default
_FAIL('unsupported rank')
end select
! v = variable(type=PFIO_REAL32,dimensions=trim(vdims),chunksizes=chunksizes)
v = variable(type=PFIO_REAL32,dimensions=trim(vdims))

call v%add_attribute('units',trim(units))
Expand Down Expand Up @@ -526,12 +522,10 @@ subroutine append_file(this,current_time,rc)
integer :: is, ie, ierr
integer :: M, N, ip


this%obs_written=this%obs_written+1

!__ 1. put_var: time variable
!
!
rtimes = this%compute_time_for_current(current_time,_RC) ! rtimes: seconds since opening file
if (mapl_am_i_root()) then
call this%formatter%put_var('time',rtimes(1:1),&
Expand All @@ -542,8 +536,9 @@ subroutine append_file(this,current_time,rc)
!__ 2. regrid + put_var:
! ungridded_dim from src to dst [regrid]
!
! caution about zero-sized array for MPI
! redist
! caution about zero-sized array for MPI
! redist
!
nx_sum = this%nstation
lm = this%vdata%lm
call ESMF_VMGetCurrent(vm,_RC)
Expand Down Expand Up @@ -608,9 +603,6 @@ subroutine append_file(this,current_time,rc)

call MAPL_TimerOff(this%GENSTATE,"FieldCreate")


!! call MAPL_TimerOn(this%GENSTATE,"Full_regrid")

iter = this%items%begin()
do while (iter /= this%items%end())
item => iter%get()
Expand Down Expand Up @@ -639,13 +631,6 @@ subroutine append_file(this,current_time,rc)
!
call ESMF_FieldGet(src_field,localDE=0,farrayptr=qin_3d,_RC)

!! -- did not improve performance
!!call MAPL_TimerOn(this%GENSTATE,"kloopreshape")
!!do k=1, lm
!! p_src_3d(k,:,:) = qin_3d(:,:,k)
!!end do
!!call MAPL_TimerOff(this%GENSTATE,"kloopreshape")

call MAPL_TimerOn(this%GENSTATE,"reshape")
p_src_3d = reshape(qin_3d,shape(p_src_3d),order=[2,3,1])
call MAPL_TimerOff(this%GENSTATE,"reshape")
Expand All @@ -654,8 +639,6 @@ subroutine append_file(this,current_time,rc)
call ESMF_FieldRegrid (new_src_field, new_dst_field, this%regridder%route_handle, _RC)
call MAPL_TimerOff(this%GENSTATE,"3d_regrid")



call MPI_Barrier(mpic,ierr)
_VERIFY (ierr)
call MAPL_TimerOn(this%GENSTATE,"FieldRedist")
Expand All @@ -665,8 +648,6 @@ subroutine append_file(this,current_time,rc)
call MAPL_TimerOff(this%GENSTATE,"FieldRedist")


call MPI_Barrier(mpic,ierr)
_VERIFY (ierr)
call MAPL_TimerOn(this%GENSTATE,"gatherv")
if (this%level_by_level) then
! p_chunk_3d (lm, nx)
Expand All @@ -684,8 +665,6 @@ subroutine append_file(this,current_time,rc)
p_rt_3d, recvcount_v, displs_v, MPI_REAL,&
iroot, mpic, ierr )
end if
call MPI_Barrier(mpic,ierr)
_VERIFY (ierr)
call MAPL_TimerOff(this%GENSTATE,"gatherv")


Expand All @@ -707,8 +686,6 @@ subroutine append_file(this,current_time,rc)
call iter%next()
end do

!! call MAPL_TimerOff(this%GENSTATE,"Full_regrid")


call MAPL_TimerOn(this%GENSTATE,"FieldDestroy")
call ESMF_FieldDestroy(field_ds_2d, noGarbage=.true., _RC)
Expand Down Expand Up @@ -935,7 +912,6 @@ subroutine CSV_read_line_with_CH_I_R(line, name, lon, lat, rc)
endif
_ASSERT (ios==0, 'read error')


k=index(line(j+1:), '.')
if (k > 0) then
read(line(j+1:), *, iostat=ios) lat
Expand Down
2 changes: 1 addition & 1 deletion gridcomps/History/Sampler/MAPL_TrajectoryMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module HistoryTrajectoryMod
integer :: obsfile_Ts_index ! for epoch
integer :: obsfile_Te_index
logical :: active ! case: when no obs. exist
logical :: level_by_level = .true.
logical :: level_by_level = .false.
! note
! for MPI_GATHERV of 3D data in procedure :: append_file
! we have choice LEVEL_BY_LEVEL or ALL_AT_ONCE (timing in sec below for extdata)
Expand Down

0 comments on commit 31e69bb

Please sign in to comment.