Skip to content

Commit

Permalink
Merge branch 'develop' into pic_default
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderRichert-NOAA authored Jan 3, 2025
2 parents ef156e4 + 87ceb84 commit fb12a92
Show file tree
Hide file tree
Showing 116 changed files with 140 additions and 359 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ jobs:
with:
path: ip

- name: Cache test files
uses: actions/cache@v4
with:
path: testfiles.tgz
key: NCEPLIBS-ip-test-files-1

- name: build
run: |
cmake -S ip -B ip/build -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=OFF -DBUILD_8=ON
sudo apt install libopenblas-serial-dev
if [ ! -f testfiles.tgz ]; then wget https://ftp.emc.ncep.noaa.gov/static_files/public/NCEPLIBS-ip/ip-test-data-20241230.tgz -O testfiles.tgz ; fi
cmake -S ip -B ip/build -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=OFF -DBUILD_8=ON -DFTP_TEST_FILES=ON -DTEST_FILES_CACHE=$GITHUB_WORKSPACE/testfiles.tgz
cmake --build ip/build --parallel 2 --verbose
- name: test
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ jobs:
with:
path: ip

- name: Cache test files
uses: actions/cache@v4
with:
path: testfiles.tgz
key: NCEPLIBS-ip-test-files-1

- name: build
run: |
sudo apt install libopenblas-serial-dev
if [ ! -f testfiles.tgz ]; then wget https://ftp.emc.ncep.noaa.gov/static_files/public/NCEPLIBS-ip/ip-test-data-20241230.tgz -O testfiles.tgz ; fi
export CC=gcc-${{ matrix.gcc-version }} ; export FC=gfortran-${{ matrix.gcc-version }}
cmake -S ip -B ip/build -DCMAKE_PREFIX_PATH="~/" -DOPENMP=${{ matrix.openmp }} ${{ matrix.options }} -DCMAKE_INSTALL_PREFIX=~/install -DBLA_VENDOR=OpenBLAS
cmake -S ip -B ip/build -DCMAKE_PREFIX_PATH="~/" -DOPENMP=${{ matrix.openmp }} ${{ matrix.options }} -DCMAKE_INSTALL_PREFIX=~/install -DBLA_VENDOR=OpenBLAS -DFTP_TEST_FILES=ON -DTEST_FILES_CACHE=$GITHUB_WORKSPACE/testfiles.tgz
cmake --build ip/build --parallel 2 --verbose
cmake --install ip/build
# Ensure that manual setting of '-DBLA_VENDOR=...' is reflected in output CMake config
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ jobs:
with:
path: ip

- name: Cache test files
uses: actions/cache@v4
with:
path: testfiles.tgz
key: NCEPLIBS-ip-test-files-1

- name: build
run: |
cmake -S ip -B ip/build -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=${{ matrix.sharedlibs }} -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_8=ON -DCMAKE_BUILD_TYPE=Debug
if [ ! -f testfiles.tgz ]; then wget https://ftp.emc.ncep.noaa.gov/static_files/public/NCEPLIBS-ip/ip-test-data-20241230.tgz -O testfiles.tgz ; fi
cmake -S ip -B ip/build -DOPENMP=${{ matrix.openmp }} -DBUILD_SHARED_LIBS=${{ matrix.sharedlibs }} -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_8=ON -DCMAKE_BUILD_TYPE=Debug -DFTP_TEST_FILES=ON -DTEST_FILES_CACHE=$GITHUB_WORKSPACE/testfiles.tgz
cmake --build ip/build --parallel 2 --verbose
cmake --install ip/build
ls -l ~/install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
with:
recipe-file: package/spack/package.py
cmakelists-txt: package/CMakeLists.txt
ignore-list: ENABLE_DOCS,TEST_TIME_LIMIT
ignore-list: ENABLE_DOCS,TEST_TIME_LIMIT,TEST_FILES_CACHE
14 changes: 10 additions & 4 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
developer:
runs-on: ubuntu-latest
env:
FC: gfortran-11
CC: gcc-11
FC: gfortran-13
CC: gcc-13

