Skip to content

Commit

Permalink
Merge branch 'develop' into ejh_0321_test
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett authored May 28, 2024
2 parents 8d1362a + c408fea commit 9a50c32
Show file tree
Hide file tree
Showing 24 changed files with 7,246 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ jobs:
uses: actions/cache@v3
with:
path: ~/g2
key: g2-Intel-${{ matrix.compilers }}-${{ runner.os }}-3.4.9-2
key: g2-Intel-${{ matrix.compilers }}-${{ runner.os }}-3.5.0

- name: checkout-g2
if: steps.cache-g2.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: NOAA-EMC/NCEPLIBS-g2
path: g2
ref: v3.4.9
ref: v3.5.0

- name: build-g2
if: steps.cache-g2.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Linux_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fail-fast: true
matrix:
ip-version: [5.0.0]
g2-version: [3.4.9]
g2-version: [3.5.0]
bacio-version: [2.6.0]
jasper-version: [2.0.33, 3.0.5, 4.0.0]
w3emc-version: [2.11.0]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Linux_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: true
matrix:
g2-version: [3.4.9]
g2-version: [3.5.0]
bacio-version: [2.4.1, 2.6.0]
jasper-version: [4.0.0]
w3emc-version: [2.10.0, 2.11.0]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ jobs:
uses: actions/cache@v3
with:
path: ~/g2
key: g2-MacOS-${{ runner.os }}-4.0.0-2.6.0-3.4.9
key: g2-MacOS-${{ runner.os }}-4.0.0-2.6.0-3.5.0

- name: checkout-g2
if: steps.cache-g2.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: NOAA-EMC/NCEPLIBS-g2
path: g2
ref: v3.4.9
ref: v3.5.0

- name: build-g2
if: steps.cache-g2.outputs.cache-hit != 'true'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if(ip_VERSION LESS 5.0)
find_package(sp 2.3.3 REQUIRED)
endif()
find_package(w3emc 2.10.0 REQUIRED)
find_package(g2 3.4.9 REQUIRED)
find_package(g2 3.5.0 REQUIRED)
# g2c is not required.
#find_package(g2c 1.7.0)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.5.0
2 changes: 2 additions & 0 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The utilities:

## Documentation for Previous Versions of NCEPLIBS-grib_util

* [NCEPLIBS-grib_util Version 1.4.0](ver-1.4.0/index.html)
* [NCEPLIBS-grib_util Version 1.3.0](ver-1.3.0/index.html)
* [NCEPLIBS-grib_util Version 1.2.3](ver-1.2.3/index.html)


2 changes: 1 addition & 1 deletion src/degrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Set compiler flags.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -convert big_endian -axCORE-AVX2 -fpp ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g -convert big_endian -fpp ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${CMAKE_Fortran_FLAGS}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g -fconvert=big-endian -cpp ${CMAKE_Fortran_FLAGS}")
Expand Down
2 changes: 1 addition & 1 deletion src/grb2index/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Set compiler flags.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -convert big_endian -axCORE-AVX2 -fpp ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g -convert big_endian -fpp ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${CMAKE_Fortran_FLAGS}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g -fconvert=big-endian -cpp ${CMAKE_Fortran_FLAGS}")
Expand Down
10 changes: 10 additions & 0 deletions src/grb2index/docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ grb2index \<GRIB2 file\> \<index filename\>
The first argument is the name of the input GRIB2 file. The second argument is
the name of the output index file.

or

@code
grb2index \<idxver\> \<GRIB2 file\> \<index filename\>
@endcode

The first argument is the index format, 1 or 2. The second is the name
of the input GRIB2 file. The third argument is the name of the output
index file.

# Index File Format

The index file has two header records:
Expand Down
26 changes: 17 additions & 9 deletions src/grb2index/grb2index.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
!> - 1 GRIB message not found
!> - 2 incorrect arguments
!> - 8 error accessing file
!> - 9 error closing file
!>
!> @author Iredell @date 1992-11-22
program grb2index
implicit none
integer narg, iargc
character cgb*256,cgi*256
integer :: idxver = 1
character cgb * 256, cgi * 256
character cidxver * 1
integer :: idxver = 2
integer :: lugb = 11, lugi = 12
integer :: ncgb, ncgb1
integer :: iret, ios, ncbase
integer :: iret, ios, ncbase, argnum = 0

