Skip to content

Commit

Permalink
Add option in depth interp script (.asc) to add 1/2 cell shift, per
Browse files Browse the repository at this point in the history
Charles' suggestion.
  • Loading branch information
josephzhang8 committed May 26, 2021
1 parent cb894c4 commit fb79cdc
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/Utility/Combining_Scripts/combine_output11_MPI.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ program combine_output
call mpi_comm_dup(MPI_COMM_WORLD,comm,errcode)
call mpi_comm_size(comm,nproc,ierr)
call MPI_COMM_RANK(comm, myrank, errcode)
print *, 'Hello from ', myrank
!print *, 'Hello from ', myrank

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

Expand All @@ -1142,7 +1142,10 @@ program combine_output
call mpi_abort(comm,0,k)
endif

if(myrank==irank) call combine_output11(comm,i,i,iwetdry,to_be_combined,output_prefix)
if(myrank==irank) then
print *, 'MPI rank ', myrank,' is combining stack ',i
call combine_output11(comm,i,i,iwetdry,to_be_combined,output_prefix)
endif
enddo !i

call MPI_FINALIZE(errcode)
Expand Down
16 changes: 9 additions & 7 deletions src/Utility/Grid_Scripts/interpolate_depth_structured2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
read*, ih
print*, 'Add vertical const. to outputs (i.e. change of vdatum):'
read*, vshift
print*, 'Adjust 1/2 cell (for corner based .asc)? 1: yes'
read*, iadjust_corner

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

! if(nx.gt.mnx.or.ny.gt.mny) then
! print*, 'Increase mnx,y to ',nx,ny
! stop
! endif
if(iadjust_corner/=0) then
xmin=xmin+dx/2
ymin=ymin+dy/2
endif

allocate(dp1(nx,ny),stat=istat)
if(istat/=0) stop 'Failed to allocate (1)'

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

! .asc starts from upper left corner and goes along x
! Read starts from upper left corner and goes along x
do iy=1,ny
read(62,*)(dp1(ix,ny-iy+1),ix=1,nx)
write(99,*)'line read in:',iy+6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ program load_dems

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

if(iadjust_corner/=0) then
xmin = xmin + dx/2
ymin = ymin + dy/2
endif

! if(xmin<0) xmin=xmin+360

allocate(dp1(nx,ny),stat=istat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ program load_dems

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

if(iadjust_corner/=0) then
xmin = xmin + dx/2
ymin = ymin + dy/2
endif


!new21
if(xmin>180) then
xmin=xmin-360
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
read*, ih
print*, 'Add vertical const. to outputs (i.e. change of vdatum):'
read*, vshift
print*, 'Adjust 1/2 cell (for corner based .asc)? 1: yes'
read*, iadjust_corner


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

if(iadjust_corner/=0) then
xmin=xmin+dx/2
ymin=ymin+dy/2
endif


! if(nx.gt.mnx.or.ny.gt.mny) then
! print*, 'Increase mnx,y to ',nx,ny
! stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ program load_dems

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

if(iadjust_corner/=0) then
xmin = xmin + dx/2
ymin = ymin + dy/2
endif

!new21
if(xmin<0) xmin=xmin+360

Expand Down

0 comments on commit fb79cdc

Please sign in to comment.