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

chgres_cube grib2 GFS data support #48

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
2396483
chgres_cube_grib2_atmos: This commit references #66221
LarissaReames-NOAA Jul 18, 2019
736b24f
chgres_cube_grib2_atmos: This commit references #66221
LarissaReames-NOAA Jul 19, 2019
9e437ee
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Jul 18, 2019
94cc0fe
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Jul 19, 2019
5b1dfa5
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Jul 21, 2019
44ea443
Merge branch 'feature/chgres_cube_grib2_atmos' of gerrit:UFS_UTILS in…
LarissaReames-NOAA Jul 21, 2019
d414c42
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Aug 7, 2019
3521075
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Aug 7, 2019
ae22e22
feature/chgres_cube_grib2_atmos: This commit references #66268.
GeorgeGayno-NOAA Aug 16, 2019
c2adf96
feature/chgres_cube_grib2_atmos: This commit references #66268.
GeorgeGayno-NOAA Aug 16, 2019
ff603b9
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Aug 19, 2019
427061d
Merge branch 'feature/chgres_cube_grib2_atmos' of gerrit:UFS_UTILS in…
LarissaReames-NOAA Aug 19, 2019
591ef88
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Aug 20, 2019
8592b81
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Aug 21, 2019
d6c9b31
chgres_cube_grib2_atmos: This commit references #66268 (#8)
LarissaReames-NOAA Aug 23, 2019
8aa3b63
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 4, 2019
a38b232
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 4, 2019
01c6f1d
feature/hera_port This commit references issue #1.
GeorgeGayno-NOAA Sep 4, 2019
5a0e912
feature/hera_port This commit references issue #1.
GeorgeGayno-NOAA Sep 4, 2019
ec327b8
feature/hera_port This commit references issue #1.
GeorgeGayno-NOAA Sep 5, 2019
e2a0aad
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 6, 2019
bae8fea
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 6, 2019
e44ff25
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 6, 2019
00de954
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 9, 2019
3241cfa
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 9, 2019
2044db3
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 9, 2019
e5c508d
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 10, 2019
b1951d1
feature/hera_port This commit references #1.
GeorgeGayno-NOAA Sep 11, 2019
ac49bb5
chgres_cube_grib2_atmos: This commit references #66268
LarissaReames-NOAA Sep 11, 2019
a5dd089
Merge branch 'feature/chgres_cube_grib2_atmos' into feature/chgres_cu…
LarissaReames-NOAA Sep 11, 2019
009496c
Feature/chgres cube grib2 atmos (#13)
LarissaReames-NOAA Sep 12, 2019
7dbe65c
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 12, 2019
ba9d991
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 13, 2019
d88bf1c
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 13, 2019
9381aeb
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 18, 2019
5d68083
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 18, 2019
de48ad1
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 19, 2019
829b1db
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 23, 2019
573bd48
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 26, 2019
5149a88
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Sep 30, 2019
63ee8bd
feature/hera_port: This commit references #1.
GeorgeGayno-NOAA Oct 2, 2019
b799955
Merge branch 'develop' into chgres_cube_grib2_atmos
BinLiu-NOAA Oct 7, 2019
6dd44b8
Merge branch 'hera_port' into chgres_cube_grib2_atmos
BinLiu-NOAA Oct 7, 2019
1c150e9
Merge branch 'develop' into feature/chgres_cube_grib2_atmos
BinLiu-NOAA Oct 12, 2019
f31a859
Merge branch 'develop' into feature/chgres_cube_grib2_atmos
BinLiu-NOAA Oct 16, 2019
f819e18
Merge pull request #1 from hafs-community/feature/chgres_cube_grib2_a…
LarissaReames-NOAA Oct 22, 2019
0160f6f
Merge branch 'develop' into feature/chgres_cube_grib2_atmos
BinLiu-NOAA Oct 30, 2019
930ff31
Merge branch 'feature/chgres_cube_grib2_atmos' of https://github.com/…
LarissaReames-NOAA Oct 30, 2019
76e9bdb
Merge remote-tracking branch 'LarissaFork/feature/chgres_cube_grib2_a…
JiliDong-NOAA Oct 31, 2019
ecec8ef
re-order grib2 isobaric levels
JiliDong-NOAA Oct 31, 2019
332c584
keep grib2 CLWMR name consistent with origional
JiliDong-NOAA Oct 31, 2019
1945269
Replaced namelist option "base_install_dir" with "varmap_file" and
LarissaReames-NOAA Oct 31, 2019
7940d8b
Merge pull request #3 from JiliDong-NOAA/feature/chgres_cube_grib2_atmos
LarissaReames-NOAA Oct 31, 2019
8a691d6
Merge branch 'feature/chgres_cube_grib2_atmos' of https://github.com/…
LarissaReames-NOAA Oct 31, 2019
91fb62e
Merge pull request #2 from hafs-community/feature/chgres_cube_grib2_a…
LarissaReames-NOAA Oct 31, 2019
73d23e8
Merge branch 'feature/chgres_cube_grib2_atmos' of https://github.com/…
LarissaReames-NOAA Oct 31, 2019
70a44e7
Merge pull request #2 from LarissaReames-NOAA/feature/chgres_cube_gri…
GeorgeGayno-NOAA Nov 1, 2019
b1a1cf3
feature/chgres_cube_grib2_atmos:
GeorgeGayno-NOAA Nov 1, 2019
41a3543
Merge pull request #4 from GeorgeGayno-NOAA/feature/chgres_cube_grib2…
LarissaReames-NOAA Nov 4, 2019
0c778e5
Merge branch 'feature/chgres_cube_grib2_atmos' of https://github.com/…
LarissaReames-NOAA Nov 4, 2019
200e0b8
feature/chgres_cube_grib2_atmos:
GeorgeGayno-NOAA Nov 4, 2019
46adf8a
grib2 inventory file for gfs data is now saved in the run directory i…
LarissaReames-NOAA Nov 4, 2019
6ad2789
Jet support for chgres_cube_grib2_atmos
JiliDong-NOAA Nov 5, 2019
4d8c9fb
Removed a few tabs in favor of spaces in model_grid.F90.
LarissaReames-NOAA Nov 6, 2019
0213e8c
Merge pull request #6 from JiliDong-NOAA/feature/chgres_cube_grib2_atmos
LarissaReames-NOAA Nov 6, 2019
5fc88c6
feature/chgres_cube_grib2_atmos:
GeorgeGayno-NOAA Nov 6, 2019
aa550f4
Merge remote-tracking branch 'Larissa/feature/chgres_cube_grib2_atmos…
GeorgeGayno-NOAA Nov 6, 2019
0f46d32
fix sorting to handle isobaric levels with decimal (mb)
JiliDong-NOAA Nov 7, 2019
e386583
fix sorting to handle isobaric levels with decimal (mb) cleaning up
JiliDong-NOAA Nov 7, 2019
021e855
All atmospheric variables are now read in from grib2 day based on grib2
LarissaReames-NOAA Nov 7, 2019
f60eb34
Merge pull request #7 from JiliDong-NOAA/feature/chgres_cube_grib2_atmos
LarissaReames-NOAA Nov 7, 2019
d8c2f72
Merge branch 'feature/chgres_cube_grib2_atmos' of https://github.com/…
LarissaReames-NOAA Nov 7, 2019
84c34d4
Merge branch 'feature/chgres_cube_grib2_atmos' into feature/chgres_cu…
LarissaReames-NOAA Nov 7, 2019
14c2644
Merge pull request #5 from GeorgeGayno-NOAA/feature/chgres_cube_grib2…
LarissaReames-NOAA Nov 7, 2019
df374ba
Bug fix for an extraneous line of code left over in last merge.
LarissaReames-NOAA Nov 7, 2019
da078d9
Initial commit with surface code
LarissaReames-NOAA Nov 18, 2019
4112354
Fixed a bug with staggered grid creation which resulted in nonsense i…
LarissaReames-NOAA Nov 20, 2019
be4bd0a
Fixed an indexing bug causing veg_type_input_grid to be 0 everywhere,…
LarissaReames-NOAA Dec 9, 2019
71df253
Ice depth is now filled with a default value of 1.5m if the field is …
LarissaReames-NOAA Dec 16, 2019
47e7da7
Fix to prevent erroneous very large snow depth values stemming from m…
LarissaReames-NOAA Dec 16, 2019
e331712
Look for LANDN for the landmask first, and look for LAND if LANDN isn't
LarissaReames-NOAA Dec 19, 2019
729c6b2
Merge pull request #8 from LarissaReames-NOAA/chgres_cube_grib2_release
LarissaReames-NOAA Dec 19, 2019
5f3f697
Merge branch 'develop' of https://github.com/NOAA-EMC/UFS_UTILS into …
LarissaReames-NOAA Jan 9, 2020
0a08a45
Merge pull request #9 from LarissaReames-NOAA/chgres_cube_grib2_release
LarissaReames-NOAA Jan 9, 2020
f4d814e
Added logic to turn off soil moisture rescaling for grib2 data while …
LarissaReames-NOAA Jan 9, 2020
ba884ab
Merge pull request #3 from LarissaReames-NOAA/feature/chgres_cube_gri…
GeorgeGayno-NOAA Jan 13, 2020
8a74a49
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 13, 2020
26e2aa4
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 13, 2020
85dcf9b
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 13, 2020
7185834
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 13, 2020
8905b63
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 13, 2020
df4b273
Port chgres_cube to linux.gnu and linux.intel
DusanJovic-NOAA Jan 14, 2020
fc32eb0
Merge pull request #4 from DusanJovic-NOAA/george_chgres_cube_grib2_r…
GeorgeGayno-NOAA Jan 14, 2020
ec372ba
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 14, 2020
999da97
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 14, 2020
0c1ef8b
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 14, 2020
c926a87
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 14, 2020
b9f9ce8
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 14, 2020
12b051b
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 15, 2020
b1f4bf1
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 15, 2020
7f07342
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 15, 2020
0ed5f0c
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 15, 2020
a40c5fc
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 16, 2020
3388d34
feature/chgres_cube_grib2_release This commit references #7.
GeorgeGayno-NOAA Jan 16, 2020
1c2bc99
feature/chgres_cube_grib2_release This commit references #7.
GeorgeGayno-NOAA Jan 17, 2020
cbe8df5
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 17, 2020
7974e17
feature/chgres_cube_grib2_release: This commit references #7.
GeorgeGayno-NOAA Jan 23, 2020
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
4 changes: 4 additions & 0 deletions modulefiles/chgres_cube.wcoss_dell_p3
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ module load bacio/2.0.2
module load sfcio/1.0.0
module load sigio/2.1.0

export WGRIB2API_LIB=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib/libwgrib2_api.a
export WGRIB2API_INC=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib
export WGRIB2_LIB=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib/libwgrib2.a

export FCOMP=mpif90
export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl"
# for debugging
Expand Down
66 changes: 0 additions & 66 deletions sorc/chgres_cube.fd/grib2_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ module grib2_util
!
! Abstract: Utilities for use when reading grib2 data.
!
! Main Subroutines:
! -------------------
! read_vcoord Reads vertical coordinate data
!
!--------------------------------------------------------------------------

use esmf
Expand All @@ -21,66 +17,6 @@ module grib2_util

contains

subroutine read_vcoord(isnative,vcoordi,vcoordo,lev_input,levp1_input,pt,metadata,iret)

implicit none
integer, intent(in) :: lev_input, levp1_input
logical, intent(in) :: isnative
character (len=500), intent(in) :: metadata
real(esmf_kind_r8), intent(in) :: vcoordi(lev_input)
real(esmf_kind_r8), intent(inout), allocatable :: vcoordo(:,:)
real(esmf_kind_r8), intent(out) :: pt
integer, intent(out) :: iret

integer :: k, idate(3)
character (len=1000) :: fname_coord
character (len=20) :: lev_type
real(esmf_kind_r8) :: sigma, sigflat

!desc: D=YYYYMMDDHHmmss:RH:xxx mb:etc
read(metadata(3:6),'(I4)') idate(1)
read(metadata(7:8),'(I2)') idate(2)
read(metadata(9:10),'(I2)') idate(3)

vcoordo(:,:) = 0.0
sigflat = 0.1
if (isnative) then
if ((trim(external_model) .eq. 'HRRR' .or. trim(external_model) .eq. 'RAP') &
.and. lev_input == 50) then
if (idate(1) .le. 2018 .and. idate(2) .le. 7 .and. idate(3) .lt. 12) then !old sigma coordinates
lev_type = "sigma"
else !new hybrid levels
lev_type = "hybrid"
endif
elseif (trim(external_model) .eq. 'NAM' .and. lev_input == 60) then
lev_type = "hybrid"
else
iret = 1
call error_handler("This code only supports rap/hrrr data w/ 50 sigma/hybrid coordinate levels &
or NAM data with 60 hybrid coordinate levels", iret)
endif ! end check for mname and num levels

fname_coord = trim(fixed_files_dir_input_grid)//"/vertical_coordinate_"// &
trim(external_model)//"-"//trim(lev_type)//".txt"
print*, fname_coord
open(14, file=trim(fname_coord), form='formatted', iostat=iret)

if (iret /= 0) call error_handler("OPENING VERTICAL COORDINATE FILE", iret)


read(14, *, iostat=iret) pt
if (iret /= 0) call error_handler("READING VERTICAL COORDINATE FILE", iret)

do k = 1, levp1_input
read(14, *, iostat=iret) vcoordo(k,1), vcoordo(k,2)
enddo
else ! set vcoordo=0 because won't be used
vcoordo(:,:) = 0.0
endif ! end native vs. non-native check
iret=0

end subroutine read_vcoord

subroutine rh2spfh(rh_sphum,p,t)

implicit none
Expand Down Expand Up @@ -136,8 +72,6 @@ subroutine convert_omega(omega,p,t,q,clb,cub)
enddo
enddo
enddo



end subroutine convert_omega

Expand Down
123 changes: 36 additions & 87 deletions sorc/chgres_cube.fd/input_data.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module input_data
sfc_files_input_grid, &
atm_files_input_grid, &
grib2_file_input_grid, &
geogrid_file_input_grid, &
atm_core_files_input_grid, &
atm_tracer_files_input_grid, &
convert_nst, &
Expand Down Expand Up @@ -2164,7 +2163,7 @@ subroutine read_input_atm_grib2_file(localpet)

use wgrib2api

use grib2_util, only : read_vcoord, rh2spfh, convert_omega
use grib2_util, only : rh2spfh, convert_omega

implicit none

Expand All @@ -2189,15 +2188,12 @@ subroutine read_input_atm_grib2_file(localpet)
integer :: i, j, k, n, lvl_str_space_len
integer :: rc, clb(3), cub(3)
integer :: vlev, iret,varnum

integer :: len_str



logical :: conv_omega=.false., &
isnative=.false., &
hasspfh=.true.

real(esmf_kind_r8), allocatable :: vcoord(:,:)
real(esmf_kind_r8), allocatable :: rlevs(:)
real(esmf_kind_r4), allocatable :: dummy2d(:,:)
real(esmf_kind_r8), allocatable :: dummy3d(:,:,:), dummy2d_8(:,:),&
Expand All @@ -2207,7 +2203,6 @@ subroutine read_input_atm_grib2_file(localpet)
uptr(:,:,:), vptr(:,:,:)

real(esmf_kind_r4) :: value
real(esmf_kind_r8) :: pt
real(esmf_kind_r8), parameter :: p0 = 100000.0


Expand Down Expand Up @@ -2243,33 +2238,25 @@ subroutine read_input_atm_grib2_file(localpet)
iret = grb2_inq(the_file,inv_file,":var_0_2","_0_0:"," hybrid level:")
!if (iret < 0) call error_handler("COUNTING VERTICAL LEVELS.", iret)

if (iret <= 0) then
if (localpet == 0) print*,"DATA IS ON ISOBARIC LEVELS, WILL NEED TO CONVERT AFTER READING"
lvl_str = "mb:"
lvl_str_space = " mb:"
lvl_str_space_len = 4
isnative = 0
iret = grb2_inq(the_file,inv_file,":UGRD:",lvl_str_space)
lev_input=iret
else
if (localpet == 0) PRINT*, "DATA IS ON NATIVE SIGMA/HYBRID LEVELS"
lvl_str = "hybrid level:"
lvl_str_space = " hybrid level:"
lvl_str_space_len = 14
isnative = .true.
iret = grb2_inq(the_file,inv_file,":UGRD:",lvl_str_space)
if (iret < 0) call error_handler("READING VERTICAL LEVEL TYPE.", iret)
lev_input=iret
endif
!endif
print*, "lev_input = ", lev_input
allocate(slevs(lev_input))
allocate(rlevs(lev_input))
levp1_input = lev_input + 1
if (iret <= 0) then
if (localpet == 0) print*,"DATA IS ON ISOBARIC LEVELS"
lvl_str = "mb:"
lvl_str_space = " mb:"
lvl_str_space_len = 4
iret = grb2_inq(the_file,inv_file,":UGRD:",lvl_str_space)
lev_input=iret
else
call error_handler("HYBRID VERTICAL COORD DATA NOT SUPPORTED", -1)
endif

print*, "lev_input = ", lev_input
allocate(slevs(lev_input))
allocate(rlevs(lev_input))
levp1_input = lev_input + 1

! get the vertical levels, and search string by sequential reads

do i = 1,lev_input
do i = 1,lev_input
iret=grb2_inq(the_file,inv_file,':UGRD:',trim(lvl_str),sequential=i-1,desc=metadata)
if (iret.ne.1) call error_handler(" IN SEQUENTIAL FILE READ.", iret)

Expand All @@ -2280,13 +2267,12 @@ subroutine read_input_atm_grib2_file(localpet)

slevs(i) = metadata(j-1:k)

if (.not. isnative) rlevs(i) = rlevs(i) * 100.0
rlevs(i) = rlevs(i) * 100.0
if (localpet==0) print*, "LEVEL = ", slevs(i)
enddo
enddo

! Jili Dong add sort to re-order isobaric levels
call quicksort(rlevs,1,lev_input)

do i = 1,lev_input
write(slevs(i),"(F20.10)") rlevs(i)/100.0
len_str = len_trim(slevs(i))
Expand All @@ -2306,17 +2292,16 @@ subroutine read_input_atm_grib2_file(localpet)
slevs(i) = ":"//trim(adjustl(slevs(i)))//" mb:"
if (localpet==0) print*, "level after sort = ",slevs(i)
enddo
! Jili Dong add sort to re-order isobaric levels

! Jili Dong add sort to re-order isobaric levels

allocate(vcoord(levp1_input,2))
if (localpet == 0) print*,"- READ VERTICAL COORDINATE INFO."
if (localpet == 0) print*, metadata
call read_vcoord(isnative,rlevs,vcoord,lev_input,levp1_input,pt,metadata,iret)
if (iret /= 0) call error_handler("READING VERTICAL COORDINATE INFO.", iret)

!if (localpet==0) print*, "VCOORD(:,1) = ", vcoord(:,1)
do i = 1,lev_input
write(slevs(i),"(I5)") int(rlevs(i)/100.0)
slevs(i) = ":"//trim(adjustl(slevs(i)))//" mb:"
if (localpet==0) print*, "level after sort = ",slevs(i)
enddo


if (localpet == 0) print*,"- FIND SPFH OR RH IN FILE"
!iret = grb2_inq(the_file,inv_file,':SPFH:',lvl_str_space)
iret = grb2_inq(the_file,inv_file,trac_names_grib_1(1),trac_names_grib_2(1),lvl_str_space)
Expand All @@ -2342,10 +2327,9 @@ subroutine read_input_atm_grib2_file(localpet)
! endif
!endif

print*,"- COUNT NUMBER OF TRACERS TO BE READ IN BASED ON PHYSICS SUITE TABLE"
!um_tracers = 0
!tracers_input(:)=""
do n = 1, num_tracers

print*,"- COUNT NUMBER OF TRACERS TO BE READ IN BASED ON PHYSICS SUITE TABLE"
do n = 1, num_tracers

vname = tracers_input(n)

Expand All @@ -2358,6 +2342,7 @@ subroutine read_input_atm_grib2_file(localpet)
tracers(n)=tracers_default(i)

enddo

if (localpet==0) print*, "NUMBER OF TRACERS IN FILE = ", num_tracers

if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE."
Expand Down Expand Up @@ -2435,9 +2420,7 @@ subroutine read_input_atm_grib2_file(localpet)
endif

!-----------------------------------------------------------------------
! 3-d fields in native files increment from bottom to model top.
! That is what is expected by this program, so no need to flip indices.
! Fields in non-native files, though, read in from top to bottom. We will
! Fields in non-native files read in from top to bottom. We will
! flip indices after the data is converted to sigma coordinates.
!-----------------------------------------------------------------------

Expand Down Expand Up @@ -2611,14 +2594,12 @@ subroutine read_input_atm_grib2_file(localpet)
!---------------------------------------------------------------------------
! Compute 3-d pressure.
!---------------------------------------------------------------------------
if (localpet == 0) print*,"-CONVERT DATA TO SIGMA LEVELS AND COMPUTE 3D PRESSURE"
if (.not. isnative) then

if (localpet == 0) print*,"- CALL FieldGet FOR SURFACE PRESSURE."
nullify(psptr)
call ESMF_FieldGet(ps_input_grid, &
if (localpet == 0) print*,"- CALL FieldGet FOR SURFACE PRESSURE."
nullify(psptr)
call ESMF_FieldGet(ps_input_grid, &
farrayPtr=psptr, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) &
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) &
call error_handler("IN FieldGet", rc)

nullify(presptr)
Expand Down Expand Up @@ -2684,39 +2665,7 @@ subroutine read_input_atm_grib2_file(localpet)

deallocate(vcoord)

else
if (localpet == 0) print*,"- COMPUTE 3-D PRESSURE."

if (localpet == 0) print*,"- CALL FieldGet FOR 3-D PRESSURE."
nullify(presptr)

call ESMF_FieldGet(pres_input_grid, &
computationalLBound=clb, &
computationalUBound=cub, &
farrayPtr=presptr, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) &
call error_handler("IN FieldGet", rc)

if (localpet == 0) print*,"- CALL FieldGet FOR SURFACE PRESSURE."
nullify(psptr)
call ESMF_FieldGet(ps_input_grid, &
farrayPtr=psptr, rc=rc)
if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) &
call error_handler("IN FieldGet", rc)

do i = clb(1), cub(1)
do j = clb(2), cub(2)

do k = 1,lev_input
presptr(i,j,k) = vcoord(k,2)*(psptr(i,j)-pt) + vcoord(k,1)*(p0-pt)+pt
enddo

enddo
enddo

deallocate(vcoord)
endif

if (localpet == 0) then
print*,'psfc is ',clb(1),clb(2),psptr(clb(1),clb(2))
print*,'pres is ',cub(1),cub(2),presptr(cub(1),cub(2),:)
Expand Down