Skip to content

Commit

Permalink
- Update some ERROR statements, reduce some line lengths
Browse files Browse the repository at this point in the history
- Refactor time reading in io_netcdf/ice_restart, now similar to pio implementation

- Update github actions gx3 forcing dataset download to reduce size (same data)

- Update documentation
  • Loading branch information
apcraig committed Jan 15, 2024
1 parent dc14ce9 commit 10da928
Show file tree
Hide file tree
Showing 15 changed files with 263 additions and 185 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-cice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ jobs:
run: |
cd $HOME/cice-dirs/input
wget --progress=dot:giga https://zenodo.org/record/3728358/files/CICE_data_gx3_grid_ic-20200320.tar.gz && tar xvfz CICE_data_gx3_grid_ic-20200320.tar.gz
wget --progress=dot:giga https://zenodo.org/record/3728364/files/CICE_data_gx3_forcing_JRA55-20200320.tar.gz && tar xvfz CICE_data_gx3_forcing_JRA55-20200320.tar.gz
# wget --progress=dot:giga https://zenodo.org/record/3728364/files/CICE_data_gx3_forcing_JRA55-20200320.tar.gz && tar xvfz CICE_data_gx3_forcing_JRA55-20200320.tar.gz
wget --progress=dot:giga https://zenodo.org/records/10419929/files/CICE_data_gx3_forcing_JRA55_200501_20231220.tar.gz && tar xvfz CICE_data_gx3_forcing_JRA55_200501_20231220.tar.gz
pwd
ls -alR
# - name: run case
Expand Down
54 changes: 27 additions & 27 deletions cicecore/cicedyn/infrastructure/ice_blocks.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &
do jblock=1,nblocks_y
js = (jblock-1)*block_size_y + 1
if (js > ny_global) call abort_ice(subname// &
'ERROR: Bad block decomp: ny_block too large?')
' ERROR: Bad block decomp: ny_block too large?')
je = js + block_size_y - 1
if (je > ny_global) je = ny_global ! pad array

Expand All @@ -182,7 +182,7 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &

is = (iblock-1)*block_size_x + 1
if (is > nx_global) call abort_ice(subname// &
'ERROR: Bad block decomp: nx_block too large?')
' ERROR: Bad block decomp: nx_block too large?')
ie = is + block_size_x - 1
if (ie > nx_global) ie = nx_global

