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

Combine ip and ip2 libraries #54

Merged
merged 41 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
aa406bc
Combine ip and ip2 libraries
kgerheiser Jul 2, 2021
07fb03d
Save coeffecients separately for scalar and vector interp routines
kgerheiser Jul 2, 2021
5db0688
Update README.md
kgerheiser Jul 6, 2021
3ec00a2
Update README.md
kgerheiser Jul 6, 2021
96e0007
Update VERSION 4.0.0
kgerheiser Jul 6, 2021
5e0afec
Delete Release_Notes.ip2lib.v1.0.0.txt
kgerheiser Jul 6, 2021
524c904
Remove list_of_files.cmake and specify src in main CMakeLists
kgerheiser Jul 7, 2021
d511471
Update workflows
kgerheiser Jul 7, 2021
c69cb6c
Merge branch 'feature/combined-ip' of github.com:kgerheiser/NCEPLIBS-…
kgerheiser Jul 7, 2021
087068c
Add CMAKE_Fortran_FLAGS to testsg
kgerheiser Jul 7, 2021
bb67e3a
Update README.md
kgerheiser Jul 7, 2021
3926b13
Cleanup CMakeLists
kgerheiser Jul 7, 2021
b179d84
Merge branch 'feature/combined-ip' of github.com:kgerheiser/NCEPLIBS-…
kgerheiser Jul 7, 2021
a8eeefa
Fix docs
kgerheiser Jul 7, 2021
7d610ce
Update README
kgerheiser Jul 7, 2021
92b7e10
Add heap-arrays for tests
kgerheiser Jul 7, 2021
ec8ae43
Increase stack sizeg
kgerheiser Jul 7, 2021
ea9e3de
Add version for find_package(sp) and update Github workflow
kgerheiser Jul 15, 2021
aee44e5
Fix Github Action
kgerheiser Jul 15, 2021
0b875da
Fix workflow syntax
kgerheiser Jul 15, 2021
994251e
Fix sp version in find_package
kgerheiser Jul 15, 2021
fca7d54
Disable docs until fixed
kgerheiser Jul 15, 2021
5906c4c
Separate out debug compiler flags
kgerheiser Jul 20, 2021
01b9500
Use GCC-11
kgerheiser Jul 20, 2021
62fa22a
I mean GCC-10
kgerheiser Jul 20, 2021
f4cabb2
Setup Doxygen with CMake
kgerheiser Jul 20, 2021
bdc244e
Update Gitub Actions
kgerheiser Jul 20, 2021
0fa9ac8
Doxygen docs
kgerheiser Jul 20, 2021
585b6c2
More Doxygen
kgerheiser Jul 20, 2021
a15d899
Finish bicubic interpolation documentation
kgerheiser Jul 20, 2021
a137449
Remove duplicate file
kgerheiser Jul 20, 2021
f3a5c42
Ignore .DS_Store files
kgerheiser Jul 20, 2021
9f00ac4
Fix typo
kgerheiser Jul 20, 2021
60e2a92
Add Doxygen for ipolates
kgerheiser Jul 20, 2021
113bb4e
Cleanup docs for ipolates
kgerheiser Jul 20, 2021
b3b9415
Update user_guide.md
kgerheiser Jul 21, 2021
4317893
Add Doxygen docs to ip_interpolators_mod
kgerheiser Jul 21, 2021
9fc99f0
Make interpolation ids public
kgerheiser Jul 21, 2021
3ba5868
Fix Doxygen in ipolates
kgerheiser Jul 21, 2021
8619b97
Fix module syntax
kgerheiser Jul 21, 2021
3e6dcfc
Remove duplicate module use
kgerheiser Jul 21, 2021
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: 0 additions & 1 deletion docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
The NCEP general interpolation library (ip2lib) contains Fortran 90 subprograms
to be used for interpolating between nearly all grids used at NCEP.
The library is particularly efficient when interpolating many fields at one time.
The library has been extensively tested with GNU and Intel Fortran compilers.

There are currently six interpolation methods available in the library:
bilinear, bicubic, neighbor, budget, spectral and neighbor-budget.
Expand Down
30 changes: 22 additions & 8 deletions src/ip_interpolators_mod.f90
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
module ip_interpolators_mod
! re-export specific interpolation routines
! use bilinear_interpolator_scalar_mod
! use bicubic_interpolator_scalar_mod
! use neighbor_interpolator_scalar_mod
! use budget_interpolator_scalar_mod
! use spectral_interpolator_scalar_mod
! use neighbor_budget_interpolator_scalar_mod
!> @file
!! @brief Top-level module to export interpolation routines and constants.
!! @author Kyle Gerheiser

!> Top-level module to export interpolation routines and constants.
!! @author Kyle Gerheiser
module ip_interpolators_mod
use bilinear_interp_mod
use bicubic_interp_mod
use budget_interp_mod
use neighbor_interp_mod
use spectral_interp_mod
use neighbor_budget_interp_mod
implicit none

