-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*add initial unit test for ice QC *modify phantom ice QC, add tests for QC in unit test *revert changes in phantom-ice qc. restrict qc to match only what the ncap2 command produced * modify unit tests accordingly
- Loading branch information
1 parent
166bc39
commit d50ad8a
Showing
5 changed files
with
325 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,8 @@ module utils_mod | |
public :: remap | ||
public :: dumpnc | ||
public :: nf90_err | ||
public :: zero_out_land_ice | ||
public :: zero_out_phantom_ice | ||
|
||
contains | ||
!> Pack 2D fields into arrays by mapping type | ||
|
@@ -699,6 +701,59 @@ subroutine dumpnc1d(fname, vname, dims, field) | |
|
||
end subroutine dumpnc1d | ||
|
||
!> Reset field values to zero on land | ||
!! | ||
!! @param[in] fin the land mask | ||
!! @param[inout] fout the field value | ||
!! @param[out] icnt the number spatial points reset | ||
!! | ||
!! @author [email protected] | ||
subroutine zero_out_land_ice(mask, fout, icnt) | ||
|
||
integer(kind=4), intent(in) :: mask(:) | ||
real(kind=8), intent(inout) :: fout(:,:) | ||
integer, intent(out) :: icnt | ||
|
||
!local variables | ||
integer :: ij | ||
!---------------------------------------------------------------------------- | ||
|
||
icnt = 0 | ||
do ij = 1,size(fout,2) | ||
if ( mask(ij) .eq. 0 .and. sum(fout(:,ij)) .ne. 0.0) then | ||
icnt = icnt + 1 | ||
fout(:,ij) = 0.0 | ||
end if | ||
end do | ||
end subroutine zero_out_land_ice | ||
|
||
!> Ensure that when fin contains zeros for all ncat, fout will also contain zeros | ||
!! for all ncat | ||
!! | ||
!! @param[in] fin the field to test against | ||
!! @param[inout] fout the field tested | ||
!! @param[out] icnt the number spatial points reset | ||
!! | ||
!! @author [email protected] | ||
subroutine zero_out_phantom_ice(fin, fout, icnt) | ||
|
||
real(kind=8), intent(in) :: fin(:,:) | ||
real(kind=8), intent(inout) :: fout(:,:) | ||
integer, intent(out) :: icnt | ||
|
||
!local variables | ||
integer :: ij | ||
!---------------------------------------------------------------------------- | ||
|
||
icnt = 0 | ||
do ij = 1,size(fout,2) | ||
if (sum(fin(:,ij)) .eq. 0.0 .and. sum(fout(:,ij)) .ne. 0.0 ) then | ||
icnt = icnt + 1 | ||
fout(:,ij) = 0.0 | ||
end if | ||
end do | ||
end subroutine zero_out_phantom_ice | ||
|
||
!> Handle netcdf errors | ||
!! | ||
!! @param[in] ierr the error code | ||
|
@@ -712,12 +767,13 @@ subroutine nf90_err(ierr, string) | |
!---------------------------------------------------------------------------- | ||
|
||
if (ierr /= nf90_noerr) then | ||
write(0, '(a)') 'FATAL ERROR: ' // trim(string)// ' : ' // trim(nf90_strerror(ierr)) | ||
! This fails on WCOSS2 with Intel 19 compiler. See | ||
! https://community.intel.com/t5/Intel-Fortran-Compiler/STOP-and-ERROR-STOP-with-variable-stop-codes/m-p/1182521#M149254 | ||
! When WCOSS2 moves to Intel 2020+, uncomment the next line and remove stop 99 | ||
!stop ierr | ||
stop 99 | ||
write(0, '(a)') 'FATAL ERROR: ' // trim(string)// ' : ' // trim(nf90_strerror(ierr)) | ||
! This fails on WCOSS2 with Intel 19 compiler. See | ||
! https://community.intel.com/t5/Intel-Fortran-Compiler/STOP-and-ERROR-STOP-with-variable-stop-codes/m-p/1182521#M149254 | ||
! When WCOSS2 moves to Intel 2020+, uncomment the next line and remove stop 99 | ||
!stop ierr | ||
stop 99 | ||
end if | ||
end subroutine nf90_err | ||
|
||
end module utils_mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.