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

add the "mgbf" lib as a dependence for using RRFS release branch. (#64) #67

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ find_package(wrf_io REQUIRED)

# Other dependencies
find_package(ncdiag REQUIRED)
find_package(mgbf REQUIRED)
find_package(gsi REQUIRED)

add_subdirectory(baselib/regional_esg_grid.fd)
Expand Down
54 changes: 42 additions & 12 deletions update_gvf.fd/update_GVF.f90
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ PROGRAM update_GVF
real, allocatable :: vegfrc_min(:,:)
real, allocatable :: field2d(:,:)
real, allocatable,target :: field2d4br(:,:)
real*8, allocatable,target :: field2d8br(:,:)
!
! for grib2
!
Expand All @@ -61,6 +62,8 @@ PROGRAM update_GVF
integer :: idatayr,idatamon,idataday,idatahh,idatamm
real :: vegfrcsmax,vegfrcsmin
character(256) :: filename_att
!
character(len=32) :: rrfstype,arg
!
!**********************************************************************
!
Expand All @@ -74,6 +77,14 @@ PROGRAM update_GVF
! NCEP LSF has to use all cores allocated to run this application
! but this if check can make sure only one core run through the real code.
if(mype==0) then

rrfstype='warm'
do i = 1, iargc()
CALL getarg(i, arg)
rrfstype=arg
end do
WRITE (*,*) 'rrfs background type=',trim(rrfstype)

!
!========
!
Expand Down Expand Up @@ -105,14 +116,22 @@ PROGRAM update_GVF
enddo
call rrfs%get_var("grid_latt",nx,ny,ylat)
call rrfs%close()
allocate(field2d4br(nx,ny))

allocate(vegfrc_wrf(nx,ny))
call rrfs%open("sfc_data.nc","r",200)
call rrfs%get_var("vfrac",nx,ny,field2d4br)
vegfrc_wrf=field2d4br(:,:)*100.0
if (trim(rrfstype)=='warm') then
allocate(field2d4br(nx,ny))
call rrfs%get_var("vfrac",nx,ny,field2d4br)
vegfrc_wrf=field2d4br(:,:)*100.0
deallocate(field2d4br)
else
allocate(field2d8br(nx,ny))
call rrfs%get_var("vfrac",nx,ny,field2d8br)
vegfrc_wrf=field2d8br(:,:)*100.0
deallocate(field2d8br)
endif
! call rrfs%get_att("filename",filename_att)
call rrfs%close()
deallocate(field2d4br)
! get date
! read(filename_att(9:21),"(I4,2I2,1x,2I2)") ibkyr,ibkmon,ibkday,ibkhh,ibkmm
else
Expand Down Expand Up @@ -323,16 +342,27 @@ PROGRAM update_GVF
!
!
if(bktype==1) then
allocate(field2d4br(nx,ny))
call rrfs%open('sfc_data.nc',"w",200)
field2d4br=vegfrc*0.01
call rrfs%replace_var("vfrac",nx,ny,field2d4br)
field2d4br=vegfrc_max*0.01
call rrfs%replace_var("shdmax",nx,ny,field2d4br)
field2d4br=vegfrc_min*0.01
call rrfs%replace_var("shdmin",nx,ny,field2d4br)
if (trim(rrfstype)=='warm') then
allocate(field2d4br(nx,ny))
field2d4br=vegfrc*0.01
call rrfs%replace_var("vfrac",nx,ny,field2d4br)
field2d4br=vegfrc_max*0.01
call rrfs%replace_var("shdmax",nx,ny,field2d4br)
field2d4br=vegfrc_min*0.01
call rrfs%replace_var("shdmin",nx,ny,field2d4br)
deallocate(field2d4br)
else
allocate(field2d8br(nx,ny))
field2d8br=vegfrc*0.01
call rrfs%replace_var("vfrac",nx,ny,field2d8br)
field2d8br=vegfrc_max*0.01
call rrfs%replace_var("shdmax",nx,ny,field2d8br)
field2d8br=vegfrc_min*0.01
call rrfs%replace_var("shdmin",nx,ny,field2d8br)
deallocate(field2d8br)
endif
call rrfs%close()
deallocate(field2d4br)
else
filename='wrf_inout'
write(*,*) 'open file =',trim(filename)
Expand Down
Loading