Skip to content

Commit

Permalink
brute-force searchString example like #156
Browse files Browse the repository at this point in the history
  • Loading branch information
blaylockbk committed Jan 22, 2023
1 parent 3885ad6 commit 7f7bd1c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/user_guide/searchString.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ Here are some examples you can use for the ``searchString`` argument for the **w

.. hint:: The NCEP `Parameters & Units Table <https://www.nco.ncep.noaa.gov/pmb/docs/on388/table2.html>`_ is a useful resource to help you identify wgrib2-style GRIB variable abbreviations and their meanings.

If you can't figure out the right search string, you may also find *Brute Force* the search string for complex rules.

.. code:: python
searchString = "(string1|string2|string3|string4|string5|string6)"
For example, here is another way to get 1-hr precipiation variables using the brute force approach

.. code:: python
match_these = [f":APCP:surface:{i}-{i+1} h*" for i in range(47)]
searchString = f"({'|'.join(match_these)})"
will produce a long string with many regex groups

.. code:: python
'(:APCP:surface:0-1 h*|:APCP:surface:1-2 h*|:APCP:surface:2-3 h*|:APCP:surface:3-4 h*|:APCP:surface:4-5 h*|:APCP:surface:5-6 h*|:APCP:surface:6-7 h*|:APCP:surface:7-8 h*|:APCP:surface:8-9 h*|:APCP:surface:9-10 h*|:APCP:surface:10-11 h*|:APCP:surface:11-12 h*|:APCP:surface:12-13 h*|:APCP:surface:13-14 h*|:APCP:surface:14-15 h*|:APCP:surface:15-16 h*|:APCP:surface:16-17 h*|:APCP:surface:17-18 h*|:APCP:surface:18-19 h*|:APCP:surface:19-20 h*|:APCP:surface:20-21 h*|:APCP:surface:21-22 h*|:APCP:surface:22-23 h*|:APCP:surface:23-24 h*|:APCP:surface:24-25 h*|:APCP:surface:25-26 h*|:APCP:surface:26-27 h*|:APCP:surface:27-28 h*|:APCP:surface:28-29 h*|:APCP:surface:29-30 h*|:APCP:surface:30-31 h*|:APCP:surface:31-32 h*|:APCP:surface:32-33 h*|:APCP:surface:33-34 h*|:APCP:surface:34-35 h*|:APCP:surface:35-36 h*|:APCP:surface:36-37 h*|:APCP:surface:37-38 h*|:APCP:surface:38-39 h*|:APCP:surface:39-40 h*|:APCP:surface:40-41 h*|:APCP:surface:41-42 h*|:APCP:surface:42-43 h*|:APCP:surface:43-44 h*|:APCP:surface:44-45 h*|:APCP:surface:45-46 h*|:APCP:surface:46-47 h*)'
ecCodes-style index files
-------------------------

Expand Down

0 comments on commit 7f7bd1c

Please sign in to comment.