Changes between Version 1 and Version 2 of OMI_search_local_observations
 Timestamp:
 Sep 8, 2024, 7:35:15 PM (4 weeks ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

OMI_search_local_observations
v1 v2 1 1 = Userprovided routine for initialization of local observations = 2 3 [[PageOutline(23,Contents of this page)]] 2 4 3 5 PDAFOMI provides the routine [wiki:PDAFomi_init_dim_obs_l] to initialize local observations in a routine [wiki:OMI_observation_modules#init_dim_obs_l_OBSTYPE init_dim_obs_p_OBSTYPE] of an PDAFOMI observation module. `PDAFomi_init_dim_obs_l` provides a convenient functionality with observation search for all isotropic and nonisotropic localization variants in different dimensions. However, because the routine covers all cases with various IFchecks it can be relatively slow. … … 53 55 * The check `thisobs%doassim==1` is mandatory because init_dim_obs_l_OBSTYPE is called for all observations. 54 56 * `cnt_obs_l` is the counter of the valid local observations inside the loop, while `i` is the index of a local observation on the full observation vector 55 * We recommend to compute use the square distance `distance2` and only compute the actual distance as `SQRT(distance2)` only for those observations that are within the localization cutoff radius. Since compute a squareroot is a costly operation, one should only compute it if needed.57 * The initialization of the local observation arrays of `thisobs_l` can be done by the routine `PDAFomi_store_obs_l_index` provided by PDAFOMI (see below). However, in our tests this always led to a slower program. Thus, for performance reasons we recommend to use the direct initialization if possible. 56 58 * In the tutorial example routine we use a module to enclose the user routine. This allows for syntax checking, but is not mandatory. 57 * The initialization of the local observation arrays of `thisobs_l` can be done by the routine `PDAFomi_store_obs_l_index` provided by PDAFOMI (see below). However, for performance reasons we recommend to use the direct initialization if possible.58 59 * `cnt_obs_l_all` should only be passed through from PDAF to the PDAFomi routines. If it is changed by the user, the consistency of the observationhandling inside PDAFOMI will be broken. 60 61 == Recommendations for optimizing performance == 62 63 Based on our experience with different application cases we recommend the following: 64 * Implement as specific as possible for your case. IFchecks always deteriorate performance and should be limited as much as possible. However, also costly operations like sine or square root should be minimized. 65 * Compute the distance checks using the square distance `distance2` and only compute the actual distance as `SQRT(distance2)` only for those observations that are within the localization cutoff radius. Since compute a squareroot is a costly operation, one should only compute it if needed. 66 * For localization in 2 and 3 dimensions with geographic coordinates it can be useful to first check for the distance in one direction. If a vertical localization is used it can be good to check the vertical distance first and only if this is within the cutoff radius proceed to the horizontal distance. One might also check in the order height, latitude, longitude to first determine a box (or rectangle in 2 dimensional cases, omitting height) before calculating the full distance. This can be particularly useful when nonisotropic localization is used. (In PDAFOMI we strictly first check whether an observation is within a box or rectangle and only for these observations we compute the actual squared distance.) 67 * Nonisotropic localization might be implemented by scaling the direction and then computing the radii in this scaled isotropic coordinates. However, this approach can be problematic in case of periodicity. (E.g. computing the haversine function for geographic distances doesn't seem to be possible then). To this end, for nonisotropic localization we implemented in PDAFOMI a localization ellipse (in 2D) or ellipsoid (in 3D). This avoids scaling in any direction. 68 * As a reference for possible operations you can check the routines `PDAFomi_check_dist2_loop` (isotropic) and `PDAFomi_check_dist2_noniso_loop` (nonisotropic) in `/src/PDAFomi_dim_obs_l`. Generally you could copy one of these routines, paste it into the user code and then adapt it by removing those IFcases that don't hold for your case. 59 69 60 70