steps:

Expand All @@ -33,9 +33,16 @@ jobs:
with:
path: ip

- name: Cache test files
uses: actions/cache@v4
with:
path: testfiles.tgz
key: NCEPLIBS-ip-test-files-1

- name: build
run: |
cmake -S ip -B ip/build -DENABLE_DOCS=YES -DOPENMP=ON -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DBUILD_8=ON
if [ ! -f testfiles.tgz ]; then wget https://ftp.emc.ncep.noaa.gov/static_files/public/NCEPLIBS-ip/ip-test-data-20241230.tgz -O testfiles.tgz ; fi
cmake -S ip -B ip/build -DENABLE_DOCS=YES -DOPENMP=ON -DCMAKE_Fortran_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_C_FLAGS="-g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -fsanitize=address" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DBUILD_8=ON -DFTP_TEST_FILES=ON -DTEST_FILES_CACHE=$GITHUB_WORKSPACE/testfiles.tgz
cmake --build ip/build --parallel 2 --verbose
- name: test
Expand All @@ -57,4 +64,3 @@ jobs:
name: docs
path: |
ip/build/docs/html
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ option(BUILD_8 "Build the 8-byte integer & real version of the library, libip_8.
option(BUILD_DEPRECATED "Build deprecated spectral processing functions" OFF)
option(TEST_TIME_LIMIT "Set timeout for tests" OFF)
option(CMAKE_POSITION_INDEPENDENT_CODE "Enable PIC" ON)
option(FTP_TEST_FILES "Fetch and test with files on FTP site." OFF)
option(TEST_FILES_CACHE "Path to local copy of test data tarball." OFF)

# Figure whether user wants a _4, a _d, and/or _8.
if(BUILD_4)
Expand Down
3 changes: 2 additions & 1 deletion spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ class Ip(CMakePackage):
depends_on("sp precision=d", when="@4.1:4 precision=d")
depends_on("sp precision=8", when="@4.1:4 precision=8")
depends_on("lapack", when="@5.1:")
depends_on("[email protected]:", when="@5.1:")
depends_on("[email protected]:", when="@5.1:", type="build")

def cmake_args(self):
args = [
self.define_from_variant("OPENMP", "openmp"),
self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),
self.define("FTP_TEST_FILES", self.run_tests),
]

if self.spec.satisfies("@4:"):
Expand Down
9 changes: 6 additions & 3 deletions src/ip_equid_cylind_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ module ip_equid_cylind_grid_mod
real :: dlat !< Di — i direction increment. GRIB2, Section 3, octets 64-67.
real :: dlon !< Dj — j direction increment. GRIB2, Section 3, octets 68-71.
contains
procedure :: init_grib1 !< Init GRIB1. @return N/A
procedure :: init_grib2 !< Init GRIB2. @return N/A
procedure :: gdswzd => gdswzd_equid_cylind !< See gdswzd_equid_cylind(). @return N/A
!> @return N/A @copydoc ip_equid_cylind_grid_mod::init_grib1
procedure :: init_grib1 !< Init GRIB1.
!> @return N/A @copydoc ip_equid_cylind_grid_mod::init_grib2
procedure :: init_grib2 !< Init GRIB2.
!> @return N/A @copydoc ip_equid_cylind_grid_mod::gdswzd_equid_cylind
procedure :: gdswzd => gdswzd_equid_cylind
end type ip_equid_cylind_grid

