From 46e706c30a0d8fe5408bde962d5ae7fca64b9dff Mon Sep 17 00:00:00 2001 From: joeran maerz Date: Thu, 31 Oct 2024 14:30:47 +0100 Subject: [PATCH] change netcdf read for shelf sea mask --- hamocc/mo_read_shelfmask.F90 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hamocc/mo_read_shelfmask.F90 b/hamocc/mo_read_shelfmask.F90 index 4ee77237..9f82992f 100644 --- a/hamocc/mo_read_shelfmask.F90 +++ b/hamocc/mo_read_shelfmask.F90 @@ -48,6 +48,8 @@ subroutine read_shelfmask(kpie,kpje,kbnd,pbath,omask) use mod_nctools, only: ncfopn,ncread,ncfcls use mo_control_bgc, only: use_shelfsea_res_time,io_stdo_bgc use mo_param_bgc, only: shelfbreak_depth + use netcdf, only: nf90_open,nf90_close,nf90_nowrite + use mo_netcdf_bgcrw,only: read_netcdf_var !Arguments integer, intent(in) :: kpie ! 1st dimension of model grid @@ -58,7 +60,7 @@ subroutine read_shelfmask(kpie,kpje,kbnd,pbath,omask) ! Local variables logical :: file_exists=.false. - integer :: i,j,errstat,dummymask(2) + integer :: i,j,errstat,dummymask(2),ncid,ncstat real,allocatable :: mask(:,:) @@ -98,9 +100,14 @@ subroutine read_shelfmask(kpie,kpje,kbnd,pbath,omask) write(io_stdo_bgc,*) '' write(io_stdo_bgc,'(a)') 'read_shelfmask: read mask from ',trim(shelfsea_maskfile) endif - call ncfopn(trim(shelfsea_maskfile),'r',' ',1,iotype) - call ncread('shelfmask',mask,dummymask,0,0.) - call ncfcls + + ncstat=nf90_open(trim(shelfsea_maskfile),nf90_nowrite,ncid) + call read_netcdf_var(ncid,'shelfmask',mask,1,1,0) + ncstat=nf90_close(ncid) + + !call ncfopn(trim(shelfsea_maskfile),'r',' ',1,iotype) + !call ncread('shelfmask',mask,dummymask,0,0.) + !call ncfcls else ! reconstruct shelf sea mask from internal bathymetry !$OMP DO PARALLEL PRIVATE (i,j)