Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update regional FV3 read interface with parallel netcdf read #441

Merged
merged 4 commits into from
Feb 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions sorc/ncep_post.fd/INITPOST_GFS_NETCDF_PARA.f
Original file line number Diff line number Diff line change
Expand Up @@ -2585,6 +2585,7 @@ subroutine read_netcdf_3d_para(ncid,im,jm,jsta,jsta_2l,jend,jend_2u, &
spval,varname,buf,lm)

use netcdf
use ctlblk_mod, only : me
implicit none
INCLUDE "mpif.h"

Expand All @@ -2594,10 +2595,13 @@ subroutine read_netcdf_3d_para(ncid,im,jm,jsta,jsta_2l,jend,jend_2u, &
real,intent(out) :: buf(im,jsta_2l:jend_2u,lm)
integer :: varid,iret,jj,i,j,l,kk
integer :: start(3), count(3), stride(3)
real,parameter :: spval_netcdf=9.99e+20
real :: fill_value
real,parameter :: small=1.E-6
WenMeng-NOAA marked this conversation as resolved.
Show resolved Hide resolved

iret = nf90_inq_varid(ncid,trim(varname),varid)
if (iret /= 0) then
print*,VarName," not found -Assigned missing values"
if (me == 0) print*,VarName," not found -Assigned missing values"
!$omp parallel do private(i,j,l)
do l=1,lm
do j=jsta,jend
Expand All @@ -2607,10 +2611,19 @@ subroutine read_netcdf_3d_para(ncid,im,jm,jsta,jsta_2l,jend,jend_2u, &
enddo
enddo
else
iret = nf90_get_att(ncid,varid,"_FillValue",fill_value)
if (iret /= 0) fill_value = spval_netcdf
start = (/1,jsta,1/)
jj=jend-jsta+1
count = (/im,jj,lm/)
iret = nf90_get_var(ncid,varid,buf(1:im,jsta:jend,1:lm),start=start,count=count)
do l=1,lm
do j=jsta,jend
do i=1,im
if(abs(buf(i,j,l)-fill_value)<small)buf(i,j,l)=spval
end do
end do
end do
endif

end subroutine read_netcdf_3d_para
Expand All @@ -2619,6 +2632,7 @@ subroutine read_netcdf_2d_para(ncid,im,jsta,jsta_2l,jend,jend_2u, &
spval,VarName,buf)

use netcdf
use ctlblk_mod, only : me
implicit none
INCLUDE "mpif.h"

Expand All @@ -2628,21 +2642,31 @@ subroutine read_netcdf_2d_para(ncid,im,jsta,jsta_2l,jend,jend_2u, &
real,intent(out) :: buf(im,jsta_2l:jend_2u)
integer :: varid,iret,jj,i,j
integer :: start(2), count(2)
real,parameter :: spval_netcdf=9.99e+20
real :: fill_value
real,parameter :: small=1.E-6
WenMeng-NOAA marked this conversation as resolved.
Show resolved Hide resolved

iret = nf90_inq_varid(ncid,trim(varname),varid)
if (iret /= 0) then
print*,VarName," not found -Assigned missing values"
if (me==0) print*,VarName," not found -Assigned missing values"
!$omp parallel do private(i,j)
do j=jsta,jend
do i=1,im
buf(i,j)=spval
enddo
enddo
else
iret = nf90_get_att(ncid,varid,"_FillValue",fill_value)
if (iret /= 0) fill_value = spval_netcdf
start = (/1,jsta/)
jj=jend-jsta+1
count = (/im,jj/)
iret = nf90_get_var(ncid,varid,buf(:,jsta),start=start,count=count)
do j=jsta,jend
do i=1,im
if(abs(buf(i,j)-fill_value)<small)buf(i,j)=spval
end do
end do
endif

end subroutine read_netcdf_2d_para
Loading