REAL :: DLAT !< Grid resolution in degrees n/s direction.
Expand Down
9 changes: 6 additions & 3 deletions src/ip_gaussian_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ module ip_gaussian_grid_mod
integer :: jg !< Number of parallels between the equator and pole times 2. GRIB2 Section 3, octets 68-71.
integer :: jscan !< Scanning mode in the 'j' direction. GRIB2 Section 3, octet 72.
contains
!> Initializes a gaussian grid given a grib1_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib1_descriptor object.
!> @return N/A @copydoc ip_gaussian_grid_mod::init_grib1
procedure :: init_grib1
!> Initializes a gaussian grid given a grib2_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib2_descriptor object.
!> @return N/A @copydoc ip_gaussian_grid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates (iopt = -1)
!> for Gaussian grids. @return N/A
!> for Gaussian grids.
!> @return N/A @copydoc ip_gaussian_grid_mod::gdswzd_gaussian
procedure :: gdswzd => gdswzd_gaussian
end type ip_gaussian_grid

Expand Down
9 changes: 6 additions & 3 deletions src/ip_grid_descriptor_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module ip_grid_descriptor_mod
type, abstract :: ip_grid_descriptor
integer :: grid_num !< Integer representing the grid type (see *_GRID_ID_GRIB1/2 in ip_grid_mod).
contains
!> Test whether two grid descriptors are the same. @return N/A
!> Test whether two grid descriptors are the same.
!> @return N/A @copydoc ip_grid_descriptor_mod::is_same_grid
procedure :: is_same_grid
end type ip_grid_descriptor

Expand All @@ -38,7 +39,8 @@ module ip_grid_descriptor_mod
type, extends(ip_grid_descriptor) :: grib1_descriptor
integer :: gds(200) !< Grib-1 grib descriptor section (GDS)
contains
!> Test whether two grid descriptors are the same. @return N/A
!> Test whether two grid descriptors are the same.
!> @return N/A @copydoc ip_grid_descriptor_mod::is_same_grid_grib1
procedure :: is_same_grid_grib1
end type grib1_descriptor

Expand All @@ -49,7 +51,8 @@ module ip_grid_descriptor_mod
integer :: gdt_len !< Length of the template.
integer, allocatable :: gdt_tmpl(:) !< Grib-2 grid definition template.
contains
!> Test whether two grid descriptors are the same. @return N/A
!> Test whether two grid descriptors are the same.
!> @return N/A @copydoc ip_grid_descriptor_mod::is_same_grid_grib2
procedure :: is_same_grid_grib2
end type grib2_descriptor

Expand Down
9 changes: 6 additions & 3 deletions src/ip_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ module ip_grid_mod
real :: rerth !< Radius of the Earth.
real :: eccen_squared !< Eccentricity of the Earth squared (e^2).
contains
!> Initializer for grib1 input descriptor. @return N/A
!> @cond skip
!> Initializer for grib1 input descriptor.
procedure(init_grib1_interface), deferred :: init_grib1
!> Initializer for grib2 input descriptor. @return N/A
!> Initializer for grib2 input descriptor.
procedure(init_grib2_interface), deferred :: init_grib2
!> Coordinate transformations for the grid. @return N/A
!> Coordinate transformations for the grid.
procedure(gdswzd_interface), deferred :: gdswzd
!> @endcond
!> Field position for a given grid point. @return Integer
!> position in grib field to locate grid point.
!> @copydoc ip_grid_mod::field_pos
procedure :: field_pos
!> Init subprogram. @return N/A
generic :: init => init_grib1, init_grib2
Expand Down
9 changes: 6 additions & 3 deletions src/ip_lambert_conf_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ module ip_lambert_conf_grid_mod
real :: h !< Hemisphere flag. 1-NH, minus 1-SH.
integer :: irot !< vector rotation flag. When "1", vectors are grid relative. When "0", vectors are earth relative. GRIB2, Section 3, octet 55.
contains
!> Initializes a gaussian grid given a grib1_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib1_descriptor object.
!> @return N/A @copydoc ip_lambert_conf_grid_mod::init_grib1
procedure :: init_grib1
!> Initializes a gaussian grid given a grib2_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib2_descriptor object.
!> @return N/A @copydoc ip_lambert_conf_grid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates (iopt = -1)
!> for Gaussian grids. @return N/A
!> for Gaussian grids.
!> @return N/A @copydoc ip_lambert_conf_grid_mod::gdswzd_lambert_conf
procedure :: gdswzd => gdswzd_lambert_conf
end type ip_lambert_conf_grid

