[Dart-dev] DART/branches Revision: 11968
dart at ucar.edu
dart at ucar.edu
Thu Oct 5 11:13:48 MDT 2017
nancy at ucar.edu
2017-10-05 11:13:48 -0600 (Thu, 05 Oct 2017)
86
updated to rotate quads (optionally) before doing
interpolation. also test program.
Modified: DART/branches/quad_interp/models/utilities/quad_utils_mod.f90
===================================================================
--- DART/branches/quad_interp/models/utilities/quad_utils_mod.f90 2017-10-02 22:31:56 UTC (rev 11967)
+++ DART/branches/quad_interp/models/utilities/quad_utils_mod.f90 2017-10-05 17:13:48 UTC (rev 11968)
@@ -34,7 +34,7 @@
! This code will interpolate in a logically rectangular but deformed lat/lon grid.
! Modules that are absolutely required for use are listed
-use types_mod, only : r8, i8, MISSING_R8, PI
+use types_mod, only : r8, i8, MISSING_R8, PI, deg2rad
use location_mod, only : location_type, get_location
use utilities_mod, only : register_module, error_handler, get_unit, &
E_ERR, E_WARN, E_MSG, nmlfileunit, &
@@ -382,6 +382,8 @@
allocate(interp_handle%ii%grid_start(interp_handle%ii%num_reg_x,interp_handle%ii%num_reg_y), &
interp_handle%ii%grid_num( interp_handle%ii%num_reg_x,interp_handle%ii%num_reg_y))
+ interp_handle%ii%grid_num = 0
+
case default
write(string1, *) 'unrecognized grid type: ', grid_type
write(string2, *) 'should be one of: GRID_QUAD_FULLY_REGULAR, ', &
@@ -415,8 +417,8 @@
subroutine print_quad_handle(interp_handle)
type(quad_interp_handle), intent(in) :: interp_handle
-print *, interp_handle%nlat, interp_handle%nlon
-print *, interp_handle%grid_type
+if (debug > 10) print *, interp_handle%nlat, interp_handle%nlon
+if (debug > 10) print *, interp_handle%grid_type
select case (interp_handle%grid_type)
case(GRID_QUAD_FULLY_REGULAR)
@@ -439,7 +441,7 @@
end select
-print *, interp_handle%opt%cell_relative
+if (debug > 10) print *, interp_handle%opt%cell_relative
end subroutine print_quad_handle
@@ -607,11 +609,9 @@
if(h%opt%spans_lon_zero) then
h%ii%lon_width = h%ii%lon_width + 360.0_r8
else
- string1 = 'regional grid with bad longitudes'
- write(string2,*)'min_lon, max_lon, lon_width, spans_lon_zero: ', &
- h%ii%min_lon, h%ii%max_lon, h%ii%lon_width, h%opt%spans_lon_zero
- call error_handler(E_ERR,'init_irreg_interp', string1, &
- source, revision, revdate, text2=string2)
+ write(string1,*)'min_lon, max_lon, lon_width, spans_lon_zero: ', &
+ h%ii%min_lon, h%ii%max_lon, h%ii%lon_width, h%opt%spans_lon_zero
+ call error_handler(E_ERR,'init_irreg_interp','regional grid with bad longitudes', & source, revision, revdate, text2=string1)
endif
endif
@@ -1132,6 +1132,7 @@
endif
! Make sure the list storage isn't full
+!print *, 'reg_list_num, x, y = ', reg_list_num, index_x, index_y
if(reg_list_num(index_x, index_y) >= maxlist) then
write(string1,*) 'max_reg_list_num (',maxlist,') is too small ... increase'
write(string2,*) 'adding 1 to bin ', index_x, index_y
@@ -1225,14 +1226,17 @@
num_inds, start_ind, interp_handle%ii%grid_lon_list, &
interp_handle%ii%grid_lat_list, cyclic, nx, ny, &
lon_bot, lat_bot, istatus)
+if (debug > 10) print *, 'get_grid_quad returns lon/lat bot: ', lon_bot, lat_bot
if (istatus /= 0) return
! Getting corners for accurate interpolation
call get_quad_corners(interp_handle%ii%lons_2d, lon_bot, lat_bot, cyclic, nx, ny, &
x_corners, istatus)
+if (debug > 10) print *, 'get_quad_corners returns x_corners: ', x_corners
if (istatus /= 0) return
call get_quad_corners(interp_handle%ii%lats_2d, lon_bot, lat_bot, cyclic, nx, ny, &
y_corners, istatus)
+if (debug > 10) print *, 'get_quad_corners returns y_corners: ', y_corners
if (istatus /= 0) return
! this test shouldn't be needed
@@ -1800,10 +1804,10 @@
!------------------------------------------------------------
-subroutine quad_bilinear_interp(lon_in, lat, x_corners_in, y_corners, cyclic, &
+subroutine quad_bilinear_interp(lon_in, lat_in, x_corners_in, y_corners_in, cyclic, &
p, expected_obs)
- real(r8), intent(in) :: lon_in, lat, x_corners_in(4), y_corners(4), p(4)
+ real(r8), intent(in) :: lon_in, lat_in, x_corners_in(4), y_corners_in(4), p(4)
logical, intent(in) :: cyclic
real(r8), intent(out) :: expected_obs
@@ -1820,13 +1824,19 @@
! checks showed accuracy to seven decimal places on all tests.
integer :: i
-real(r8) :: m(3, 3), v(3), r(3), a, x_corners(4), lon
More information about the Dart-dev
mailing list