-
Notifications
You must be signed in to change notification settings - Fork 9
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
Changes from 6 commits
aa406bc
07fb03d
5db0688
3ec00a2
96e0007
5e0afec
524c904
d511471
c69cb6c
087068c
bb67e3a
3926b13
b179d84
a8eeefa
7d610ce
92b7e10
ec8ae43
ea9e3de
aee44e5
0b875da
994251e
fca7d54
5906c4c
01b9500
62fa22a
f4cabb2
bdc244e
0fa9ac8
585b6c2
a15d899
a137449
f3a5c42
9f00ac4
60e2a92
113bb4e
b3b9415
4317893
9fc99f0
3ba5868
8619b97
3e6dcfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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) | ||
|
@@ -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& | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -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: | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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?