Expand Down
11 changes: 7 additions & 4 deletions src/ip_mercator_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ module ip_mercator_grid_mod
real :: dlon !< Longitudinal direction grid length. Section 3, octets 65-68.
real :: dphi !< Latitudinal direction grid length. Section 3, octets 69-72.
contains
!> Initializes a gaussian grid given a grib1_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib1_descriptor object.
!> @return N/A @copydoc ip_mercator_grid_mod::init_grib1
procedure :: init_grib1
!> Initializes a gaussian grid given a grib2_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib2_descriptor object.
!> @return N/A @copydoc ip_mercator_grid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates (iopt = -1)
!> for Gaussian grids. @return N/A
procedure :: gdswzd => gdswzd_mercator !< gdswzd() @return N/A
!> for Gaussian grids.
!> @return N/A @copydoc ip_mercator_grid_mod::gdswzd_mercator
procedure :: gdswzd => gdswzd_mercator
end type ip_mercator_grid

REAL :: DLON !< Longitudinal direction grid length.
Expand Down
11 changes: 8 additions & 3 deletions src/ip_polar_stereo_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ module ip_polar_stereo_grid_mod
!> relative.
integer :: irot
contains
procedure :: init_grib1 !< Initializes a grid given a grib1_descriptor object. @return N/A
procedure :: init_grib2 !< Initializes a grid given a grib2_descriptor object. @return N/A
!> Initializes a grid given a grib1_descriptor object.
!> @return N/A @copydoc ip_polar_stereo_grid_mod::init_grib1
procedure :: init_grib1
!> Initializes a grid given a grib2_descriptor object.
!> @return N/A @copydoc ip_polar_stereo_grid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates
!> (iopt = -1). @return N/A
!> (iopt = -1).
!> @return N/A @copydoc ip_polar_stereo_grid_mod::gdswzd_polar_stereo
procedure :: gdswzd => gdswzd_polar_stereo
end type ip_polar_stereo_grid

Expand Down
9 changes: 6 additions & 3 deletions src/ip_rot_equid_cylind_egrid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ module ip_rot_equid_cylind_egrid_mod
integer :: irot
contains
!> Initializes a rotated equidistant cylindrical grid given a
!> grib1_descriptor object. @return N/A
!> grib1_descriptor object.
!> @return N/A @copydoc ip_rot_equid_cylind_egrid_mod::init_grib1
procedure :: init_grib1
!> Initializes a rotated equidistant cylindrical grid given a
!> grib2_descriptor object. @return N/A
!> grib2_descriptor object.
!> @return N/A @copydoc ip_rot_equid_cylind_egrid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates
!> (iopt = -1). @return N/A
!> (iopt = -1).
!> @return N/A @copydoc ip_rot_equid_cylind_egrid_mod::gdswzd_rot_equid_cylind_egrid
procedure :: gdswzd => gdswzd_rot_equid_cylind_egrid
end type ip_rot_equid_cylind_egrid

Expand Down
9 changes: 6 additions & 3 deletions src/ip_rot_equid_cylind_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ module ip_rot_equid_cylind_grid_mod
integer :: irot
contains
!> Initializes a Rotated equidistant cylindrical grid given a
!> grib1_descriptor object. @return N/A
!> grib1_descriptor object.
!> @return N/A @copydoc ip_rot_equid_cylind_grid_mod::init_grib1
procedure :: init_grib1
!> Initializes a Rotated equidistant cylindrical given a
!> grib2_descriptor object. @return N/A
!> grib2_descriptor object
!> @return N/A @copydoc ip_rot_equid_cylind_grid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates (iopt = -1)
!> for Gaussian grids. @return N/A
!> for Gaussian grids.
!> @return N/A @copydoc ip_rot_equid_cylind_grid_mod::gdswzd_rot_equid_cylind
procedure :: gdswzd => gdswzd_rot_equid_cylind
end type ip_rot_equid_cylind_grid

