Skip to content

Commit fb79cdc

Browse files
committed
Add option in depth interp script (.asc) to add 1/2 cell shift, per
Charles' suggestion.
1 parent cb894c4 commit fb79cdc

File tree

6 files changed

+42
-9
lines changed

6 files changed

+42
-9
lines changed

src/Utility/Combining_Scripts/combine_output11_MPI.F90

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ program combine_output
11261126
call mpi_comm_dup(MPI_COMM_WORLD,comm,errcode)
11271127
call mpi_comm_size(comm,nproc,ierr)
11281128
call MPI_COMM_RANK(comm, myrank, errcode)
1129-
print *, 'Hello from ', myrank
1129+
!print *, 'Hello from ', myrank
11301130

11311131
call combine_output11_input(comm,ibgn,iend,iwetdry,to_be_combined,output_prefix)
11321132

@@ -1142,7 +1142,10 @@ program combine_output
11421142
call mpi_abort(comm,0,k)
11431143
endif
11441144

1145-
if(myrank==irank) call combine_output11(comm,i,i,iwetdry,to_be_combined,output_prefix)
1145+
if(myrank==irank) then
1146+
print *, 'MPI rank ', myrank,' is combining stack ',i
1147+
call combine_output11(comm,i,i,iwetdry,to_be_combined,output_prefix)
1148+
endif
11461149
enddo !i
11471150

11481151
call MPI_FINALIZE(errcode)

src/Utility/Grid_Scripts/interpolate_depth_structured2.f90

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
read*, ih
3434
print*, 'Add vertical const. to outputs (i.e. change of vdatum):'
3535
read*, vshift
36+
print*, 'Adjust 1/2 cell (for corner based .asc)? 1: yes'
37+
read*, iadjust_corner
3638

3739
open(62,file='struc.grd',status='old')
3840
read(62,*) cha1,nx !# of nodes in x
@@ -44,19 +46,19 @@
4446
dx=dxy
4547
dy=dxy
4648

47-
! if(nx.gt.mnx.or.ny.gt.mny) then
48-
! print*, 'Increase mnx,y to ',nx,ny
49-
! stop
50-
! endif
49+
if(iadjust_corner/=0) then
50+
xmin=xmin+dx/2
51+
ymin=ymin+dy/2
52+
endif
53+
5154
allocate(dp1(nx,ny),stat=istat)
5255
if(istat/=0) stop 'Failed to allocate (1)'
5356

54-
! Coordinates for upper left corner (the starting point for *.asc)
57+
! Max
5558
ymax=ymin+(ny-1)*dy
56-
! xmax
5759
xmax=xmin+(nx-1)*dx
5860

59-
! .asc starts from upper left corner and goes along x
61+
! Read starts from upper left corner and goes along x
6062
do iy=1,ny
6163
read(62,*)(dp1(ix,ny-iy+1),ix=1,nx)
6264
write(99,*)'line read in:',iy+6

src/Utility/Grid_Scripts/interpolate_depth_structured2_mpi.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ program load_dems
4343

4444
ih=-1 !sign change
4545
vshift=0 !vertical datum diff
46+
iadjust_corner=0 !adjustll corner for corner based .asc
4647
open(10,file='dems.in',status='old')
4748
read(10,*)ndems
4849
read(10,*)ncompute !# of compute nodes
@@ -166,6 +167,11 @@ program load_dems
166167
dx=dxy
167168
dy=dxy
168169

170+
if(iadjust_corner/=0) then
171+
xmin = xmin + dx/2
172+
ymin = ymin + dy/2
173+
endif
174+
169175
! if(xmin<0) xmin=xmin+360
170176

171177
allocate(dp1(nx,ny),stat=istat)

src/Utility/Pre-Processing/Global_SCHISM/interpolate_depth_structured2_mpi.f90

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ program load_dems
4646

4747
ih=-1 !sign change
4848
vshift=0 !vertical datum diff
49+
iadjust_corner=0 !adjustll corner for corner based .asc
4950
open(10,file='dems.in',status='old')
5051
read(10,*)ndems
5152
read(10,*)ncompute !# of compute nodes
@@ -179,6 +180,12 @@ program load_dems
179180
dx=dxy
180181
dy=dxy
181182

183+
if(iadjust_corner/=0) then
184+
xmin = xmin + dx/2
185+
ymin = ymin + dy/2
186+
endif
187+
188+
182189
!new21
183190
if(xmin>180) then
184191
xmin=xmin-360

src/Utility/Pre-Processing/NWM/Load_Bathy_mpi/interpolate_depth_structured2.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
read*, ih
2020
print*, 'Add vertical const. to outputs (i.e. change of vdatum):'
2121
read*, vshift
22+
print*, 'Adjust 1/2 cell (for corner based .asc)? 1: yes'
23+
read*, iadjust_corner
24+
2225

2326
open(62,file='struc.grd',status='old')
2427
read(62,*) cha1,nx !# of nodes in x
@@ -30,6 +33,12 @@
3033
dx=dxy
3134
dy=dxy
3235

36+
if(iadjust_corner/=0) then
37+
xmin=xmin+dx/2
38+
ymin=ymin+dy/2
39+
endif
40+
41+
3342
! if(nx.gt.mnx.or.ny.gt.mny) then
3443
! print*, 'Increase mnx,y to ',nx,ny
3544
! stop

src/Utility/Pre-Processing/Pacific_project_2021/interpolate_depth_structured2_mpi.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ program load_dems
4646

4747
ih=-1 !sign change
4848
vshift=0 !vertical datum diff
49+
iadjust_corner=0 !adjustll corner for corner based .asc
4950
open(10,file='dems.in',status='old')
5051
read(10,*)ndems
5152
read(10,*)ncompute !# of compute nodes
@@ -176,6 +177,11 @@ program load_dems
176177
dx=dxy
177178
dy=dxy
178179

180+
if(iadjust_corner/=0) then
181+
xmin = xmin + dx/2
182+
ymin = ymin + dy/2
183+
endif
184+
179185
!new21
180186
if(xmin<0) xmin=xmin+360
181187

0 commit comments

Comments
 (0)