Expand Down Expand Up @@ -223,7 +223,7 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &
case ('tripoleT')
j_global(j,n) = -j_global(j,n) + 1 ! open
case default
call abort_ice(subname//'ERROR: unknown n-s bndy type')
call abort_ice(subname//' ERROR: unknown n-s bndy type')
end select
endif

Expand All @@ -247,7 +247,7 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &
case ('tripoleT')
j_global(j,n) = -j_global(j,n)
case default
call abort_ice(subname//'ERROR: unknown n-s bndy type')
call abort_ice(subname//' ERROR: unknown n-s bndy type')
end select

!*** set last physical point if padded domain
Expand Down Expand Up @@ -275,7 +275,7 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &
case ('closed')
i_global(i,n) = 0
case default
call abort_ice(subname//'ERROR: unknown e-w bndy type')
call abort_ice(subname//' ERROR: unknown e-w bndy type')
end select
endif

Expand All @@ -295,7 +295,7 @@ subroutine create_blocks(nx_global, ny_global, ew_boundary_type, &
case ('closed')
i_global(i,n) = 0
case default
call abort_ice(subname//'ERROR: unknown e-w bndy type')
call abort_ice(subname//' ERROR: unknown e-w bndy type')
end select

!*** last physical point in padded domain
Expand Down Expand Up @@ -427,7 +427,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
inbr = nblocks_x - iBlock + 1
jnbr = -jBlock
case default
call abort_ice(subname//'ERROR: unknown north boundary')
call abort_ice(subname//' ERROR: unknown north boundary')
end select
endif

Expand All @@ -448,7 +448,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('tripoleT')
jnbr = 0 ! do not write into the neighbor's ghost cells
case default
call abort_ice(subname//'ERROR: unknown south boundary')
call abort_ice(subname//' ERROR: unknown south boundary')
end select
endif

Expand All @@ -465,7 +465,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = 1
case default
call abort_ice(subname//'ERROR: unknown east boundary')
call abort_ice(subname//' ERROR: unknown east boundary')
end select
endif

Expand All @@ -482,7 +482,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = nblocks_x
case default
call abort_ice(subname//'ERROR: unknown west boundary')
call abort_ice(subname//' ERROR: unknown west boundary')
end select
endif

Expand All @@ -499,7 +499,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = 1
case default
call abort_ice(subname//'ERROR: unknown east boundary')
call abort_ice(subname//' ERROR: unknown east boundary')
end select
endif
if (jnbr > nblocks_y) then
Expand All @@ -521,7 +521,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
if (inbr == 0) inbr = nblocks_x
jnbr = -jBlock
case default
call abort_ice(subname//'ERROR: unknown north boundary')
call abort_ice(subname//' ERROR: unknown north boundary')
end select
endif

Expand All @@ -538,7 +538,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = nblocks_x
case default
call abort_ice(subname//'ERROR: unknown west boundary')
call abort_ice(subname//' ERROR: unknown west boundary')
end select
endif
if (jnbr > nblocks_y) then
Expand All @@ -560,7 +560,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
if (inbr > nblocks_x) inbr = 1
jnbr = -jBlock
case default
call abort_ice(subname//'ERROR: unknown north boundary')
call abort_ice(subname//' ERROR: unknown north boundary')
end select
endif

Expand All @@ -577,7 +577,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = 1
case default
call abort_ice(subname//'ERROR: unknown east boundary')
call abort_ice(subname//' ERROR: unknown east boundary')
end select
endif
if (jnbr < 1) then
Expand All @@ -593,7 +593,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('tripoleT')
jnbr = 0 ! do not write into the neighbor's ghost cells
case default
call abort_ice(subname//'ERROR: unknown south boundary')
call abort_ice(subname//' ERROR: unknown south boundary')
end select
endif

Expand All @@ -609,7 +609,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = nblocks_x
case default
call abort_ice(subname//'ERROR: unknown west boundary')
call abort_ice(subname//' ERROR: unknown west boundary')
end select
endif
if (jnbr < 1) then
Expand All @@ -625,7 +625,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('tripoleT')
jnbr = 0 ! do not write into the neighbor's ghost cells
case default
call abort_ice(subname//'ERROR: unknown south boundary')
call abort_ice(subname//' ERROR: unknown south boundary')
end select
endif

Expand All @@ -642,7 +642,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = inbr - nblocks_x
case default
call abort_ice(subname//'ERROR: unknown east boundary')
call abort_ice(subname//' ERROR: unknown east boundary')
end select
endif

Expand All @@ -658,7 +658,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = nblocks_x + inbr
case default
call abort_ice(subname//'ERROR: unknown west boundary')
call abort_ice(subname//' ERROR: unknown west boundary')
end select
endif

Expand All @@ -675,7 +675,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = inbr - nblocks_x
case default
call abort_ice(subname//'ERROR: unknown east boundary')
call abort_ice(subname//' ERROR: unknown east boundary')
end select
endif
if (jnbr > nblocks_y) then
Expand All @@ -697,7 +697,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
if (inbr <= 0) inbr = inbr + nblocks_x
jnbr = -jBlock
case default
call abort_ice(subname//'ERROR: unknown north boundary')
call abort_ice(subname//' ERROR: unknown north boundary')
end select
endif

Expand All @@ -714,7 +714,7 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
case ('cyclic')
inbr = nblocks_x + inbr
case default
call abort_ice(subname//'ERROR: unknown west boundary')
call abort_ice(subname//' ERROR: unknown west boundary')
end select
endif
if (jnbr > nblocks_y) then
Expand All @@ -736,13 +736,13 @@ function ice_blocksGetNbrID(blockID, direction, iBoundary, jBoundary) &
if (inbr > nblocks_x) inbr = inbr - nblocks_x
jnbr = -jBlock
case default
call abort_ice(subname//'ERROR: unknown north boundary')
call abort_ice(subname//' ERROR: unknown north boundary')
end select
endif

case default

call abort_ice(subname//'ERROR: unknown direction')
call abort_ice(subname//' ERROR: unknown direction')
return

end select
Expand Down Expand Up @@ -789,7 +789,7 @@ function get_block(block_id,local_id)
!----------------------------------------------------------------------

if (block_id < 1 .or. block_id > nblocks_tot) then
call abort_ice(subname//'ERROR: invalid block_id')
call abort_ice(subname//' ERROR: invalid block_id')
endif

get_block = all_blocks(block_id)
Expand Down Expand Up @@ -834,7 +834,7 @@ subroutine get_block_parameter(block_id, local_id, &
!----------------------------------------------------------------------

if (block_id < 1 .or. block_id > nblocks_tot) then
call abort_ice(subname//'ERROR: invalid block_id')
call abort_ice(subname//' ERROR: invalid block_id')
endif

if (present(local_id)) local_id = all_blocks(block_id)%local_id
Expand Down
40 changes: 23 additions & 17 deletions cicecore/cicedyn/infrastructure/ice_domain.F90
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ subroutine init_domain_blocks
call get_fileunit(nu_nml)
open (nu_nml, file=trim(nml_filename), status='old',iostat=nml_error)
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: domain_nml open file '// &
call abort_ice(subname//' ERROR: domain_nml open file '// &
trim(nml_filename), file=__FILE__, line=__LINE__)
endif

call goto_nml(nu_nml,trim(nml_name),nml_error)
if (nml_error /= 0) then
call abort_ice(subname//'ERROR: searching for '// trim(nml_name), &
call abort_ice(subname//' ERROR: searching for '// trim(nml_name), &
file=__FILE__, line=__LINE__)
endif

Expand All @@ -194,7 +194,7 @@ subroutine init_domain_blocks
! backspace and re-read erroneous line
backspace(nu_nml)
read(nu_nml,fmt='(A)') tmpstr2
call abort_ice(subname//'ERROR: ' // trim(nml_name) // ' reading ' // &
call abort_ice(subname//' ERROR: ' // trim(nml_name) // ' reading ' // &
trim(tmpstr2), file=__FILE__, line=__LINE__)
endif
end do
Expand Down Expand Up @@ -241,22 +241,22 @@ subroutine init_domain_blocks
!***
!*** domain size zero or negative
!***
call abort_ice(subname//'ERROR: Invalid domain: size < 1', file=__FILE__, line=__LINE__) ! no domain
call abort_ice(subname//' ERROR: Invalid domain: size < 1', file=__FILE__, line=__LINE__) ! no domain
else if (nprocs /= get_num_procs()) then
!***
!*** input nprocs does not match system (eg MPI) request
!***
#if (defined CESMCOUPLED)
nprocs = get_num_procs()
#else
write(nu_diag,*) subname,'ERROR: nprocs, get_num_procs = ',nprocs,get_num_procs()
call abort_ice(subname//'ERROR: Input nprocs not same as system request', file=__FILE__, line=__LINE__)
write(nu_diag,*) subname,' ERROR: nprocs, get_num_procs = ',nprocs,get_num_procs()
call abort_ice(subname//' ERROR: Input nprocs not same as system request', file=__FILE__, line=__LINE__)
#endif
else if (nghost < 1) then
!***
!*** must have at least 1 layer of ghost cells
!***
call abort_ice(subname//'ERROR: Not enough ghost cells allocated', file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Not enough ghost cells allocated', file=__FILE__, line=__LINE__)
endif

!----------------------------------------------------------------------
Expand Down Expand Up @@ -384,7 +384,7 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
file=__FILE__, line=__LINE__)

if (trim(ns_boundary_type) == 'closed') then
call abort_ice(subname//'ERROR: ns_boundary_type = closed not supported', file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: ns_boundary_type = closed not supported', file=__FILE__, line=__LINE__)
allocate(nocn(nblocks_tot))
nocn = 0
do n=1,nblocks_tot
Expand Down Expand Up @@ -417,13 +417,14 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
endif
if (nocn(n) > 0) then
write(nu_diag,*) subname,'ns closed, Not enough land cells along ns edge'
call abort_ice(subname//'ERROR: Not enough land cells along ns edge for ns closed', file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Not enough land cells along ns edge for ns closed', &
file=__FILE__, line=__LINE__)
endif
enddo
deallocate(nocn)
endif
if (trim(ew_boundary_type) == 'closed') then
call abort_ice(subname//'ERROR: ew_boundary_type = closed not supported', file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: ew_boundary_type = closed not supported', file=__FILE__, line=__LINE__)
allocate(nocn(nblocks_tot))
nocn = 0
do n=1,nblocks_tot
Expand Down Expand Up @@ -456,7 +457,8 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
endif
if (nocn(n) > 0) then
write(nu_diag,*) subname,'ew closed, Not enough land cells along ew edge'
call abort_ice(subname//'ERROR: Not enough land cells along ew edge for ew closed', file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Not enough land cells along ew edge for ew closed', &
file=__FILE__, line=__LINE__)
endif
enddo
deallocate(nocn)
Expand Down Expand Up @@ -486,23 +488,27 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
#ifdef USE_NETCDF
status = nf90_open(distribution_wght_file, NF90_NOWRITE, fid)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot open '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Cannot open '//trim(distribution_wght_file), &
file=__FILE__, line=__LINE__)
endif
status = nf90_inq_varid(fid, 'wght', varid)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot find wght '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Cannot find wght '//trim(distribution_wght_file), &
file=__FILE__, line=__LINE__)
endif
status = nf90_get_var(fid, varid, wght)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot get wght '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Cannot get wght '//trim(distribution_wght_file), &
file=__FILE__, line=__LINE__)
endif
status = nf90_close(fid)
if (status /= nf90_noerr) then
call abort_ice(subname//'ERROR: Cannot close '//trim(distribution_wght_file), file=__FILE__, line=__LINE__)
call abort_ice(subname//' ERROR: Cannot close '//trim(distribution_wght_file), &
file=__FILE__, line=__LINE__)
endif
write(nu_diag,*) 'read ',trim(distribution_wght_file),minval(wght),maxval(wght)
#else
call abort_ice(subname//'ERROR: USE_NETCDF cpp not defined', &
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
file=__FILE__, line=__LINE__)
#endif
endif
Expand Down Expand Up @@ -721,7 +727,7 @@ subroutine init_domain_distribution(KMTG,ULATG,grid_ice)
endif

if (nblocks_max > max_blocks) then
write(outstring,*) 'ERROR: num blocks exceed max: increase max to', nblocks_max
write(outstring,*) ' ERROR: num blocks exceed max: increase max to', nblocks_max
call abort_ice(subname//trim(outstring), file=__FILE__, line=__LINE__)
else if (nblocks_max < max_blocks) then
write(outstring,*) 'WARNING: ice no. blocks too large: decrease max to', nblocks_max
Expand Down
Loading

0 comments on commit 10da928

Please sign in to comment.