Expand Down
9 changes: 6 additions & 3 deletions src/ip_station_points_grid_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ module ip_station_points_grid_mod

type, extends(ip_grid) :: ip_station_points_grid
contains
!> Initializes a gaussian grid given a grib1_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib1_descriptor object.
!> @return N/A @copydoc ip_station_points_grid_mod::init_grib1
procedure :: init_grib1
!> Initializes a gaussian grid given a grib2_descriptor object. @return N/A
!> Initializes a gaussian grid given a grib2_descriptor object.
!> @return N/A @copydoc ip_station_points_grid_mod::init_grib2
procedure :: init_grib2
!> Calculates Earth coordinates (iopt = 1) or grid coorindates (iopt = -1)
!> for IP Station Point grids. @return N/A
!> for IP Station Point grids.
!> @return N/A @copydoc ip_station_points_grid_mod::gdswzd_station_points
procedure :: gdswzd => GDSWZD_station_points
end type ip_station_points_grid

Expand Down
2 changes: 0 additions & 2 deletions src/ncpus.F
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
C> Set number of CPUs - the number of processors over which
C> to parallelize.
C>
C> @param[out] ncpus number of CPUs.
C>
C> @return Number of CPUs assigned.
C>
C> @author Iredell @date 94-08-19
Expand Down
43 changes: 37 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@
#
# Alex Richert, Mark Potts, Kyle Gerheiser, Eric Engle

if(FTP_TEST_FILES)
set(TEST_TARBALL_FILE "ip-test-data-20241230.tgz")
set(TEST_TARBALL_URL "https://ftp.emc.ncep.noaa.gov/static_files/public/NCEPLIBS-ip/${TEST_TARBALL_FILE}")
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE})
message(STATUS "Using existing cached test file ${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE} ...")
elseif(TEST_FILES_CACHE)
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE})
message(STATUS "Using existing cached test file ${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE} ...")
else()
message(STATUS "Copying in cached test file ${TEST_FILES_CACHE} ...")
file(COPY_FILE
${TEST_FILES_CACHE}
${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE}
)
endif()
else()
file(DOWNLOAD
${TEST_TARBALL_URL}
${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE}
SHOW_PROGRESS
STATUS DOWNLOAD_RESULT
INACTIVITY_TIMEOUT 30
)
if(NOT DOWNLOAD_RESULT EQUAL 0)
message(FATAL_ERROR "Failed to download ${TAR_FILE}")
endif()
endif()
find_program(TAR tar)
execute_process(
COMMAND ${TAR} -xzf "${CMAKE_CURRENT_BINARY_DIR}/${TEST_TARBALL_FILE}" -C "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE TAR_RESULT
)
if(NOT TAR_RESULT EQUAL 0)
message(FATAL_ERROR "Failed to extract ${TAR_FILE}")
endif()
endif()

function(create_sp_test name kind timeout)
add_executable(${name}_${kind} ${name}.F90)

Expand All @@ -22,12 +59,6 @@ function(create_sp_test name kind timeout)
endif()
endfunction()

# Link data directory to find the test data.
execute_process(COMMAND cmake -E create_symlink
"${CMAKE_CURRENT_SOURCE_DIR}/data"
"${CMAKE_CURRENT_BINARY_DIR}/data" # New name
)

# Set compiler flags.
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_DEBUG}")
if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$")
Expand Down
5 changes: 0 additions & 5 deletions tests/data/README

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit fb12a92

Please sign in to comment.