Commit 116b1c1f authored by Sebastian Müller's avatar Sebastian Müller 🎸

EDK_driver: use new edk_dist class; reformat for readability

parent 9fcedbf7
......@@ -29,7 +29,7 @@ program ED_Kriging
grid, gridMeteo, & ! grid properties of input and output grid
nCell, MetSta, &
noDataValue
use kriging , only: dCS, dS, cell
use kriging , only: edk_dist, cell
use mo_setVario , only: setVario, dMatrix
use mo_netcdf , only: NcDataset, NcVariable
use mo_write , only: open_netcdf
......@@ -71,9 +71,9 @@ program ED_Kriging
loop_factor = 10 ! factor for setting openMP loop size
n_threads = 1
!$OMP PARALLEL
!$omp PARALLEL
!$ n_threads = OMP_GET_NUM_THREADS()
!$OMP END PARALLEL
!$omp END PARALLEL
!$ print *, 'Run with OpenMP with ', trim(num2str(n_threads)), ' threads.'
! initialize timers
......@@ -109,7 +109,6 @@ program ED_Kriging
call message(' in ', trim(num2str(timer_get(itimer), '(F9.3)')), ' seconds.')
call message('')
itimer = 3
call timer_start(itimer)
call message(' >>> Estimate variogram')
......@@ -123,7 +122,7 @@ program ED_Kriging
call message(' in ', trim(num2str(timer_get(itimer), '(F9.3)')), ' seconds.')
call message('')
!write(*,*), "jStart = ",jStart
!write(*,*), "jStart = ",jStart
if (interMth .gt. 0) then
itimer = 4
......@@ -133,7 +132,6 @@ program ED_Kriging
! open netcdf if necessary
call open_netcdf(nc_out, nc_data, nc_time)
do iCell = 1, nCell
! initialize cell
allocate(cell(iCell)%Nk_old(nSta))
......@@ -148,7 +146,7 @@ program ED_Kriging
write(*,*),"Total Number of Time Buffers = ",iTime
t = 0
bufferloop: do iTemp = 1, iTime
write(*,*)," >>> Started buffer #", iTemp
jStartTmp = jStart + (iTemp - 1) * tBuffer
if (iTemp .lt. iTime) then
jEndTmp = jStartTmp + tBuffer - 1
......@@ -165,9 +163,9 @@ program ED_Kriging
!print *, iTemp, iTime
!$OMP parallel default(shared) &
!$OMP private(iThread, iCell, X, Nk_old)
!$OMP do SCHEDULE(dynamic)
!$omp parallel default(shared) &
!$omp private(iThread, iCell, X, Nk_old)
!$omp do SCHEDULE(dynamic)
do iThread = 1, loop_factor * n_threads
! print *, 'thread: ', iThread, " start"
......@@ -179,19 +177,13 @@ program ED_Kriging
cycle
end if
! interploation
select case (interMth)
case (1)
call EDK(iCell, jStartTmp, jEndTmp, dCS, MetSta, dS, cell, cell(iCell)%W, cell(iCell)%Nk_old, doOK=.True.)
case (2)
call EDK(iCell, jStartTmp, jEndTmp, dCS, MetSta, dS, cell, cell(iCell)%W, cell(iCell)%Nk_old)
end select
call EDK(iCell, jStartTmp, jEndTmp, edk_dist, MetSta, cell, cell(iCell)%W, cell(iCell)%Nk_old, doOK=(interMth==1))
end do ncellsloop
! print *, 'thread: ', iThread, " end"
end do
!$OMP end do
!$OMP end parallel
!$omp end do
!$omp end parallel
if (DEMNcFlag == 1) then
! write output
......@@ -234,7 +226,6 @@ program ED_Kriging
allocate(tmp_array(gridMeteo%ncols, gridMeteo%nrows, jEndTmp - jStartTmp + 1))
allocate(tmp_time(jEndTmp - jStartTmp + 1))
k = 0
do i = 1, gridMeteo%ncols
! do j = 1, gridMeteo%nrows
......@@ -276,7 +267,6 @@ program ED_Kriging
call nc_data%setData(values=tmp_array,start=(/1,1,sttemp/),cnt=(/size(tmp_array,1),size(tmp_array,2),cnttemp/))
end if
deallocate(tmp_array, tmp_time)
!deallocate(cell)
......@@ -286,11 +276,9 @@ program ED_Kriging
!cell(iCell)%z = noDataValue
end do
! close netcdf if necessary
!call nc_out%close() ! outside
end do bufferloop
! close netcdf if necessary
......@@ -307,4 +295,3 @@ program ED_Kriging
call print_end_message()
!
end program ED_Kriging
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment