[Dart-dev] DART/branches Revision: 12479

dart at ucar.edu dart at ucar.edu
Mon Apr 2 11:16:36 MDT 2018


nancy at ucar.edu
2018-04-02 11:16:35 -0600 (Mon, 02 Apr 2018)
425
these are the test programs and the quad interpolation code
from the recam branch (being used in the revised cam model_mod).
it still needs some code for the fully regular case (right now
is being expanded into the semi-regular case instead of doing
the math directly) but it appears to be working correctly.
the roms guys are also using this code so it should probably
be moved onto a more public branch. add here for now.




Added: DART/branches/nsc_updates/models/model_mod_tools/test_quad_irreg_interp.f90
===================================================================
--- DART/branches/nsc_updates/models/model_mod_tools/test_quad_irreg_interp.f90	                        (rev 0)
+++ DART/branches/nsc_updates/models/model_mod_tools/test_quad_irreg_interp.f90	2018-04-02 17:16:35 UTC (rev 12479)
@@ -0,0 +1,309 @@
+! 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, initialize_utilities, finalize_utilities
+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, k
+real(r8) :: lon_del, lat_del, sample_lon_del, sample_lat_del
+integer  :: lon_bot, lat_bot, lon_top, lat_top
+integer  :: four_lons(4), four_lats(4)
+integer  :: istatus
+real(r8) :: invals(4), outval
+integer  :: iunit_orig, iunit_interp
+


More information about the Dart-dev mailing list