Skip to content

Commit

Permalink
Minor updates to program comments and print statements.
Browse files Browse the repository at this point in the history
Fixes #944.
  • Loading branch information
George Gayno committed Nov 15, 2024
1 parent 8c79cbe commit 4327472
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion sorc/ocean_merge.fd/merge.F90
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ subroutine merge(lon, lat, binary_lake, lat2d, ocn_frac, &
end do
end do

write(*,'(a,i8,a,i8,a)') 'total lake point ',lake_pt,' where ',nodp_pt,' has no depth'
write(*,'(a,i8,a,i8,a)') 'Total lake point ',lake_pt,' where ',nodp_pt,' has no depth'

end subroutine merge
13 changes: 6 additions & 7 deletions sorc/ocean_merge.fd/merge_lake_ocnmsk.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,15 @@ program merge_lake_ocnmsk
character(len=120) :: pth1
character(len=120) :: pth2,pth3
character(len=10) :: atmres,ocnres
! this variable is now renamed as binary_lake and is passed in from the name
! list
! logical, parameter :: int_lake=.true.
! all instances of int_lake was changed to binary_lake
integer :: binary_lake

integer :: binary_lake
integer :: lat,lon,tile

real, allocatable :: lake_frac(:,:),lake_depth(:,:),land_frac(:,:),ocn_frac(:,:),slmsk(:,:),lat2d(:,:)

print*,"- BEGIN OCEAN MERGE PROGRAM."

call read_nml(pth1, pth2, atmres, ocnres, pth3,binary_lake)

print *, pth1

do tile=1,6

Expand All @@ -58,4 +55,6 @@ program merge_lake_ocnmsk

deallocate (lake_frac,lake_depth,land_frac,ocn_frac,slmsk,lat2d)

print*,"- NORMAL TERMINATION."

end program merge_lake_ocnmsk
6 changes: 4 additions & 2 deletions sorc/ocean_merge.fd/namelist.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
!! @param[out] out_dir Directory where output file will be written.
!! @param[out] atmres Atmosphere grid resolution.
!! @param[out] ocnres Ocean grid resolution.
!! @param[out] binary_lake or fractional lake.
!! @param[out] binary_lake When '1', treat lake fraction as either 0 or 1. Otherwise,
!! it is a fraction.
!!
!! @author Rahul Mahajan
!! @author Sanath Kumar
subroutine read_nml(ocean_mask_dir, lake_mask_dir, atmres,ocnres,out_dir,binary_lake)
Expand All @@ -25,7 +27,7 @@ subroutine read_nml(ocean_mask_dir, lake_mask_dir, atmres,ocnres,out_dir,binary_
read(unit,mask_nml, iostat=io_status )
close(unit)
if (io_status > 0) then
print *,'Error reading input.nml'
print *,'FATAL ERROR reading input.nml'
call handle_err(-1)
end if
end subroutine read_nml
8 changes: 4 additions & 4 deletions sorc/ocean_merge.fd/read_write.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!> Read the grid dimensions from a NetCDF file.
!> Read the grid dimensions from the MOM6 ocean mask NetCDF file.
!!
!! @param[in] pth1 Directory path to file.
!! @param[in] atmres Atmospheric resolution.
Expand Down Expand Up @@ -44,7 +44,7 @@ subroutine read_grid_dims(pth1, atmres, ocnres, tile, lon, lat)

end subroutine read_grid_dims

!> Read the ocean fraction from a NetCDF file.
!> Read the ocean fraction from the MOM6 ocean NetCDF file.
!!
!! @param[in] pth1 Directory path to file.
!! @param[in] atmres Atmospheric resolution.
Expand Down Expand Up @@ -95,7 +95,7 @@ end subroutine read_ocean_frac

!> Read lake fraction, lake depth and latitude from a NetCDF file.
!!
!! @param[in] pth2 Directory path to file.
!! @param[in] pth2 Directory path to the file.
!! @param[in] atmres Atmospheric resolution.
!! @param[in] tile Tile number.
!! @param[in] lon E/W dimension of tile.
Expand Down Expand Up @@ -152,7 +152,7 @@ end subroutine read_lake_mask
!! @param[in] lon E/W dimension of tile.
!! @param[in] lat N/S dimension of tile.
!! @param[in] land_frac Land fraction in decimal percent.
!! @param[in] lake_frac Lake fraction in decimal percent.
!! @param[in] lake_frac Lake fraction.
!! @param[in] lake_depth Lake depth in meters.
!! @param[in] slmsk Land/sea mask - 0-non-land; 1-land.
!!
Expand Down
4 changes: 3 additions & 1 deletion sorc/ocean_merge.fd/utils.F90
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
!> Handle netCDF errors.
!> Check NetCDF return code. If an error is indicated,
!! stop program.
!!
!! @param[in] ret NetCDF return code.
!! @author Shan Sun
Expand All @@ -8,6 +9,7 @@ subroutine handle_err (ret)
integer, intent(in) :: ret

if (ret /= NF90_NOERR) then
write(6,*) '- FATAL ERROR.'
write(6,*) nf90_strerror (ret)
stop 999
end if
Expand Down

0 comments on commit 4327472

Please sign in to comment.