[Dart-dev] [7544] DART/trunk/models/mpas_atm/model_mod.f90: don't call destroy on the 'find nearest cell center' routine
nancy at ucar.edu
nancy at ucar.edu
Thu Feb 5 13:26:30 MST 2015
Revision: 7544
Author: nancy
Date: 2015-02-05 13:26:30 -0700 (Thu, 05 Feb 2015)
Log Message:
-----------
don't call destroy on the 'find nearest cell center' routine
if it was never initialized. also make sure that latitudes
don't go slightly outside the -90 to 90 range.
Modified Paths:
--------------
DART/trunk/models/mpas_atm/model_mod.f90
-------------- next part --------------
Modified: DART/trunk/models/mpas_atm/model_mod.f90
===================================================================
--- DART/trunk/models/mpas_atm/model_mod.f90 2015-02-05 20:06:58 UTC (rev 7543)
+++ DART/trunk/models/mpas_atm/model_mod.f90 2015-02-05 20:26:30 UTC (rev 7544)
@@ -163,6 +163,7 @@
! needed for the get_close code.
type(xyz_get_close_type) :: cc_gc
type(xyz_location_type), allocatable :: cell_locs(:)
+logical :: search_initialized = .false.
! compile-time control over whether grid information is written to the
@@ -3172,6 +3173,8 @@
latCell = latCell * rad2deg
lonCell = lonCell * rad2deg
+where (latCell > 90.0_r8) latCell = 90.0_r8
+where (latCell < -90.0_r8) latCell = -90.0_r8
! Read the variables
@@ -5648,7 +5651,6 @@
type(xyz_location_type) :: pointloc
integer :: closest_cell, rc
-logical, save :: search_initialized = .false.
! do this exactly once.
if (.not. search_initialized) then
@@ -5677,9 +5679,10 @@
subroutine finalize_closest_center()
-! get rid of storage associated with GC for cell centers.
+! get rid of storage associated with GC for cell centers if
+! they were used.
-call xyz_get_close_obs_destroy(cc_gc)
+if (search_initialized) call xyz_get_close_obs_destroy(cc_gc)
end subroutine finalize_closest_center
More information about the Dart-dev
mailing list