interface
subroutine g2_create_index(lugb, lugi, idxver, filename, iret)
Expand All @@ -29,15 +31,21 @@ subroutine g2_create_index(lugb, lugi, idxver, filename, iret)
end subroutine g2_create_index
end interface

! get arguments
! Get arguments.
narg = iargc()
if (narg .ne. 2) then
if (narg .ne. 2 .and. narg .ne. 3) then
call errmsg('grb2index: Incorrect usage')
call errmsg('Usage: grb2index gribfile indexfile')
call errmsg('or: grb2index idxver gribfile indexfile')
call exit(2)
endif
call getarg(1, cgb)
call getarg(2, cgi)
if (narg .eq. 3) then
call getarg(1, cidxver)
read(cidxver, '(i1)') idxver
argnum = 1
end if
call getarg(argnum + 1, cgb)
call getarg(argnum + 2, cgi)

! Open binary GRIB2 file for input.
call baopenr(lugb, trim(cgb), ios)
Expand Down Expand Up @@ -65,9 +73,9 @@ end subroutine g2_create_index

! Close our files.
call baclose(lugb,iret)
if (iret .ne. 0) stop iret
if (iret .ne. 0) stop 9
call baclose(lugi,iret)
if (iret .ne. 0) stop iret
if (iret .ne. 0) stop 9

end program grb2index

Expand Down
2 changes: 1 addition & 1 deletion src/grbindex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS
"-g -assume noold_ldout_format -convert big_endian -axCORE-AVX2 -fpp ${CMAKE_Fortran_FLAGS}")
"-g -assume noold_ldout_format -convert big_endian -fpp ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${CMAKE_Fortran_FLAGS}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g -fconvert=big-endian -cpp ${CMAKE_Fortran_FLAGS}")
Expand Down
2 changes: 1 addition & 1 deletion src/tocgrib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Set compiler flags.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -assume noold_ldout_format -axCORE-AVX2 ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g -assume noold_ldout_format ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 ${CMAKE_Fortran_FLAGS}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g ${CMAKE_Fortran_FLAGS}")
Expand Down
2 changes: 1 addition & 1 deletion src/tocgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Set the compiler flags.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -axCORE-AVX2 ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 ${CMAKE_Fortran_FLAGS}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g ${CMAKE_Fortran_FLAGS}")
Expand Down
31 changes: 21 additions & 10 deletions src/tocgrib2/tocgrib2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,25 @@ PROGRAM tocgrib2
character(len=1),pointer,dimension(:) :: gribm

logical :: extract=.false.
integer idxver
integer (kind = 8) :: itot8

interface
SUBROUTINE GETGB2P(LUGB,LUGI,J,JDISC,JIDS,JPDTN,JPDT,JGDTN,JGDT, &
EXTRACT,K,GRIBM,LENG,IRET)
INTEGER,INTENT(IN) :: LUGB,LUGI,J,JDISC,JPDTN,JGDTN
INTEGER,DIMENSION(:) :: JIDS(*),JPDT(*),JGDT(*)
LOGICAL,INTENT(IN) :: EXTRACT
INTEGER,INTENT(OUT) :: K,IRET
CHARACTER(LEN=1),POINTER,DIMENSION(:) :: GRIBM
END SUBROUTINE GETGB2P
subroutine getgb2p2(lugb, lugi, j, jdisc, jids, jpdtn, jpdt, jgdtn, jgdt, &
extract, idxver, k, gribm, leng8, iret)
integer, intent(in) :: lugb, lugi, j, jdisc
integer, dimension(:) :: jids(*)
integer, intent(in) :: jpdtn
integer, dimension(:) :: jpdt(*)
integer, intent(in) :: jgdtn
integer, dimension(:) :: jgdt(*)
logical, intent(in) :: extract
integer, intent(inout) :: idxver
integer, intent(out) :: k
character(len = 1), pointer, dimension(:) :: gribm
integer (kind = 8), intent(out) :: leng8
integer, intent(out) :: iret
end subroutine getgb2p2
end interface
NAMELIST /GRIBIDS/DSCPL,IDS,GDTN,GDT,PDTN,PDT,DESC,WMOHEAD,EXTRACT

