Skip to content

Commit e693a8f

Browse files
authored
remove obs_id_p (#25)
`obs_id_p` array was only used to generate deprecated copies of `obs_nc2pdaf`, which are removed by this PR as well.
1 parent 75564d9 commit e693a8f

5 files changed

Lines changed: 6 additions & 89 deletions

File tree

interface/framework/g2l_obs_pdaf.F90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SUBROUTINE g2l_obs_pdaf(domain_p, step, dim_obs_f, dim_obs_l, mstate_f, &
5454
!
5555
! !USES:
5656
USE mod_assimilation, &
57-
ONLY: obs_index_l, obs_nc2pdaf_deprecated
57+
ONLY: obs_index_l, obs_nc2pdaf
5858

5959
IMPLICIT NONE
6060

@@ -86,11 +86,11 @@ SUBROUTINE g2l_obs_pdaf(domain_p, step, dim_obs_f, dim_obs_l, mstate_f, &
8686
mstate_l(:) = 0.0
8787

8888
! Set Obs. vector on local domain
89-
! Index array OBS_NC2PDAF_DEPRECATED set in subroutine OBS_OP_F_PDAF
89+
! Index array OBS_NC2PDAF set in subroutine INIT_DIM_OBS_F_PDAF
9090
! Index array OBS_INDEX_L (returns nc-ordered index) set in subroutine INIT_DIM_OBS_L_PDAF
9191
do i=1,dim_obs_l
9292
!mstate_l(i) = mstate_f(obs_index_l(i))
93-
mstate_l(i) = mstate_f(obs_nc2pdaf_deprecated(obs_index_l(i)))
93+
mstate_l(i) = mstate_f(obs_nc2pdaf(obs_index_l(i)))
9494
end do
9595

9696
END SUBROUTINE g2l_obs_pdaf

interface/framework/init_dim_obs_f_pdaf.F90

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ SUBROUTINE init_dim_obs_f_pdaf(step, dim_obs_f)
7373
obs_pdaf2nc, &
7474
local_dims_obs, &
7575
local_disp_obs, &
76-
dim_obs_p, &
77-
obs_id_p
76+
dim_obs_p
7877
#ifndef PARFLOW_STAND_ALONE
7978
#ifndef OBS_ONLY_PARFLOW
8079
!hcp
@@ -443,23 +442,16 @@ SUBROUTINE init_dim_obs_f_pdaf(step, dim_obs_f)
443442

444443
! Number of observations in process-local domain
445444
! ----------------------------------------------
446-
! Additionally `obs_id_p` is set (the NetCDF index of the
447-
! observation corresponding to the state index in the local domain)
448445
dim_obs_p = 0
449446

450447
#ifndef CLMSA
451448
#ifndef OBS_ONLY_CLM
452449
if (model == tag_model_parflow) then
453450

454-
if(allocated(obs_id_p)) deallocate(obs_id_p)
455-
allocate(obs_id_p(enkf_subvecsize))
456-
obs_id_p(:) = 0
457-
458451
do i = 1, dim_obs
459452
do j = 1, enkf_subvecsize
460453
if (idx_obs_nc(i) == idx_map_subvec2state_fortran(j)) then
461454
dim_obs_p = dim_obs_p + 1
462-
obs_id_p(j) = i
463455
end if
464456
end do
465457
end do
@@ -476,10 +468,6 @@ SUBROUTINE init_dim_obs_f_pdaf(step, dim_obs_f)
476468

477469
if(model == tag_model_clm) then
478470

479-
if(allocated(obs_id_p)) deallocate(obs_id_p)
480-
allocate(obs_id_p(endg-begg+1))
481-
obs_id_p(:) = 0
482-
483471
do i = 1, dim_obs
484472
cnt = 1
485473
obs_snapped = .false.
@@ -496,7 +484,6 @@ SUBROUTINE init_dim_obs_f_pdaf(step, dim_obs_f)
496484
if(((is_use_dr).and.(deltax<=clmobs_dr(1)).and.(deltay<=clmobs_dr(2))).or. &
497485
((.not. is_use_dr).and.(longxy_obs(i) == longxy(cnt)) .and. (latixy_obs(i) == latixy(cnt)))) then
498486
dim_obs_p = dim_obs_p + 1
499-
obs_id_p(cnt) = i
500487

501488
! if (is_use_dr) then
502489
! call GetGlobalWrite(g,nameg)

interface/framework/init_dim_obs_pdaf.F90

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ SUBROUTINE init_dim_obs_pdaf(step, dim_obs_p)
6868
pressure_obserr_p, clm_obserr_p, &
6969
obs_pdaf2nc, &
7070
local_dims_obs, &
71-
local_disp_obs, &
71+
local_disp_obs
7272
! dim_obs_p, &
73-
obs_id_p
7473
#ifndef PARFLOW_STAND_ALONE
7574
#ifndef OBS_ONLY_PARFLOW
7675
!hcp
@@ -439,23 +438,16 @@ SUBROUTINE init_dim_obs_pdaf(step, dim_obs_p)
439438

440439
! Number of observations in process-local domain
441440
! ----------------------------------------------
442-
! Additionally `obs_id_p` is set (the NetCDF index of the
443-
! observation corresponding to the state index in the local domain)
444441
dim_obs_p = 0
445442

446443
#ifndef CLMSA
447444
#ifndef OBS_ONLY_CLM
448445
if (model == tag_model_parflow) then
449446

450-
if(allocated(obs_id_p)) deallocate(obs_id_p)
451-
allocate(obs_id_p(enkf_subvecsize))
452-
obs_id_p(:) = 0
453-
454447
do i = 1, dim_obs
455448
do j = 1, enkf_subvecsize
456449
if (idx_obs_nc(i) == idx_map_subvec2state_fortran(j)) then
457450
dim_obs_p = dim_obs_p + 1
458-
obs_id_p(j) = i
459451
end if
460452
end do
461453
end do
@@ -472,10 +464,6 @@ SUBROUTINE init_dim_obs_pdaf(step, dim_obs_p)
472464

473465
if(model == tag_model_clm) then
474466

475-
if(allocated(obs_id_p)) deallocate(obs_id_p)
476-
allocate(obs_id_p(endg-begg+1))
477-
obs_id_p(:) = 0
478-
479467
do i = 1, dim_obs
480468
cnt = 1
481469
obs_snapped = .false.
@@ -492,7 +480,6 @@ SUBROUTINE init_dim_obs_pdaf(step, dim_obs_p)
492480
if(((is_use_dr).and.(deltax<=clmobs_dr(1)).and.(deltay<=clmobs_dr(2))).or. &
493481
((.not. is_use_dr).and.(longxy_obs(i) == longxy(cnt)) .and. (latixy_obs(i) == latixy(cnt)))) then
494482
dim_obs_p = dim_obs_p + 1
495-
obs_id_p(cnt) = i
496483

497484
! if (is_use_dr) then
498485
! call GetGlobalWrite(g,nameg)

interface/framework/mod_assimilation.F90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ MODULE mod_assimilation
9393
INTEGER, ALLOCATABLE :: var_id_obs(:) ! for remote sensing data the variable identifier to group
9494
! variables distributed over a grid surface area
9595
!kuw
96-
INTEGER, ALLOCATABLE :: obs_id_p(:) ! ID of observation point in PE-local domain
97-
INTEGER, ALLOCATABLE :: obs_nc2pdaf_deprecated(:) ! index for mapping mstate to local domain
9896
INTEGER, ALLOCATABLE :: obs_nc2pdaf(:) ! index for mapping mstate to local domain
9997
!kuw end
10098

interface/framework/obs_op_f_pdaf.F90

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,10 @@ SUBROUTINE obs_op_f_pdaf(step, dim_p, dim_obs_f, state_p, m_state_f)
5656
! Later revisions - see svn log
5757
!
5858
! !USES:
59-
USE mpi, ONLY: MPI_DOUBLE
6059
USE mpi, ONLY: MPI_DOUBLE_PRECISION
61-
USE mpi, ONLY: MPI_INT
62-
USE mpi, ONLY: MPI_SUM
6360
USE mpi, ONLY: MPI_ALLGATHERV
6461
USE mod_assimilation, &
65-
ONLY: obs_index_p, local_dims_obs, local_disp_obs, obs_id_p, obs_nc2pdaf_deprecated, &
62+
ONLY: obs_index_p, local_dims_obs, local_disp_obs, &
6663
var_id_obs, dim_obs_p
6764
USE mod_assimilation, ONLY: obs_pdaf2nc
6865
USE mod_assimilation, ONLY: obs_nc2pdaf
@@ -91,8 +88,6 @@ SUBROUTINE obs_op_f_pdaf(step, dim_p, dim_obs_f, state_p, m_state_f)
9188
INTEGER :: ierror, max_var_id
9289
INTEGER :: i ! Counter
9390
REAL, ALLOCATABLE :: m_state_tmp(:) ! Temporary process-local state vector
94-
INTEGER, ALLOCATABLE :: obs_nc2pdaf_deprecated_p_tmp(:)
95-
INTEGER, ALLOCATABLE :: obs_nc2pdaf_deprecated_tmp(:)
9691

9792
! *********************************************
9893
! *** Perform application of measurement ***
@@ -110,16 +105,9 @@ SUBROUTINE obs_op_f_pdaf(step, dim_p, dim_obs_f, state_p, m_state_f)
110105

111106
! Initialize process-local observed state
112107
ALLOCATE(m_state_tmp(dim_obs_p))
113-
allocate(obs_nc2pdaf_deprecated_p_tmp (dim_obs_p))
114-
115-
if(allocated(obs_nc2pdaf_deprecated)) deallocate(obs_nc2pdaf_deprecated)
116-
allocate(obs_nc2pdaf_deprecated(dim_obs_f))
117-
if(allocated(obs_nc2pdaf_deprecated_tmp)) deallocate(obs_nc2pdaf_deprecated_tmp)
118-
allocate(obs_nc2pdaf_deprecated_tmp(dim_obs_f))
119108

120109
DO i = 1, dim_obs_p
121110
m_state_tmp(i) = state_p(obs_index_p(i))
122-
obs_nc2pdaf_deprecated_p_tmp(i) = obs_id_p(obs_index_p(i))
123111
END DO
124112

125113
!print *,'local_dims_obs(mype_filter+1) ', local_dims_obs(mype_filter+1)
@@ -132,47 +120,4 @@ SUBROUTINE obs_op_f_pdaf(step, dim_p, dim_obs_f, state_p, m_state_f)
132120
MPI_DOUBLE_PRECISION, m_state_f, local_dims_obs, local_disp_obs, &
133121
MPI_DOUBLE_PRECISION, comm_filter, ierror)
134122

135-
! gather obs_nc2pdaf_deprecated_p
136-
CALL mpi_allgatherv(obs_nc2pdaf_deprecated_p_tmp, dim_obs_p, &
137-
MPI_INT, obs_nc2pdaf_deprecated, local_dims_obs, local_disp_obs, &
138-
MPI_INT, comm_filter, ierror)
139-
140-
! At this point OBS_NC2PDAF_DEPRECATED should be the same as OBS_PDAF2NC from
141-
! INIT_DIM_OBS_PDAF / INIT_DIM_OBS_F_PDAF
142-
do i = 1, dim_obs_f
143-
if(.not. obs_nc2pdaf_deprecated(i) == obs_pdaf2nc(i)) then
144-
print *, "TSMP-PDAF mype(w)=", mype_world, ": ERROR in observation index arrays"
145-
print *, "i=", i
146-
print *, "obs_nc2pdaf_deprecated(i)=", obs_nc2pdaf_deprecated(i)
147-
print *, "obs_pdaf2nc(i)=", obs_pdaf2nc(i)
148-
call abort_parallel()
149-
end if
150-
end do
151-
152-
! Then OBS_NC2PDAF_DEPRECATED is inverted in the following lines
153-
154-
! resort obs_nc2pdaf_deprecated_p
155-
do i=1,dim_obs_f
156-
obs_nc2pdaf_deprecated_tmp(i) = obs_nc2pdaf_deprecated(i)
157-
enddo
158-
do i=1,dim_obs_f
159-
! print *,'obs_nc2pdaf_deprecated_tmp(i) ', obs_nc2pdaf_deprecated_tmp(i)
160-
obs_nc2pdaf_deprecated(obs_nc2pdaf_deprecated_tmp(i)) = i
161-
enddo
162-
163-
! At this point OBS_NC2PDAF_DEPRECATED should be the same as OBS_NC2PDAF from
164-
! INIT_DIM_OBS_PDAF / INIT_DIM_OBS_F_PDAF
165-
do i = 1, dim_obs_f
166-
if(.not. obs_nc2pdaf_deprecated(i) == obs_nc2pdaf(i)) then
167-
print *, "TSMP-PDAF mype(w)=", mype_world, ": ERROR in observation index arrays"
168-
print *, "i=", i
169-
print *, "obs_nc2pdaf_deprecated(i)=", obs_nc2pdaf_deprecated(i)
170-
print *, "obs_nc2pdaf(i)=", obs_nc2pdaf(i)
171-
call abort_parallel()
172-
end if
173-
end do
174-
175-
! Clean up
176-
DEALLOCATE(m_state_tmp,obs_nc2pdaf_deprecated_p_tmp,obs_nc2pdaf_deprecated_tmp)
177-
178123
END SUBROUTINE obs_op_f_pdaf

0 commit comments

Comments
 (0)