!> @param Constant to choose BILINEAR interpolation method
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The param statements all go into the doxygen header at the top of the subroutine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a subroutine. @param can be used to document module variables and constants.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, interesting. Can we get this merged and then discuss doxygen afterwards?

integer, parameter, public :: BILINEAR_INTERP_ID = 0
!> @param Constant to choose BICUBIC interpolation method
integer, parameter, public :: BICUBIC_INTERP_ID = 1
!> @param Constant to choose NEIGBOR interpolation method
integer, parameter, public :: NEIGHBOR_INTERP_ID = 2
!> @param Constant to choose BUDGET interpolation method
integer, parameter, public :: BUDGET_INTERP_ID = 3
!> @param Constant to choose SPECTRAL interpolation method
integer, parameter, public :: SPECTRAL_INTERP_ID = 4
!> @param Constant to choose NEIGBOR_BUDGET interpolation method
integer, parameter, public :: NEIGHBOR_BUDGET_INTERP_ID = 6

contains


end module ip_interpolators_mod

10 changes: 10 additions & 0 deletions src/ip_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

!> Top-level module for the ip library which re-exports public routines such as ipolates, ipolatev, and gdswzd.
module ip_mod

! Make these constants public to everyone instead of
! using numbers directly
use ip_interpolators_mod, only: BILINEAR_INTERP_ID, &
BICUBIC_INTERP_ID, &
NEIGHBOR_INTERP_ID, &
BUDGET_INTERP_ID, &
SPECTRAL_INTERP_ID, &
NEIGHBOR_BUDGET_INTERP_ID

use ipolates_mod
use ipolatev_mod
use gdswzd_mod
Expand Down
87 changes: 59 additions & 28 deletions src/ipolates.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@
!!
!! @author George Gayno, Mark Iredell, Kyle Gerheiser
module ipolates_mod
use bilinear_interp_mod
use bicubic_interp_mod
use budget_interp_mod
use neighbor_interp_mod
use spectral_interp_mod
use neighbor_budget_interp_mod
use ip_interpolators_mod
use ip_grid_descriptor_mod
use ip_grid_factory_mod
use ip_interpolators_mod
Expand All @@ -29,7 +24,34 @@ module ipolates_mod

contains