Expand Down Expand Up @@ -148,8 +157,10 @@ END SUBROUTINE GETGB2P
endif

! Read and return packed GRIB field
CALL GETGB2P(lugb,lugi,jrew,DSCPL,IDS,PDTN,PDT, &
GDTN,GDT,extract,KREW,gribm,itot,iret)
idxver = 2
CALL GETGB2P2(lugb,lugi,jrew,DSCPL,IDS,PDTN,PDT, &
GDTN,GDT,extract,idxver,KREW,gribm,itot8,iret)
itot = int(itot8, kind(4))
IF (IRET.NE.0) THEN
IF (IRET.EQ.96)WRITE(6,'(A)')' GETGB2P: ERROR READING INDEX' &
//' FILE'
Expand Down
2 changes: 1 addition & 1 deletion src/tocgrib2super/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Set the compiler flags.
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
set(CMAKE_Fortran_FLAGS "-g -assume noold_ldout_format -axCORE-AVX2 ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS "-g -assume noold_ldout_format ${CMAKE_Fortran_FLAGS}")
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 ${CMAKE_Fortran_FLAGS}")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "-g ${CMAKE_Fortran_FLAGS}")
Expand Down
8 changes: 6 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ gu_copy_test_data(ref_gdaswave_2.idx)
gu_copy_test_data(ref_gdaswave.degrib2.txt)
gu_copy_test_data(ref_gdaswave_grib1_inventory.txt)
gu_copy_test_data(ref_gdaswave.grb2index.idx)
gu_copy_test_data(ref_gdaswave.grb2index.idx2)
gu_copy_test_data(ref_gdaswave.grbindex.grib1.idx)
gu_copy_test_data(ref_gdaswave_2.grib1.idx)
gu_copy_test_data(ref_gdaswave.t00z.wcoast.0p16.f000.grib2.idx)
Expand All @@ -92,7 +93,9 @@ if(FTP_TEST_FILES)
endif()
if(FTP_EXTRA_TEST_FILES)
gu_copy_test_data(ref_GFSPRS.GrbF06.degrib2)
gu_copy_test_data(ref_rrfs.t12z.prslevfaa.f010.na3km.grib2.degrib2)
gu_copy_test_data(ref_rrfs.t18z.prslev.f000.grib2.degrib2)
gu_copy_test_data(ref_grib2.awips.rrfs.010)
endif()
endif()

Expand Down Expand Up @@ -134,7 +137,7 @@ if(FTP_TEST_FILES)
endforeach()

# Fetch a large test file from FTP if desired.
set(LARGE_FTP_FILES "fv3lam.t00z.prslev.f000.grib2")
set(LARGE_FTP_FILES fv3lam.t00z.prslev.f000.grib2)
if(FTP_LARGE_TEST_FILES)
foreach(THE_FILE IN LISTS LARGE_FTP_FILES)
PULL_DATA(${G2_FTP_URL} ${THE_FILE})
Expand All @@ -143,7 +146,8 @@ if(FTP_TEST_FILES)
endif()

# Fetch the even more large test files from FTP if desired.
set(EXTRA_FTP_FILES rrfs.t18z.prslev.f000.grib2 GFSPRS.GrbF06)
set(EXTRA_FTP_FILES rrfs.t12z.prslevfaa.f010.na3km.grib2
rrfs.t18z.prslev.f000.grib2 GFSPRS.GrbF06 grib2.awips.rrfs.010)
if(FTP_EXTRA_TEST_FILES)
foreach(THE_FILE IN LISTS EXTRA_FTP_FILES)
PULL_DATA(${G2_FTP_URL} ${THE_FILE})
Expand Down
Binary file added tests/data/ref_gdaswave.grb2index.idx2
Binary file not shown.
Loading

0 comments on commit 9a50c32

Please sign in to comment.