[Dart-dev] DART/branches Revision: 11973

dart at ucar.edu dart at ucar.edu
Wed Oct 11 17:56:21 MDT 2017


nancy at ucar.edu
2017-10-11 17:56:21 -0600 (Wed, 11 Oct 2017)
79
split test_quad_intep into the regular grid case
and the irregular quad case.




Added: DART/branches/quad_interp/models/utilities/test_quad_irreg_interp.f90
===================================================================
--- DART/branches/quad_interp/models/utilities/test_quad_irreg_interp.f90	                        (rev 0)
+++ DART/branches/quad_interp/models/utilities/test_quad_irreg_interp.f90	2017-10-11 23:56:21 UTC (rev 11973)
@@ -0,0 +1,307 @@
+! DART software - Copyright 2004 - 2013 UCAR. This open source software is
+! provided by UCAR, "as is", without charge, subject to all terms of use at
+! http://www.image.ucar.edu/DAReS/DART/DART_download
+!
+! DART $Id$
+
+program test_quad_irreg_interp
+
+! intended to show how the state structure and quad code can be used
+! together.  start with a simple regional grid and work out from there.
+
+! Modules that are absolutely required for use are listed
+use        types_mod, only : r8, i8, MISSING_R8, deg2rad, rad2deg
+use    utilities_mod, only : error_handler
+use   random_seq_mod, only : init_random_seq, random_seq_type, &
+                             random_uniform, random_gaussian
+
+use quad_utils_mod, only : quad_interp_handle, init_quad_interp, finalize_quad_interp, set_quad_coords,       &
+                           quad_lon_lat_locate, quad_lon_lat_evaluate, GRID_QUAD_FULLY_REGULAR,               &
+                           GRID_QUAD_IRREG_SPACED_REGULAR, GRID_QUAD_FULLY_IRREGULAR, GRID_QUAD_UNKNOWN_TYPE, &
+                           QUAD_LOCATED_UNKNOWN, QUAD_LOCATED_CELL_CENTERS, QUAD_LOCATED_LON_EDGES,           &
+                           QUAD_LOCATED_LAT_EDGES, QUAD_LOCATED_CELL_CORNERS
+
+
+implicit none
+
+integer :: debug = 0
+
+type(quad_interp_handle) :: h
+
+! data grid size
+integer, parameter :: nx = 9
+integer, parameter :: ny = 5
+
+! locations of data grid corners
+real(r8) :: data_lons(nx, ny) = MISSING_R8
+real(r8) :: data_lats(nx, ny) = MISSING_R8
+
+! extents of the data grid (these mimic a regional model's grid)
+real(r8) :: start_lon = 100.0_r8
+real(r8) :: end_lon   = 150.5_r8
+real(r8) :: start_lat = -11.4_r8
+real(r8) :: end_lat   =  34.1_r8
+
+! angle to rotate data grid in degrees
+! positive is counterclockwise; will rotate
+! around lower left grid point (start lon/lat).
+ real(r8) :: angle = 10.0_r8
+!real(r8) :: angle = 45.0_r8
+!real(r8) :: angle = 30.0_r8
+!real(r8) :: angle =  90.0_r8
+!real(r8) :: angle = -30.0_r8
+!real(r8) :: angle = -10.0_r8
+!real(r8) :: angle = 0.0_r8
+
+! deform grid by this fraction of the deltas
+real(r8) :: lon_def = 0.25_r8
+real(r8) :: lat_def = 0.25_r8
+
+! data values on the grid
+real(r8) :: grid_data(nx, ny) = MISSING_R8
+integer  :: data_choice = 0   ! see code for selection values
+
+! percent of data values that should be marked 'missing data'
+!real(r8) :: miss_percent =   0.0_r8    ! none
+ real(r8) :: miss_percent =   3.0_r8    ! 3%
+!real(r8) :: miss_percent = 100.0_r8    ! all
+
+! sampling grid size
+integer, parameter :: nrx = 210
+integer, parameter :: nry = 150
+
+! locations of sampling grid
+real(r8) :: sample_lons(nrx) = MISSING_R8
+real(r8) :: sample_lats(nry) = MISSING_R8
+
+! extents of the sampling grid
+real(r8) :: sample_start_lon = 110.0_r8
+real(r8) :: sample_end_lon   = 140.0_r8
+real(r8) :: sample_start_lat = -20.0_r8
+real(r8) :: sample_end_lat   =  30.0_r8
+
+! where interpolated values are stored on reg grid
+real(r8) :: interp_data(nrx, nry) = MISSING_R8
+
+
+type(random_seq_type) :: ran
+
+integer  :: i, j
+real(r8) :: lon_del, lat_del, sample_lon_del, sample_lat_del
+integer  :: lon_bot, lat_bot, lon_top, lat_top
+integer  :: istatus
+real(r8) :: invals(4), outval
+integer  :: iunit_orig, iunit_interp
+
+call init_random_seq(ran)


More information about the Dart-dev mailing list