Changes between Version 2 and Version 3 of PDAFomi_set_searchtype


Ignore:
Timestamp:
Mar 14, 2026, 1:52:38 PM (8 months ago)
Author:
lnerger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PDAFomi_set_searchtype

    v2 v3  
    33This page documents the function `PDAFomi_set_searchtype` of PDAF, which was introduced with PDAF 3.1.
    44
    5 The routine `PDAFomi_set_searchtype` allows to choose the type of the search operation for observations within the localization cut-off radius (i.e. 'local observations') in domain-localized ensemble filters (i.e. LESTKF, LETKF, LNETF, LKNETF, LSEIK)
     5The routine `PDAFomi_set_searchtype` allows to choose the type of the search operation for observations within the localization cut-off radius ('local observations') in domain-localized ensemble filters (i.e. LESTKF, LETKF, LNETF, LKNETF, LSEIK)
    66
    7 In PDAF V3.1 we optimized the search for local observations. For example, we introduced a variant which first sorts the observation according to their coordinates along a chosen coordinate direction and then performs a bisection search to determine observations that possibly lie within the radius. This can significantly reduce the length of the search loop and hence speed up the search. We also introduced variants that only perform a single search loop. In PDAF V3.0 and before the search was done twice :A first loop counted the observation within the radius. Then local observation arrays were allocated with the correct size and a second loop was done which filled the arrays. For a single loop, we allocate the local observation array at their maximum size (i.e. the number of full observations) and then fill only the first elements up to the number of observation within the radius. While this approach is faster, it requires more memory.
     7In PDAF V3.1 we optimized the search for local observations. For example, we introduced a variant which first sorts the observation according to their coordinates along a chosen coordinate direction and then performs a tree search to determine observations that possibly lie within the radius. This can significantly reduce the length of the search loop and hence speed up the search. We also introduced variants that only perform a single search loop. In PDAF V3.0 and before the search was done twice: A first loop counted the observations within the radius. Then local observation arrays were allocated with the correct size and a second search loop was done which filled the arrays. For a single loop, we allocate the local observation array at their maximum size (i.e. the number of full observations) and then fill only the first elements up to the number of observation within the radius. While this approach is faster, it requires more memory.
    88
    99
    1010The interface is:
    1111{{{
    12   INTEGER FUNCTION PDAF_localfilter()
     12  SUBROUTINE PDAFomi_set_searchtype(search_type, sortdir)
    1313}}}
    14 without arguments. The return value is
    15  * 1 for local filters (including ENSRF/EAKF),[[br]]
    16  * 0 for global filters (including LEnKF, which performs covariance localization)
    17 
    18 The return value can be directly used, e.g. as
     14with the following arguments:
    1915{{{
    20   IF (PDAF_localfilter() == 1) THEN
    21     CALL PDAF3_assimilate_local(...)
    22   ELSE
    23     CALL PDAF3_assimilate_global(...)
    24   ENDIF
     16    INTEGER, INTENT(in) :: search_type  !< Type of search operation
     17           ! 0: Search routine of PDAF 3.0
     18           ! 1: Optimized search code
     19           ! 2: Optimized search code with only one search loop
     20           ! 11: Search type using sorted observations
     21           ! 12: Search type using sorted observations with only one search loop
     22           ! 21: Search type using sorted observations with a computed upper loop limit
     23           ! 22: Search type using sorted observations with a computed upper loop limit
     24           !       and only one search loop
     25           !<  (2, 12 and 22 need more memory as arrays are allocated with full observation dimension)
     26    INTEGER, INTENT(in) :: sortdir         !< Sorted doordinate direction
    2527}}}
    2628
     29
    2730**Notes:**
    28  * The difference between the return values 0 and 1 is mainly the way how PDAF-OMI handles observations.
    29  * For the ENSRF/EAKF, PDAF_localfilter() also returns the value 1. This is because the observation handling for the ENSRF/EAKF uses the same approach as for domain-localized filters
     31 * The default of PDAF V3.1 is `search_type=2` (this is a conservative choice to ensure that the results don't change)
     32 * Generally, `search_type`=22 should yield the best search performance, but needs more memory.
     33 * In experiments, we saw that the search performance of the different types depends on the distribution of the observations. Generally type 0 is slowest, but the performance of the other cases is case-specific.
     34 * search types 11-22 can give slightly different assimilation results compared 0-2, because the sorting of observations change the order of computations.
     35 * Usually, `sortdir` should be the highest index of coordinate direction along which a large variability of coordinates exist, e.g. the latitude in geographic coordinates
     36 * `sortdir` cannot be a direction with periodicity (e.g. longitude in global Earth models is periodic and not a proper choice)