subroutine ipolates_grid(ip, ipopt, grid_in, grid_out, mi, mo, km, ibi, li, gi, no, rlat, rlon, ibo, lo, go, iret)
!> @brief Interpolates scalar fields between grids given ip_grid objects.
!! @details Calls the specific interpolation routines on the generic ip_grids created from a grib1/grib2 descriptor.
!! @param[in] ip Interpolation method.
!! @param[in] ipopt Interpolation options.
!! @param[in] grid_in Input grid.
!! @param[in] grid_out Output grid object created.
!! @param[in] mi Skip number between input grid fields if km>1 or dimension of input grid fields if km=1.
!! @param[in] mo Skip number between output grid fields if km>1 or dimension of output grid fields if km=1.
!! @param[in] km Number of fields to interpolate.
!! @param[in] ibi Input bitmap flags.
!! @param[in] li Input bitmaps (if respective ibi(k)=1).
!! @param[in] gi Input fields to interpolate.
!! @param[out] no Number of output points (only if kgdso(1)<0).
!! @param[out] rlat Output latitudes in degrees (if kgdso(1)<0).
!! @param[out] rlon Output longitudes in degrees (if kgdso(1)<0).
!! @param[out] ibo Output bitmap flags.
!! @param[out] lo Output bitmaps (always output).
!! @param[out] go Output fields interpolated.
!! @param[out] iret Return code.
!! - 0 Successful interpolation.
!! - 1 Unrecognized interpolation method.
!! - 2 Unrecognized input grid or no grid overlap.
!! - 3 Unrecognized output grid.
!! - 1x Invalid bicubic method parameters.
!! - 3x Invalid budget method parameters.
!! - 4x Invalid spectral method parameters.
subroutine ipolates_grid(ip, ipopt, grid_in, grid_out, mi, mo, km,&
& ibi, li, gi, no, rlat, rlon, ibo, lo, go, iret)
class(ip_grid), intent(in) :: grid_in, grid_out
INTEGER, INTENT(IN ) :: IP, IPOPT(20), KM, MI, MO
INTEGER, INTENT(IN ) :: IBI(KM)
Expand All @@ -46,17 +68,23 @@ subroutine ipolates_grid(ip, ipopt, grid_in, grid_out, mi, mo, km, ibi, li, gi,

select case(ip)
case(BILINEAR_INTERP_ID)
CALL interpolate_bilinear(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
CALL interpolate_bilinear(IPOPT,grid_in,grid_out,MI,MO,KM,IBI&
&,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
case(BICUBIC_INTERP_ID)
CALL interpolate_bicubic(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
CALL interpolate_bicubic(IPOPT,grid_in,grid_out,MI,MO,KM,IBI&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For easy review, what I suggest is to do all whitespace only reformatting as a separate PR, with no code changes. So merge this PR, then reformat the code however you like, and then do a PR with that.

That way we can easily scan the whitespace changes to ensure no code was accidently changed.

&,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
case(NEIGHBOR_INTERP_ID)
CALL interpolate_neighbor(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
CALL interpolate_neighbor(IPOPT,grid_in,grid_out,MI,MO,KM,IBI&
&,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
case(BUDGET_INTERP_ID)
CALL interpolate_budget(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
CALL interpolate_budget(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,LI&
&,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
case(SPECTRAL_INTERP_ID)
CALL interpolate_spectral(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
CALL interpolate_spectral(IPOPT,grid_in,grid_out,MI,MO,KM,IBI&
&,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
case(NEIGHBOR_BUDGET_INTERP_ID)
CALL interpolate_neighbor_budget(IPOPT,grid_in,grid_out,MI,MO,KM,IBI,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
CALL interpolate_neighbor_budget(IPOPT,grid_in,grid_out,MI,MO&
&,KM,IBI,LI,GI,NO,RLAT,RLON,IBO,LO,GO,IRET)
case default
! IF(KGDSO(1).GE.0) NO=0
! DO K=1,KM
Expand All @@ -73,7 +101,8 @@ subroutine ipolates_grid(ip, ipopt, grid_in, grid_out, mi, mo, km, ibi, li, gi,

end subroutine ipolates_grid

!> @brief This subprogram interpolates scalar field from any grid to any grid.
!> @brief This subprogram interpolates scalar field from any grid
!to any grid given a grib1 Grid Descriptor Section.
!!
!! @details Only horizontal interpolation is performed.
!! The following interpolation methods are possible:
Expand Down Expand Up @@ -119,20 +148,20 @@ end subroutine ipolates_grid
!! the output field is set to 0 where the output bitmap is off.
!!
!! @param ip Interpolation method
!! - ip=0 for bilinear
!! - ip=1 for bicubic
!! - ip=2 for neighbor;
!! - ip=3 for budget;
!! - ip=4 for spectral;
!! - ip=6 for neighbor-budget
!! - ip = BILINEAR_INTERP_ID = 0 for bilinear
!! - ip = BICUBIC_INTERP_ID = 1 for bicubic
!! - ip = NEIGHBOR_INTERP_ID = 2 for neighbor;
!! - ip = BUDGET_INTERP_ID = 3 for budget;
!! - ip = SPECTRAL_INTERP_ID = 4 for spectral;
!! - ip = NEIGHBOR_BUDGET_INTERP_ID = 6 for neighbor-budget
!!
!! @param ipopt Interpolation options
!! - ip=0: (No options)
!! - ip=1: Constraint option
!! - ip=2: (No options)
!! - ip=3: Number in radius, radius weights, search radius
!! - ip=4: Spectral shape, spectral truncation
!! - ip=6: Number in radius, radius weights ...)
!! - ip=0 (bilinear): (No options)
!! - ip=1 Cbicubic): constraint option
!! - ip=2 (neighbor): (No options)
!! - ip=3 (budget): Number in radius, radius weights, search radius
!! - ip=4 (spectral): Spectral shape, spectral truncation
!! - ip=6 (neighbor-budget): Number in radius, radius weights ...)
!!
!! @param[in] kgdsi Input gds parameters as decoded by w3fi63.
!! @param[in] kgdso Output gds parameters.
Expand Down Expand Up @@ -187,8 +216,10 @@ subroutine ipolates_grib1(ip,ipopt,kgdsi,kgdso,mi,mo,km,ibi,li,gi, &
END SUBROUTINE IPOLATES_GRIB1


!> @brief This subprogram interpolates scalar field from any grid to any grid.
!! @details Only horizontal interpolation is performed.
!> @brief This subprogram interpolates scalar field from any grid to any grid given a grib2 descriptor.
!! @details Wrapper for ipolates_grid which converts a grib1 descriptor into an ip_grid_descriptor,
!! which is used to create an ip_grid.
!! Only horizontal interpolation is performed.
!!
!! The following interpolation methods are possible:
!! - (ip=0) bilinear
Expand Down
7 changes: 0 additions & 7 deletions src/ipolatev.f90
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
module ipolatev_mod
use bilinear_interp_mod
use bicubic_interp_mod
use neighbor_interp_mod
use budget_interp_mod
use spectral_interp_mod
use neighbor_budget_interp_mod
use ip_interpolators_mod

use ip_grid_factory_mod
use ip_grid_descriptor_mod
use ip_grid_mod
Expand Down