Skip to content

Commit

Permalink
Update pio and netcdf error checks (CICE-Consortium#927)
Browse files Browse the repository at this point in the history
Update pio and netcdf error checks

---------

Co-authored-by: anton-climate <anton.steketee@anu.edu.au>
Co-authored-by: Anton Steketee <79179784+anton-seaice@users.noreply.github.com>
  • Loading branch information
3 people authored and DeniseWorthen committed Apr 7, 2024
1 parent e926b53 commit f6e758e
Show file tree
Hide file tree
Showing 26 changed files with 3,293 additions and 3,033 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test-cice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ 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/records/10419929/files/CICE_data_gx3_forcing_JRA55_200501_20231220.tar.gz && tar xvfz CICE_data_gx3_forcing_JRA55_200501_20231220.tar.gz
pwd
cd CICE_data/forcing/gx3/JRA55/8XDAILY
ln -s JRA55_gx3_03hr_forcing_200501.nc JRA55_gx3_03hr_forcing_2005.nc
cd $HOME/cice-dirs/input
ls -alR
# - name: run case
# run: |
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/analysis/ice_history.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!
! The following variables are currently hard-wired as snapshots
! (instantaneous rather than time-averages):
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! frz_onset, hisnap, aisnap
!
! Options for histfreq: '1','h','d','m','y','x', where x means that
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/analysis/ice_history_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
!
! The following variables are currently hard-wired as snapshots
! (instantaneous rather than time-averages):
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! divu, shear, vort, sig1, sig2, sigP, trsig, mlt_onset,
! frz_onset, hisnap, aisnap
!
! Options for histfreq: '1','h','d','m','y','x', where x means that
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/dynamics/ice_dyn_shared.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ subroutine deformations (nx_block, ny_block, &
tarear ! 1/tarea

real (kind=dbl_kind), dimension (nx_block,ny_block), intent(inout) :: &
vort , & ! vorticity (1/s)
vort , & ! vorticity (1/s)
shear , & ! strain rate II component (1/s)
divu , & ! strain rate I component, velocity divergence (1/s)
rdg_conv , & ! convergence term for ridging (1/s)
Expand Down
2 changes: 1 addition & 1 deletion cicecore/cicedyn/dynamics/ice_transport_remap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ subroutine construct_fields (nx_block, ny_block, &

! center of mass (mxav,myav) for each cell

mxav(i,j) = mx(i,j)*xxav / mm(i,j)
mxav(i,j) = mx(i,j)*xxav / mm(i,j)
myav(i,j) = my(i,j)*yyav / mm(i,j)

enddo
Expand Down
10 changes: 9 additions & 1 deletion cicecore/cicedyn/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module ice_forcing
daymo, days_per_year, compute_days_between
use ice_fileunits, only: nu_diag, nu_forcing
use ice_exit, only: abort_ice
use ice_read_write, only: ice_open, ice_read, &
use ice_read_write, only: ice_open, ice_read, ice_check_nc, &
ice_get_ncvarsize, ice_read_vec_nc, &
ice_open_nc, ice_read_nc, ice_close_nc
use ice_timers, only: ice_timer_start, ice_timer_stop, timer_readwrite, &
Expand Down Expand Up @@ -3701,11 +3701,15 @@ subroutine ocn_data_ncar_init

! status = nf90_inq_dimid(fid,'nlon',dimid)
status = nf90_inq_dimid(fid,'ni',dimid)
call ice_check_nc(status, subname//' ERROR: inq dimid ni', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlon)
call ice_check_nc(status, subname//' ERROR: inq dim ni', file=__FILE__, line=__LINE__)

! status = nf90_inq_dimid(fid,'nlat',dimid)
status = nf90_inq_dimid(fid,'nj',dimid)
call ice_check_nc(status, subname//' ERROR: inq dimid nj', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlat)
call ice_check_nc(status, subname//' ERROR: inq dim nj', file=__FILE__, line=__LINE__)

if( nlon .ne. nx_global ) then
call abort_ice (error_message=subname//'ice: ocn frc file nlon ne nx_global', &
Expand Down Expand Up @@ -3862,11 +3866,15 @@ subroutine ocn_data_ncar_init_3D

! status = nf90_inq_dimid(fid,'nlon',dimid)
status = nf90_inq_dimid(fid,'ni',dimid)
call ice_check_nc(status, subname//' ERROR: inq dimid ni', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlon)
call ice_check_nc(status, subname//' ERROR: inq dim ni', file=__FILE__, line=__LINE__)

! status = nf90_inq_dimid(fid,'nlat',dimid)
status = nf90_inq_dimid(fid,'nj',dimid)
call ice_check_nc(status, subname//' ERROR: inq dimid nj', file=__FILE__, line=__LINE__)
status = nf90_inquire_dimension(fid,dimid,len=nlat)
call ice_check_nc(status, subname//' ERROR: inq dim nj', file=__FILE__, line=__LINE__)

if( nlon .ne. nx_global ) then
call abort_ice (error_message=subname//'ice: ocn frc file nlon ne nx_global', &
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
Loading

0 comments on commit f6e758e

Please sign in to comment.