Repository: DHI/mikeio
Pull request #478 (2022-11-20 13:26:52)

Pfs. Find keys and params

![image](https://user-images.githubusercontent.com/34088801/204666088-8a6340c4-4aae-448f-9f6e-68fa598ca6eb.png)


![image](https://user-images.githubusercontent.com/34088801/204665119-ff9a4354-d5d4-4f6c-8c4c-a4272e0a002e.png)

![image](https://user-images.githubusercontent.com/34088801/204665828-4a7d76e9-4fd8-401f-bfd2-38cb7262eb80.png)




Patch:
diff --git a/mikeio/pfs.py b/mikeio/pfs.py
index 5775a430..0f2c97fa 100644
--- a/mikeio/pfs.py
+++ b/mikeio/pfs.py
@@ -1,6 +1,6 @@
 from pathlib import Path
 from types import SimpleNamespace
-from typing import List, Sequence, Tuple, Union, Callable
+from typing import List, Sequence, Tuple, Sequence, Mapping, Union, Callable
 from collections import Counter
 from datetime import datetime
 import re
@@ -37,6 +37,33 @@ class PfsNonUniqueList(list):
     pass
 
 
+def _merge_PfsSections(sections: Sequence[Mapping]):
+    """Merge a list of PfsSections/dict"""
+    assert len(sections) > 0
+    a = sections[0]
+    for b in sections[1:]:
+        a = _merge_dict(a, b)
+    return PfsSection(a)
+
+
+def _merge_dict(a: Mapping, b: Mapping, path: Sequence = None):
+    """merges dict b into dict a; handling non-unique keys"""
+    if path is None:
+        path = []
+    for key in b:
+        if key in a:
+            if isinstance(a[key], dict) and isinstance(b[key], dict):
+                _merge_dict(a[key], b[key], path + [str(key)])
+            # elif a[key] == b[key]:
+            #     pass  # same leaf value
+            else:
+                ab = list(a[key]) + list(b[key])
+                a[key] = PfsNonUniqueList(ab)
+        else:
+            a[key] = b[key]
+    return a
+
+
 class PfsSection(SimpleNamespace):
     def __init__(self, dictionary, **kwargs):
         super().__init__(**kwargs)
@@ -153,6 +180,81 @@ class PfsSection(SimpleNamespace):
             elif k == key:
                 self[k] = value
 
+    def search(self, text:str=None, *, key:str=None, section:str=None, param=None, case:bool=False):
+        """Find recursively all keys, sections or parameters 
+           matching a pattern
+        
+        NOTE: logical OR between multiple conditions
+
+        Parameters
+        ----------
+        text : str, optional
+            Search for text in either key, section or parameter, by default None
+        key : str, optional
+            text pattern to seach for in keywords, by default None
+        section : str, optional
+            text pattern to seach for in sections, by default None
+        param : str, bool, float, int, optional
+            text or value in a parameter, by default None
+        case : bool, optional
+            should the text search be case-sensitive?, by default False
+
+        Returns
+        -------
+        PfsSection
+            Search result as a nested PfsSection
+        """
+        results = []
+        if text is not None:
+            assert key is None, "text and key cannot both be provided!"
+            assert section is None, "text and section cannot both be provided!"
+            assert param is None, "text and param cannot both be provided!"
+            key = text
+            section = text
+            param = text
+        key = key if (key is None or case) else key.lower()
+        section = section if (section is None or case) else section.lower()
+        param = param if (param is None or not isinstance(param, str) or case) else param.lower()
+        for item in self._find_patterns_generator(keypat=key, parampat=param, secpat=section, case=case):
+            results.append(item)
+        return _merge_PfsSections(results) if len(results) > 0 else None
+    
+    def _find_patterns_generator(self, keypat=None, parampat=None, secpat=None, keylist=[], case=False):
+        """Look for patterns in either keys, params or sections"""
+        for k, v in self.items():
+            kk = str(k) if case else str(k).lower()
+
+            if isinstance(v, self.__class__):
+                if secpat and secpat in kk:
+                    yield from self._yield_deep_dict(keylist + [k], v)
+                else:
+                    yield from v._find_patterns_generator(keypat, parampat, secpat, keylist=keylist + [k], case=case)
+            else:
+                if keypat and keypat in kk:
+                    yield from self._yield_deep_dict(keylist + [k], v)   
+                if self._param_match(parampat, v, case):
+                    yield from self._yield_deep_dict(keylist + [k], v)                    
+    
+    @staticmethod
+    def _yield_deep_dict(keys, val):
+        """yield a deep nested dict with keys with a single deep value val"""
+        for j in range(len(keys) - 1, -1, -1):
+            d = {keys[j]: val}
+            val = d
+        yield d
+                
+    @staticmethod
+    def _param_match(parampat, v, case):
+        if parampat is None:
+            return False
+        if type(v) != type(parampat):
+            return False
+        if isinstance(v, str):
+            vv = str(v) if case else str(v).lower()
+            return parampat in vv
+        else:
+            return parampat == v 
+
     def find_replace(self, old_value, new_value):
         """Update recursively all old_value with new_value"""
         for k, v in self.items():
@@ -520,6 +622,37 @@ class Pfs:
                 d[n] = target.to_dict()
         return d
 
+    def search(self, text:str=None, *, key:str=None, section:str=None, param=None, case:bool=False) -> PfsSection:
+        """Find recursively all keys, sections or parameters 
+           matching a pattern
+        
+        NOTE: logical OR between multiple conditions
+
+        Parameters
+        ----------
+        text : str, optional
+            Search for text in either key, section or parameter, by default None
+        key : str, optional
+            text pattern to seach for in keywords, by default None
+        section : str, optional
+            text pattern to seach for in sections, by default None
+        param : str, bool, float, int, optional
+            text or value in a parameter, by default None
+        case : bool, optional
+            should the text search be case-sensitive?, by default False
+
+        Returns
+        -------
+        PfsSection
+            Search result as a nested PfsSection
+        """
+        results = []
+        for n, target in zip(self.names, self._targets):
+            res = target.search(text=text, key=key, section=section, param=param, case=case)
+            if res:
+                results.append({n:res})
+        return _merge_PfsSections(results) if len(results) > 0 else None    
+
     def _read_pfs_file(self, filename, encoding, unique_keywords=False):
         self._filename = filename
         try:
diff --git a/notebooks/PFS.ipynb b/notebooks/PFS.ipynb
index dffec453..eef7014c 100644
--- a/notebooks/PFS.ipynb
+++ b/notebooks/PFS.ipynb
@@ -103,98 +103,168 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 5,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "Touched = 0\n",
-       "mode_of_hydrodynamic_module = 0\n",
-       "hydrodynamic_features = 1\n",
-       "fluid_property = 1\n",
-       "mode_of_spectral_wave_module = 2\n",
-       "mode_of_transport_module = 0\n",
-       "mode_of_mud_transport_module = 0\n",
-       "mode_of_eco_lab_module = 0\n",
-       "mode_of_sand_transport_module = 0\n",
-       "mode_of_particle_tracking_module = 0\n",
-       "mode_of_oil_spill_module = 0\n",
-       "mode_of_shoreline_module = 0"
-      ]
-     },
-     "execution_count": 5,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "pfs.FemEngineSW.MODULE_SELECTION"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 6,
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "pfs.FemEngineSW.MODULE_SELECTION.mode_of_spectral_wave_module"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "If you are unsure the name of a section, it is also possible to search for a specific string in the file, to find the name of a specific section.\n",
+    "\n",
+    "In the example below we do an case-insensitive search for the string 'charnock', which occurs at 6 different places in this file."
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 22,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "2"
+       "[FemEngineSW]\n",
+       "   [SPECTRAL_WAVE_MODULE]\n",
+       "      [WIND]\n",
+       "         background_Charnock_parameter = 0.01\n",
+       "         Charnock_parameter = 0.01\n",
+       "      EndSect  // WIND\n",
+       "      [OUTPUTS]\n",
+       "         [OUTPUT_1]\n",
+       "            [MODEL_PARAMETERS]\n",
+       "               Charnock_constant = 0\n",
+       "            EndSect  // MODEL_PARAMETERS\n",
+       "         EndSect  // OUTPUT_1\n",
+       "         [OUTPUT_2]\n",
+       "            [MODEL_PARAMETERS]\n",
+       "               Charnock_constant = 0\n",
+       "            EndSect  // MODEL_PARAMETERS\n",
+       "         EndSect  // OUTPUT_2\n",
+       "         [OUTPUT_3]\n",
+       "            [MODEL_PARAMETERS]\n",
+       "               Charnock_constant = 0\n",
+       "            EndSect  // MODEL_PARAMETERS\n",
+       "         EndSect  // OUTPUT_3\n",
+       "         [OUTPUT_4]\n",
+       "            [MODEL_PARAMETERS]\n",
+       "               Charnock_constant = 0\n",
+       "            EndSect  // MODEL_PARAMETERS\n",
+       "         EndSect  // OUTPUT_4\n",
+       "      EndSect  // OUTPUTS\n",
+       "   EndSect  // SPECTRAL_WAVE_MODULE\n",
+       "EndSect  // FemEngineSW"
       ]
      },
-     "execution_count": 6,
+     "execution_count": 22,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "pfs.FemEngineSW.MODULE_SELECTION.mode_of_spectral_wave_module"
+    "pfs.search(\"charnock\")"
    ]
   },
   {
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "MIKE FM PFS files has a specific structure and active FM modules can be accessed by an alias on the Pfs object. In this case, `pfs.SW` can be used as a short-hand for `pfs.FemEngineSW.SPECTRAL_WAVE_MODULE`."
+    "The same search can be done at any level of the hierarchy, i.e. to search only within the OUTPUTS section:"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 7,
+   "execution_count": 25,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "16"
+       "[OUTPUT_1]\n",
+       "   [MODEL_PARAMETERS]\n",
+       "      Charnock_constant = 0\n",
+       "   EndSect  // MODEL_PARAMETERS\n",
+       "EndSect  // OUTPUT_1\n",
+       "[OUTPUT_2]\n",
+       "   [MODEL_PARAMETERS]\n",
+       "      Charnock_constant = 0\n",
+       "   EndSect  // MODEL_PARAMETERS\n",
+       "EndSect  // OUTPUT_2\n",
+       "[OUTPUT_3]\n",
+       "   [MODEL_PARAMETERS]\n",
+       "      Charnock_constant = 0\n",
+       "   EndSect  // MODEL_PARAMETERS\n",
+       "EndSect  // OUTPUT_3\n",
+       "[OUTPUT_4]\n",
+       "   [MODEL_PARAMETERS]\n",
+       "      Charnock_constant = 0\n",
+       "   EndSect  // MODEL_PARAMETERS\n",
+       "EndSect  // OUTPUT_4"
       ]
      },
-     "execution_count": 7,
+     "execution_count": 25,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
    "source": [
-    "pfs.SW.SPECTRAL.number_of_directions"
+    "pfs.FemEngineSW.SPECTRAL_WAVE_MODULE.OUTPUTS.search(\"charnock\")"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 30,
    "metadata": {},
    "outputs": [
     {
      "data": {
       "text/plain": [
-       "0.5959088268863615"
+       "background_Charnock_parameter = 0.01\n",
+       "Charnock_parameter = 0.01"
       ]
      },
-     "execution_count": 8,
+     "execution_count": 30,
      "metadata": {},
      "output_type": "execute_result"
     }
    ],
+   "source": [
+    "pfs.FemEngineSW.SPECTRAL_WAVE_MODULE.WIND.search(\"charnock\")"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "MIKE FM PFS files has a specific structure and active FM modules can be accessed by an alias on the Pfs object. In this case, `pfs.SW` can be used as a short-hand for `pfs.FemEngineSW.SPECTRAL_WAVE_MODULE`."
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "pfs.SW.SPECTRAL.number_of_directions"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
    "source": [
     "pfs.SW.SPECTRAL.maximum_threshold_frequency"
    ]
@@ -208,224 +278,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "<div>\n",
-       "<style scoped>\n",
-       "    .dataframe tbody tr th:only-of-type {\n",
-       "        vertical-align: middle;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe tbody tr th {\n",
-       "        vertical-align: top;\n",
-       "    }\n",
-       "\n",
-       "    .dataframe thead th {\n",
-       "        text-align: right;\n",
-       "    }\n",
-       "</style>\n",
-       "<table border=\"1\" class=\"dataframe\">\n",
-       "  <thead>\n",
-       "    <tr style=\"text-align: right;\">\n",
-       "      <th></th>\n",
-       "      <th>Touched</th>\n",
-       "      <th>include</th>\n",
-       "      <th>title</th>\n",
-       "      <th>file_name</th>\n",
-       "      <th>type</th>\n",
-       "      <th>format</th>\n",
-       "      <th>flood_and_dry</th>\n",
-       "      <th>coordinate_type</th>\n",
-       "      <th>zone</th>\n",
-       "      <th>input_file_name</th>\n",
-       "      <th>...</th>\n",
-       "      <th>last_time_step</th>\n",
-       "      <th>time_step_frequency</th>\n",
-       "      <th>number_of_points</th>\n",
-       "      <th>POINT_1</th>\n",
-       "      <th>LINE</th>\n",
-       "      <th>AREA</th>\n",
-       "      <th>INTEGRAL_WAVE_PARAMETERS</th>\n",
-       "      <th>INPUT_PARAMETERS</th>\n",
-       "      <th>MODEL_PARAMETERS</th>\n",
-       "      <th>SPECTRAL_PARAMETERS</th>\n",
-       "    </tr>\n",
-       "  </thead>\n",
-       "  <tbody>\n",
-       "    <tr>\n",
-       "      <th>1</th>\n",
-       "      <td>1</td>\n",
-       "      <td>1</td>\n",
-       "      <td>Wave parameters in domain</td>\n",
-       "      <td>Wave_parameters.dfsu</td>\n",
-       "      <td>1</td>\n",
-       "      <td>2</td>\n",
-       "      <td>2</td>\n",
-       "      <td>UTM-32</td>\n",
-       "      <td>0</td>\n",
-       "      <td>||</td>\n",
-       "      <td>...</td>\n",
-       "      <td>450</td>\n",
-       "      <td>10</td>\n",
-       "      <td>1</td>\n",
-       "      <td>{'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0}</td>\n",
-       "      <td>{'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,...</td>\n",
-       "      <td>{'number_of_points': 4, 'POINT_1': {'x': -400....</td>\n",
-       "      <td>{'Touched': 1, 'type_of_spectrum': 1, 'minimum...</td>\n",
-       "      <td>{'Touched': 1, 'Surface_elevation': 0, 'Water_...</td>\n",
-       "      <td>{'Touched': 1, 'Wind_friction_speed': 0, 'Roug...</td>\n",
-       "      <td>{'Touched': 1, 'separation_of_wind_sea_and_swe...</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>2</th>\n",
-       "      <td>1</td>\n",
-       "      <td>0</td>\n",
-       "      <td>Wave parameters along line</td>\n",
-       "      <td>Wave_line.dfs1</td>\n",
-       "      <td>1</td>\n",
-       "      <td>1</td>\n",
-       "      <td>2</td>\n",
-       "      <td>UTM-32</td>\n",
-       "      <td>0</td>\n",
-       "      <td>||</td>\n",
-       "      <td>...</td>\n",
-       "      <td>450</td>\n",
-       "      <td>10</td>\n",
-       "      <td>1</td>\n",
-       "      <td>{'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0}</td>\n",
-       "      <td>{'npoints': 41, 'x_first': 0.0, 'y_first': 200...</td>\n",
-       "      <td>{'number_of_points': 4, 'POINT_1': {'x': -400....</td>\n",
-       "      <td>{'Touched': 1, 'type_of_spectrum': 1, 'minimum...</td>\n",
-       "      <td>{'Touched': 1, 'Surface_elevation': 0, 'Water_...</td>\n",
-       "      <td>{'Touched': 1, 'Wind_friction_speed': 0, 'Roug...</td>\n",
-       "      <td>{'Touched': 1, 'separation_of_wind_sea_and_swe...</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>3</th>\n",
-       "      <td>1</td>\n",
-       "      <td>1</td>\n",
-       "      <td>Wave parameters  in a point</td>\n",
-       "      <td>Waves_x20km_y20km.dfs0</td>\n",
-       "      <td>1</td>\n",
-       "      <td>0</td>\n",
-       "      <td>2</td>\n",
-       "      <td>UTM-32</td>\n",
-       "      <td>0</td>\n",
-       "      <td>||</td>\n",
-       "      <td>...</td>\n",
-       "      <td>450</td>\n",
-       "      <td>1</td>\n",
-       "      <td>1</td>\n",
-       "      <td>{'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0}</td>\n",
-       "      <td>{'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,...</td>\n",
-       "      <td>{'number_of_points': 4, 'POINT_1': {'x': -400....</td>\n",
-       "      <td>{'Touched': 1, 'type_of_spectrum': 1, 'minimum...</td>\n",
-       "      <td>{'Touched': 1, 'Surface_elevation': 0, 'Water_...</td>\n",
-       "      <td>{'Touched': 1, 'Wind_friction_speed': 0, 'Roug...</td>\n",
-       "      <td>{'Touched': 1, 'separation_of_wind_sea_and_swe...</td>\n",
-       "    </tr>\n",
-       "    <tr>\n",
-       "      <th>4</th>\n",
-       "      <td>1</td>\n",
-       "      <td>1</td>\n",
-       "      <td>Spectrum in a point</td>\n",
-       "      <td>spectrum_x20km_y20km.dfsu</td>\n",
-       "      <td>4</td>\n",
-       "      <td>0</td>\n",
-       "      <td>2</td>\n",
-       "      <td>UTM-32</td>\n",
-       "      <td>0</td>\n",
-       "      <td>||</td>\n",
-       "      <td>...</td>\n",
-       "      <td>450</td>\n",
-       "      <td>10</td>\n",
-       "      <td>1</td>\n",
-       "      <td>{'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0}</td>\n",
-       "      <td>{'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,...</td>\n",
-       "      <td>{'number_of_points': 4, 'POINT_1': {'x': -400....</td>\n",
-       "      <td>{'Touched': 1, 'type_of_spectrum': 1, 'minimum...</td>\n",
-       "      <td>{'Touched': 1, 'Surface_elevation': 0, 'Water_...</td>\n",
-       "      <td>{'Touched': 1, 'Wind_friction_speed': 0, 'Roug...</td>\n",
-       "      <td>{'Touched': 1, 'separation_of_wind_sea_and_swe...</td>\n",
-       "    </tr>\n",
-       "  </tbody>\n",
-       "</table>\n",
-       "<p>4 rows × 24 columns</p>\n",
-       "</div>"
-      ],
-      "text/plain": [
-       "   Touched  include                        title                  file_name  \\\n",
-       "1        1        1    Wave parameters in domain       Wave_parameters.dfsu   \n",
-       "2        1        0   Wave parameters along line             Wave_line.dfs1   \n",
-       "3        1        1  Wave parameters  in a point     Waves_x20km_y20km.dfs0   \n",
-       "4        1        1          Spectrum in a point  spectrum_x20km_y20km.dfsu   \n",
-       "\n",
-       "   type  format  flood_and_dry coordinate_type  zone input_file_name  ...  \\\n",
-       "1     1       2              2          UTM-32     0              ||  ...   \n",
-       "2     1       1              2          UTM-32     0              ||  ...   \n",
-       "3     1       0              2          UTM-32     0              ||  ...   \n",
-       "4     4       0              2          UTM-32     0              ||  ...   \n",
-       "\n",
-       "   last_time_step  time_step_frequency  number_of_points  \\\n",
-       "1             450                   10                 1   \n",
-       "2             450                   10                 1   \n",
-       "3             450                    1                 1   \n",
-       "4             450                   10                 1   \n",
-       "\n",
-       "                                           POINT_1  \\\n",
-       "1  {'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0}   \n",
-       "2  {'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0}   \n",
-       "3  {'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0}   \n",
-       "4  {'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0}   \n",
-       "\n",
-       "                                                LINE  \\\n",
-       "1  {'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,...   \n",
-       "2  {'npoints': 41, 'x_first': 0.0, 'y_first': 200...   \n",
-       "3  {'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,...   \n",
-       "4  {'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,...   \n",
-       "\n",
-       "                                                AREA  \\\n",
-       "1  {'number_of_points': 4, 'POINT_1': {'x': -400....   \n",
-       "2  {'number_of_points': 4, 'POINT_1': {'x': -400....   \n",
-       "3  {'number_of_points': 4, 'POINT_1': {'x': -400....   \n",
-       "4  {'number_of_points': 4, 'POINT_1': {'x': -400....   \n",
-       "\n",
-       "                            INTEGRAL_WAVE_PARAMETERS  \\\n",
-       "1  {'Touched': 1, 'type_of_spectrum': 1, 'minimum...   \n",
-       "2  {'Touched': 1, 'type_of_spectrum': 1, 'minimum...   \n",
-       "3  {'Touched': 1, 'type_of_spectrum': 1, 'minimum...   \n",
-       "4  {'Touched': 1, 'type_of_spectrum': 1, 'minimum...   \n",
-       "\n",
-       "                                    INPUT_PARAMETERS  \\\n",
-       "1  {'Touched': 1, 'Surface_elevation': 0, 'Water_...   \n",
-       "2  {'Touched': 1, 'Surface_elevation': 0, 'Water_...   \n",
-       "3  {'Touched': 1, 'Surface_elevation': 0, 'Water_...   \n",
-       "4  {'Touched': 1, 'Surface_elevation': 0, 'Water_...   \n",
-       "\n",
-       "                                    MODEL_PARAMETERS  \\\n",
-       "1  {'Touched': 1, 'Wind_friction_speed': 0, 'Roug...   \n",
-       "2  {'Touched': 1, 'Wind_friction_speed': 0, 'Roug...   \n",
-       "3  {'Touched': 1, 'Wind_friction_speed': 0, 'Roug...   \n",
-       "4  {'Touched': 1, 'Wind_friction_speed': 0, 'Roug...   \n",
-       "\n",
-       "                                 SPECTRAL_PARAMETERS  \n",
-       "1  {'Touched': 1, 'separation_of_wind_sea_and_swe...  \n",
-       "2  {'Touched': 1, 'separation_of_wind_sea_and_swe...  \n",
-       "3  {'Touched': 1, 'separation_of_wind_sea_and_swe...  \n",
-       "4  {'Touched': 1, 'separation_of_wind_sea_and_swe...  \n",
-       "\n",
-       "[4 rows x 24 columns]"
-      ]
-     },
-     "execution_count": 9,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "df = pfs.SW.OUTPUTS.to_dataframe()\n",
     "df"
@@ -442,7 +297,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -451,32 +306,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 11,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "Touched = 1\n",
-       "type_of_frequency_discretization = 2\n",
-       "number_of_frequencies = 25\n",
-       "minimum_frequency = 0.055\n",
-       "frequency_interval = 0.02\n",
-       "frequency_factor = 1.1\n",
-       "type_of_directional_discretization = 1\n",
-       "number_of_directions = 32\n",
-       "minimum_direction = 0.0\n",
-       "maximum_direction = 0.0\n",
-       "separation_of_wind_sea_and_swell = 0\n",
-       "threshold_frequency = 0.125\n",
-       "maximum_threshold_frequency = 0.5959088268863615"
-      ]
-     },
-     "execution_count": 11,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "pfs.SW.SPECTRAL"
    ]
@@ -490,7 +322,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 12,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -499,7 +331,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 13,
+   "execution_count": 29,
    "metadata": {},
    "outputs": [
     {
@@ -521,7 +353,7 @@
        "new_keyword = 'new_value'"
       ]
      },
-     "execution_count": 13,
+     "execution_count": 29,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -541,7 +373,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 14,
+   "execution_count": 30,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -550,7 +382,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 15,
+   "execution_count": 31,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -559,7 +391,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 16,
+   "execution_count": 32,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -570,7 +402,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 17,
+   "execution_count": 33,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -579,7 +411,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 18,
+   "execution_count": 34,
    "metadata": {},
    "outputs": [
     {
@@ -588,7 +420,7 @@
        "dict_keys(['Touched', 'MzSEPfsListItemCount', 'number_of_outputs', 'OUTPUT_1', 'OUTPUT_2', 'OUTPUT_3', 'OUTPUT_4', 'OUTPUT_5'])"
       ]
      },
-     "execution_count": 18,
+     "execution_count": 34,
      "metadata": {},
      "output_type": "execute_result"
     }
@@ -608,7 +440,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 19,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -617,932 +449,16 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 20,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "{'FemEngineSW': {'DOMAIN': {'Touched': 1,\n",
-       "   'discretization': 2,\n",
-       "   'number_of_dimensions': 2,\n",
-       "   'number_of_meshes': 1,\n",
-       "   'file_name': '|.\\\\Lake_Mesh.mesh|',\n",
-       "   'type_of_reordering': 1,\n",
-       "   'number_of_domains': 16,\n",
-       "   'coordinate_type': 'UTM-32',\n",
-       "   'minimum_depth': 0.0,\n",
-       "   'datum_depth': 0.0,\n",
-       "   'vertical_mesh_type_overall': 1,\n",
-       "   'number_of_layers': 11,\n",
-       "   'z_sigma': 0.0,\n",
-       "   'vertical_mesh_type': 1,\n",
-       "   'layer_thickness': [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.0],\n",
-       "   'sigma_c': 0.0,\n",
-       "   'theta': 2.0,\n",
-       "   'b': 0.0,\n",
-       "   'number_of_layers_zlevel': 10,\n",
-       "   'vertical_mesh_type_zlevel': 1,\n",
-       "   'constant_layer_thickness_zlevel': 0.0,\n",
-       "   'variable_layer_thickness_zlevel': [0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0,\n",
-       "    0.0],\n",
-       "   'type_of_bathymetry_adjustment': 1,\n",
-       "   'minimum_layer_thickness_zlevel': 0.0,\n",
-       "   'type_of_mesh': 0,\n",
-       "   'type_of_gauss': 3,\n",
-       "   'BOUNDARY_NAMES': {'Touched': 0, 'MzSEPfsListItemCount': 0}},\n",
-       "  'TIME': {'Touched': 1,\n",
-       "   'start_time': datetime.datetime(2002, 1, 1, 0, 0),\n",
-       "   'time_step_interval': 120.0,\n",
-       "   'number_of_time_steps': 450},\n",
-       "  'MODULE_SELECTION': {'Touched': 0,\n",
-       "   'mode_of_hydrodynamic_module': 0,\n",
-       "   'hydrodynamic_features': 1,\n",
-       "   'fluid_property': 1,\n",
-       "   'mode_of_spectral_wave_module': 2,\n",
-       "   'mode_of_transport_module': 0,\n",
-       "   'mode_of_mud_transport_module': 0,\n",
-       "   'mode_of_eco_lab_module': 0,\n",
-       "   'mode_of_sand_transport_module': 0,\n",
-       "   'mode_of_particle_tracking_module': 0,\n",
-       "   'mode_of_oil_spill_module': 0,\n",
-       "   'mode_of_shoreline_module': 0},\n",
-       "  'SPECTRAL_WAVE_MODULE': {'mode': 2,\n",
-       "   'SPACE': {'number_of_mesh_geometry': 1},\n",
-       "   'EQUATION': {'Touched': 1,\n",
-       "    'formulation': 2,\n",
-       "    'time_formulation': 2,\n",
-       "    'JONSWAP_factor_1': 0.92,\n",
-       "    'JONSWAP_factor_2': 0.83},\n",
-       "   'TIME': {'Touched': 0,\n",
-       "    'start_time_step': 0,\n",
-       "    'time_step_factor': 1,\n",
-       "    'time_step_factor_AD': 1},\n",
-       "   'SPECTRAL': {'Touched': 1,\n",
-       "    'type_of_frequency_discretization': 2,\n",
-       "    'number_of_frequencies': 25,\n",
-       "    'minimum_frequency': 0.055,\n",
-       "    'frequency_interval': 0.02,\n",
-       "    'frequency_factor': 1.1,\n",
-       "    'type_of_directional_discretization': 1,\n",
-       "    'number_of_directions': 32,\n",
-       "    'minimum_direction': 0.0,\n",
-       "    'maximum_direction': 0.0,\n",
-       "    'separation_of_wind_sea_and_swell': 0,\n",
-       "    'threshold_frequency': 0.125,\n",
-       "    'maximum_threshold_frequency': 0.5959088268863615,\n",
-       "    'new_keyword': 'new_value'},\n",
-       "   'SOLUTION_TECHNIQUE': {'Touched': 1,\n",
-       "    'error_level': 0,\n",
-       "    'maximum_number_of_errors': 200,\n",
-       "    'minimum_period': 0.1,\n",
-       "    'maximum_period': 25.0,\n",
-       "    'initial_period': 8.0,\n",
-       "    'scheme_of_space_discretization_geographical': 1,\n",
-       "    'scheme_of_space_discretization_direction': 1,\n",
-       "    'scheme_of_space_discretization_frequency': 1,\n",
-       "    'method': 2,\n",
-       "    'number_of_iterations': 10,\n",
-       "    'tolerance1': 0.0001,\n",
-       "    'tolerance2': 0.001,\n",
-       "    'relaxation_factor': 0.1,\n",
-       "    'number_of_levels_in_transport_calc': 32,\n",
-       "    'number_of_steps_in_source_calc': 1,\n",
-       "    'maximum_CFL_number': 1.0,\n",
-       "    'dt_min': 0.01,\n",
-       "    'dt_max': 120.0,\n",
-       "    'type_overall': 0,\n",
-       "    'file_name_overall': '|.\\\\convergence_overall.dfs0|',\n",
-       "    'input_format': 1,\n",
-       "    'coordinate_type': '',\n",
-       "    'input_file_name': '||',\n",
-       "    'number_of_points': 0,\n",
-       "    'type_domain': 0,\n",
-       "    'file_name_domain': '|.\\\\convergence_domain.dfsu|',\n",
-       "    'output_frequency': 5},\n",
-       "   'DEPTH': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'minimum_depth': 0.01,\n",
-       "    'format': 0,\n",
-       "    'soft_time_interval': 0.0,\n",
-       "    'constant_level': 0.0,\n",
-       "    'file_name': '||',\n",
-       "    'item_number': 1,\n",
-       "    'item_name': ''},\n",
-       "   'CURRENT': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'type_blocking': 1,\n",
-       "    'factor_blocking': 0.1,\n",
-       "    'format': 0,\n",
-       "    'soft_time_interval': 0.0,\n",
-       "    'constant_x_velocity': 0.0,\n",
-       "    'constant_y_velocity': 0.0,\n",
-       "    'file_name': '||',\n",
-       "    'item_number_for_x_velocity': 0,\n",
-       "    'item_number_for_y_velocity': 0,\n",
-       "    'item_name_for_x_velocity': '',\n",
-       "    'item_name_for_y_velocity': ''},\n",
-       "   'WIND': {'Touched': 1,\n",
-       "    'type': 1,\n",
-       "    'format': 1,\n",
-       "    'constant_speed': 15.0,\n",
-       "    'constant_direction': 270.0,\n",
-       "    'file_name': '|.\\\\Wind.dfs0|',\n",
-       "    'item_number_for_speed': 1,\n",
-       "    'item_number_for_direction': 2,\n",
-       "    'item_name_for_speed': 'Speed',\n",
-       "    'item_name_for_direction': 'Direction',\n",
-       "    'soft_time_interval': 0.0,\n",
-       "    'formula': 1,\n",
-       "    'type_of_drag': 1,\n",
-       "    'linear_growth_coefficient': 0.0015,\n",
-       "    'type_of_air_sea_interaction': 1,\n",
-       "    'background_Charnock_parameter': 0.01,\n",
-       "    'Charnock_parameter': 0.01,\n",
-       "    'alpha_drag': 0.00063,\n",
-       "    'beta_drag': 6.6e-05},\n",
-       "   'ICE': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'format': 3,\n",
-       "    'c_cut_off': 0.33,\n",
-       "    'file_name': '||',\n",
-       "    'item_number': 1,\n",
-       "    'item_name': ''},\n",
-       "   'DIFFRACTION': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'minimum_delta': -0.75,\n",
-       "    'maximum_delta': 3.0,\n",
-       "    'type_of_smoothing': 1,\n",
-       "    'smoothing_factor': 1.0,\n",
-       "    'number_of_smoothing_steps': 1},\n",
-       "   'TRANSFER': {'Touched': 1, 'type': 1, 'type_triad': 0, 'alpha_EB': 0.25},\n",
-       "   'WAVE_BREAKING': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'type_of_gamma': 1,\n",
-       "    'alpha': 1.0,\n",
-       "    'gamma_steepness': 1.0,\n",
-       "    'type_of_effect_on_frequency': 1,\n",
-       "    'type_of_roller': 0,\n",
-       "    'roller_propagation_factor': 1.0,\n",
-       "    'roller_dissipation_factor': 0.15,\n",
-       "    'roller_density': 1000.0,\n",
-       "    'GAMMA': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 0.55,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1}},\n",
-       "   'BOTTOM_FRICTION': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'constant_fc': 0.0,\n",
-       "    'type_of_effect_on_frequency': 0,\n",
-       "    'FRICTION_COEFFICIENT': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 0.0775,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1},\n",
-       "    'FRICTION_FACTOR': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 0.0212,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1},\n",
-       "    'NIKURADSE_ROUGHNESS': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 0.04,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1},\n",
-       "    'SAND_GRAIN_SIZE': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 0.00025,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1}},\n",
-       "   'WHITECAPPING': {'Touched': 1,\n",
-       "    'type': 1,\n",
-       "    'type_of_spectrum': 3,\n",
-       "    'mean_frequency_power': -1,\n",
-       "    'mean_wave_number_power': -1,\n",
-       "    'dissipation_cdiss': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 4.5,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1},\n",
-       "    'dissipation_delta': {'Touched': 1,\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'constant_value': 0.5,\n",
-       "     'file_name': '||',\n",
-       "     'item_number': 1,\n",
-       "     'item_name': '',\n",
-       "     'type_of_soft_start': 2,\n",
-       "     'soft_time_interval': 0.0,\n",
-       "     'reference_value': 0.0,\n",
-       "     'type_of_time_interpolation': 1}},\n",
-       "   'STRUCTURES': {'type': 0,\n",
-       "    'input_format': 1,\n",
-       "    'coordinate_type': '',\n",
-       "    'number_of_structures': 0,\n",
-       "    'input_file_name': '||',\n",
-       "    'LINE_STRUCTURES': {'Touched': 1,\n",
-       "     'MzSEPfsListItemCount': 0,\n",
-       "     'output_of_link_data': 0,\n",
-       "     'file_name_section': 'line_section.xyz',\n",
-       "     'number_of_structures': 0}},\n",
-       "   'INITIAL_CONDITIONS': {'Touched': 1,\n",
-       "    'type': 0,\n",
-       "    'type_additional': 1,\n",
-       "    'type_of_spectra': 1,\n",
-       "    'fetch': 40000.0,\n",
-       "    'max_peak_frequency': 0.4,\n",
-       "    'max_Phillips_constant': 0.0081,\n",
-       "    'shape_parameter_sigma_a': 0.07,\n",
-       "    'shape_parameter_sigma_b': 0.09,\n",
-       "    'peakednes_parameter_gamma': 3.3,\n",
-       "    'file_name_m': '||',\n",
-       "    'item_number_m0': 1,\n",
-       "    'item_number_m1': 1,\n",
-       "    'item_name_m0': '',\n",
-       "    'item_name_m1': '',\n",
-       "    'file_name_A': '||',\n",
-       "    'item_number_A': 1,\n",
-       "    'item_name_A': ''},\n",
-       "   'BOUNDARY_CONDITIONS': {'Touched': 0,\n",
-       "    'MzSEPfsListItemCount': 0,\n",
-       "    'CODE_1': {}},\n",
-       "   'OUTPUTS': {'Touched': 1,\n",
-       "    'MzSEPfsListItemCount': 4,\n",
-       "    'number_of_outputs': 5,\n",
-       "    'OUTPUT_1': {'Touched': 1,\n",
-       "     'include': 1,\n",
-       "     'title': 'Wave parameters in domain',\n",
-       "     'file_name': 'Wave_parameters.dfsu',\n",
-       "     'type': 1,\n",
-       "     'format': 2,\n",
-       "     'flood_and_dry': 2,\n",
-       "     'coordinate_type': 'UTM-32',\n",
-       "     'zone': 0,\n",
-       "     'input_file_name': '||',\n",
-       "     'input_format': 1,\n",
-       "     'interpolation_type': 1,\n",
-       "     'use_end_time': 1,\n",
-       "     'first_time_step': 0,\n",
-       "     'last_time_step': 450,\n",
-       "     'time_step_frequency': 10,\n",
-       "     'number_of_points': 1,\n",
-       "     'POINT_1': {'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0},\n",
-       "     'LINE': {'npoints': 3,\n",
-       "      'x_first': 0.0,\n",
-       "      'y_first': 0.0,\n",
-       "      'x_last': 40000.0,\n",
-       "      'y_last': 40000.0},\n",
-       "     'AREA': {'number_of_points': 4,\n",
-       "      'POINT_1': {'x': -400.0, 'y': -400.0},\n",
-       "      'POINT_2': {'x': -400.0, 'y': 40400.0},\n",
-       "      'POINT_3': {'x': 40400.0, 'y': 40400.0},\n",
-       "      'POINT_4': {'x': 40400.0, 'y': -400.0},\n",
-       "      'orientation': 0.0,\n",
-       "      'x_origo': 0.0,\n",
-       "      'x_ds': 2105.263157894737,\n",
-       "      'x_npoints': 20,\n",
-       "      'y_origo': 0.0,\n",
-       "      'y_ds': 2105.263157894737,\n",
-       "      'y_npoints': 20,\n",
-       "      'z_origo': -15.00000000000001,\n",
-       "      'z_ds': 2.000000000000001,\n",
-       "      'z_npoints': 10},\n",
-       "     'INTEGRAL_WAVE_PARAMETERS': {'Touched': 1,\n",
-       "      'type_of_spectrum': 1,\n",
-       "      'minimum_frequency': 0.055,\n",
-       "      'maximum_frequency': 0.5959088268863617,\n",
-       "      'separation_of_wind_sea_and_swell': 3,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'hm0_minimum': 0.01,\n",
-       "      'type_of_h_max': 3,\n",
-       "      'duration': 10800.0,\n",
-       "      'distance_above_bed_for_particle_velocity': 0.0,\n",
-       "      'minimum_direction': 0.0,\n",
-       "      'maximum_direction': 360.0,\n",
-       "      'Total_wave_parameters': {'Significant_wave_height': 1,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 1,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 1,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 1,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 1,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Wind_sea_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Swell_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0}},\n",
-       "     'INPUT_PARAMETERS': {'Touched': 1,\n",
-       "      'Surface_elevation': 0,\n",
-       "      'Water_depth': 0,\n",
-       "      'Current_velocity_components': 0,\n",
-       "      'Wind_speed': 0,\n",
-       "      'Wind_direction': 0,\n",
-       "      'Ice_concentration': 0},\n",
-       "     'MODEL_PARAMETERS': {'Touched': 1,\n",
-       "      'Wind_friction_speed': 0,\n",
-       "      'Roughness_length': 0,\n",
-       "      'Drag_coefficient': 0,\n",
-       "      'Charnock_constant': 0,\n",
-       "      'Friction_coefficient': 0,\n",
-       "      'Breaking_parameter_gamma': 0,\n",
-       "      'Courant_number': 1,\n",
-       "      'Time_step_factor': 1,\n",
-       "      'Convergence_angle': 0,\n",
-       "      'Length': 0,\n",
-       "      'Area': 0,\n",
-       "      'Threshold_period': 0,\n",
-       "      'Roller_area': 0,\n",
-       "      'Roller_dissipation': 0,\n",
-       "      'Breaking_index': 0},\n",
-       "     'SPECTRAL_PARAMETERS': {'Touched': 1,\n",
-       "      'separation_of_wind_sea_and_swell': 3.0,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'wave_energy': 1,\n",
-       "      'wave_action': 0,\n",
-       "      'zeroth_moment_of_wave_action': 0,\n",
-       "      'first_moment_of_wave_action': 0,\n",
-       "      'wave_energy_wind_sea': 0,\n",
-       "      'wave_energy_swell': 0}},\n",
-       "    'OUTPUT_2': {'Touched': 1,\n",
-       "     'include': 0,\n",
-       "     'title': 'Wave parameters along line',\n",
-       "     'file_name': 'Wave_line.dfs1',\n",
-       "     'type': 1,\n",
-       "     'format': 1,\n",
-       "     'flood_and_dry': 2,\n",
-       "     'coordinate_type': 'UTM-32',\n",
-       "     'zone': 0,\n",
-       "     'input_file_name': '||',\n",
-       "     'input_format': 1,\n",
-       "     'interpolation_type': 2,\n",
-       "     'use_end_time': 1,\n",
-       "     'first_time_step': 0,\n",
-       "     'last_time_step': 450,\n",
-       "     'time_step_frequency': 10,\n",
-       "     'number_of_points': 1,\n",
-       "     'POINT_1': {'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0},\n",
-       "     'LINE': {'npoints': 41,\n",
-       "      'x_first': 0.0,\n",
-       "      'y_first': 20000.0,\n",
-       "      'x_last': 40000.0,\n",
-       "      'y_last': 20000.0},\n",
-       "     'AREA': {'number_of_points': 4,\n",
-       "      'POINT_1': {'x': -400.0, 'y': -400.0},\n",
-       "      'POINT_2': {'x': -400.0, 'y': 40400.0},\n",
-       "      'POINT_3': {'x': 40400.0, 'y': 40400.0},\n",
-       "      'POINT_4': {'x': 40400.0, 'y': -400.0},\n",
-       "      'orientation': 0.0,\n",
-       "      'x_origo': 0.0,\n",
-       "      'x_ds': 2105.263157894737,\n",
-       "      'x_npoints': 20,\n",
-       "      'y_origo': 0.0,\n",
-       "      'y_ds': 2105.263157894737,\n",
-       "      'y_npoints': 20,\n",
-       "      'z_origo': -15.00000000000001,\n",
-       "      'z_ds': 2.000000000000001,\n",
-       "      'z_npoints': 10},\n",
-       "     'INTEGRAL_WAVE_PARAMETERS': {'Touched': 1,\n",
-       "      'type_of_spectrum': 1,\n",
-       "      'minimum_frequency': 0.055,\n",
-       "      'maximum_frequency': 0.5959088268863617,\n",
-       "      'separation_of_wind_sea_and_swell': 3,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'hm0_minimum': 0.01,\n",
-       "      'type_of_h_max': 3,\n",
-       "      'duration': 10800.0,\n",
-       "      'distance_above_bed_for_particle_velocity': 0.0,\n",
-       "      'minimum_direction': 0.0,\n",
-       "      'maximum_direction': 360.0,\n",
-       "      'Total_wave_parameters': {'Significant_wave_height': 1,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 1,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 1,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 1,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Wind_sea_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Swell_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0}},\n",
-       "     'INPUT_PARAMETERS': {'Touched': 1,\n",
-       "      'Surface_elevation': 0,\n",
-       "      'Water_depth': 0,\n",
-       "      'Current_velocity_components': 0,\n",
-       "      'Wind_speed': 0,\n",
-       "      'Wind_direction': 0,\n",
-       "      'Ice_concentration': 0},\n",
-       "     'MODEL_PARAMETERS': {'Touched': 1,\n",
-       "      'Wind_friction_speed': 0,\n",
-       "      'Roughness_length': 0,\n",
-       "      'Drag_coefficient': 0,\n",
-       "      'Charnock_constant': 0,\n",
-       "      'Friction_coefficient': 0,\n",
-       "      'Breaking_parameter_gamma': 0,\n",
-       "      'Courant_number': 0,\n",
-       "      'Time_step_factor': 0,\n",
-       "      'Convergence_angle': 0,\n",
-       "      'Length': 0,\n",
-       "      'Area': 0,\n",
-       "      'Threshold_period': 0,\n",
-       "      'Roller_area': 0,\n",
-       "      'Roller_dissipation': 0,\n",
-       "      'Breaking_index': 0},\n",
-       "     'SPECTRAL_PARAMETERS': {'Touched': 1,\n",
-       "      'separation_of_wind_sea_and_swell': 3.0,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'wave_energy': 1,\n",
-       "      'wave_action': 0,\n",
-       "      'zeroth_moment_of_wave_action': 0,\n",
-       "      'first_moment_of_wave_action': 0,\n",
-       "      'wave_energy_wind_sea': 0,\n",
-       "      'wave_energy_swell': 0}},\n",
-       "    'OUTPUT_3': {'Touched': 1,\n",
-       "     'include': 1,\n",
-       "     'title': 'Wave parameters  in a point',\n",
-       "     'file_name': 'Waves_x20km_y20km.dfs0',\n",
-       "     'type': 1,\n",
-       "     'format': 0,\n",
-       "     'flood_and_dry': 2,\n",
-       "     'coordinate_type': 'UTM-32',\n",
-       "     'zone': 0,\n",
-       "     'input_file_name': '||',\n",
-       "     'input_format': 1,\n",
-       "     'interpolation_type': 2,\n",
-       "     'use_end_time': 1,\n",
-       "     'first_time_step': 0,\n",
-       "     'last_time_step': 450,\n",
-       "     'time_step_frequency': 1,\n",
-       "     'number_of_points': 1,\n",
-       "     'POINT_1': {'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0},\n",
-       "     'LINE': {'npoints': 3,\n",
-       "      'x_first': 0.0,\n",
-       "      'y_first': 0.0,\n",
-       "      'x_last': 40000.0,\n",
-       "      'y_last': 40000.0},\n",
-       "     'AREA': {'number_of_points': 4,\n",
-       "      'POINT_1': {'x': -400.0, 'y': -400.0},\n",
-       "      'POINT_2': {'x': -400.0, 'y': 40400.0},\n",
-       "      'POINT_3': {'x': 40400.0, 'y': 40400.0},\n",
-       "      'POINT_4': {'x': 40400.0, 'y': -400.0},\n",
-       "      'orientation': 0.0,\n",
-       "      'x_origo': 0.0,\n",
-       "      'x_ds': 2105.263157894737,\n",
-       "      'x_npoints': 20,\n",
-       "      'y_origo': 0.0,\n",
-       "      'y_ds': 2105.263157894737,\n",
-       "      'y_npoints': 20,\n",
-       "      'z_origo': -15.00000000000001,\n",
-       "      'z_ds': 2.000000000000001,\n",
-       "      'z_npoints': 10},\n",
-       "     'INTEGRAL_WAVE_PARAMETERS': {'Touched': 1,\n",
-       "      'type_of_spectrum': 1,\n",
-       "      'minimum_frequency': 0.055,\n",
-       "      'maximum_frequency': 0.5959088268863617,\n",
-       "      'separation_of_wind_sea_and_swell': 3,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'hm0_minimum': 0.01,\n",
-       "      'type_of_h_max': 3,\n",
-       "      'duration': 10800.0,\n",
-       "      'distance_above_bed_for_particle_velocity': 0.0,\n",
-       "      'minimum_direction': 0.0,\n",
-       "      'maximum_direction': 360.0,\n",
-       "      'Total_wave_parameters': {'Significant_wave_height': 1,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 1,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 1,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 1,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Wind_sea_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Swell_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0}},\n",
-       "     'INPUT_PARAMETERS': {'Touched': 1,\n",
-       "      'Surface_elevation': 0,\n",
-       "      'Water_depth': 0,\n",
-       "      'Current_velocity_components': 0,\n",
-       "      'Wind_speed': 0,\n",
-       "      'Wind_direction': 0,\n",
-       "      'Ice_concentration': 0},\n",
-       "     'MODEL_PARAMETERS': {'Touched': 1,\n",
-       "      'Wind_friction_speed': 0,\n",
-       "      'Roughness_length': 0,\n",
-       "      'Drag_coefficient': 0,\n",
-       "      'Charnock_constant': 0,\n",
-       "      'Friction_coefficient': 0,\n",
-       "      'Breaking_parameter_gamma': 0,\n",
-       "      'Courant_number': 0,\n",
-       "      'Time_step_factor': 0,\n",
-       "      'Convergence_angle': 0,\n",
-       "      'Length': 0,\n",
-       "      'Area': 0,\n",
-       "      'Threshold_period': 0,\n",
-       "      'Roller_area': 0,\n",
-       "      'Roller_dissipation': 0,\n",
-       "      'Breaking_index': 0},\n",
-       "     'SPECTRAL_PARAMETERS': {'Touched': 1,\n",
-       "      'separation_of_wind_sea_and_swell': 3.0,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'wave_energy': 1,\n",
-       "      'wave_action': 0,\n",
-       "      'zeroth_moment_of_wave_action': 0,\n",
-       "      'first_moment_of_wave_action': 0,\n",
-       "      'wave_energy_wind_sea': 0,\n",
-       "      'wave_energy_swell': 0}},\n",
-       "    'OUTPUT_4': {'Touched': 1,\n",
-       "     'include': 1,\n",
-       "     'title': 'Spectrum in a point',\n",
-       "     'file_name': 'spectrum_x20km_y20km.dfsu',\n",
-       "     'type': 4,\n",
-       "     'format': 0,\n",
-       "     'flood_and_dry': 2,\n",
-       "     'coordinate_type': 'UTM-32',\n",
-       "     'zone': 0,\n",
-       "     'input_file_name': '||',\n",
-       "     'input_format': 1,\n",
-       "     'interpolation_type': 2,\n",
-       "     'use_end_time': 1,\n",
-       "     'first_time_step': 0,\n",
-       "     'last_time_step': 450,\n",
-       "     'time_step_frequency': 10,\n",
-       "     'number_of_points': 1,\n",
-       "     'POINT_1': {'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0},\n",
-       "     'LINE': {'npoints': 3,\n",
-       "      'x_first': 0.0,\n",
-       "      'y_first': 0.0,\n",
-       "      'x_last': 40000.0,\n",
-       "      'y_last': 40000.0},\n",
-       "     'AREA': {'number_of_points': 4,\n",
-       "      'POINT_1': {'x': -400.0, 'y': -400.0},\n",
-       "      'POINT_2': {'x': -400.0, 'y': 40400.0},\n",
-       "      'POINT_3': {'x': 40400.0, 'y': 40400.0},\n",
-       "      'POINT_4': {'x': 40400.0, 'y': -400.0},\n",
-       "      'orientation': 0.0,\n",
-       "      'x_origo': 0.0,\n",
-       "      'x_ds': 2105.263157894737,\n",
-       "      'x_npoints': 20,\n",
-       "      'y_origo': 0.0,\n",
-       "      'y_ds': 2105.263157894737,\n",
-       "      'y_npoints': 20,\n",
-       "      'z_origo': -15.00000000000001,\n",
-       "      'z_ds': 2.000000000000001,\n",
-       "      'z_npoints': 10},\n",
-       "     'INTEGRAL_WAVE_PARAMETERS': {'Touched': 1,\n",
-       "      'type_of_spectrum': 1,\n",
-       "      'minimum_frequency': 0.054321,\n",
-       "      'maximum_frequency': 0.0987654321,\n",
-       "      'separation_of_wind_sea_and_swell': 3,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'hm0_minimum': 0.01,\n",
-       "      'type_of_h_max': 3,\n",
-       "      'duration': 10800.0,\n",
-       "      'distance_above_bed_for_particle_velocity': 0.0,\n",
-       "      'minimum_direction': 0.0,\n",
-       "      'maximum_direction': 360.0,\n",
-       "      'Total_wave_parameters': {'Significant_wave_height': 1,\n",
-       "       'Maximum_wave_height': 1,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 1,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 1,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 1,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Wind_sea_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Swell_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0}},\n",
-       "     'INPUT_PARAMETERS': {'Touched': 1,\n",
-       "      'Surface_elevation': 0,\n",
-       "      'Water_depth': 0,\n",
-       "      'Current_velocity_components': 0,\n",
-       "      'Wind_speed': 0,\n",
-       "      'Wind_direction': 0,\n",
-       "      'Ice_concentration': 0},\n",
-       "     'MODEL_PARAMETERS': {'Touched': 1,\n",
-       "      'Wind_friction_speed': 0,\n",
-       "      'Roughness_length': 0,\n",
-       "      'Drag_coefficient': 0,\n",
-       "      'Charnock_constant': 0,\n",
-       "      'Friction_coefficient': 0,\n",
-       "      'Breaking_parameter_gamma': 0,\n",
-       "      'Courant_number': 0,\n",
-       "      'Time_step_factor': 0,\n",
-       "      'Convergence_angle': 0,\n",
-       "      'Length': 0,\n",
-       "      'Area': 0,\n",
-       "      'Threshold_period': 0,\n",
-       "      'Roller_area': 0,\n",
-       "      'Roller_dissipation': 0,\n",
-       "      'Breaking_index': 0},\n",
-       "     'SPECTRAL_PARAMETERS': {'Touched': 1,\n",
-       "      'separation_of_wind_sea_and_swell': 3.0,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'wave_energy': 1,\n",
-       "      'wave_action': 0,\n",
-       "      'zeroth_moment_of_wave_action': 0,\n",
-       "      'first_moment_of_wave_action': 0,\n",
-       "      'wave_energy_wind_sea': 0,\n",
-       "      'wave_energy_swell': 0}},\n",
-       "    'OUTPUT_5': {'Touched': 1,\n",
-       "     'include': 1,\n",
-       "     'title': 'Spectrum in a point',\n",
-       "     'file_name': 'spectrum_x10km_y40km.dfsu',\n",
-       "     'type': 4,\n",
-       "     'format': 0,\n",
-       "     'flood_and_dry': 2,\n",
-       "     'coordinate_type': 'UTM-32',\n",
-       "     'zone': 0,\n",
-       "     'input_file_name': '||',\n",
-       "     'input_format': 1,\n",
-       "     'interpolation_type': 2,\n",
-       "     'use_end_time': 1,\n",
-       "     'first_time_step': 0,\n",
-       "     'last_time_step': 450,\n",
-       "     'time_step_frequency': 10,\n",
-       "     'number_of_points': 1,\n",
-       "     'POINT_1': {'name': 'POINT_1', 'x': 10000, 'y': 40000},\n",
-       "     'LINE': {'npoints': 3,\n",
-       "      'x_first': 0.0,\n",
-       "      'y_first': 0.0,\n",
-       "      'x_last': 40000.0,\n",
-       "      'y_last': 40000.0},\n",
-       "     'AREA': {'number_of_points': 4,\n",
-       "      'POINT_1': {'x': -400.0, 'y': -400.0},\n",
-       "      'POINT_2': {'x': -400.0, 'y': 40400.0},\n",
-       "      'POINT_3': {'x': 40400.0, 'y': 40400.0},\n",
-       "      'POINT_4': {'x': 40400.0, 'y': -400.0},\n",
-       "      'orientation': 0.0,\n",
-       "      'x_origo': 0.0,\n",
-       "      'x_ds': 2105.263157894737,\n",
-       "      'x_npoints': 20,\n",
-       "      'y_origo': 0.0,\n",
-       "      'y_ds': 2105.263157894737,\n",
-       "      'y_npoints': 20,\n",
-       "      'z_origo': -15.00000000000001,\n",
-       "      'z_ds': 2.000000000000001,\n",
-       "      'z_npoints': 10},\n",
-       "     'INTEGRAL_WAVE_PARAMETERS': {'Touched': 1,\n",
-       "      'type_of_spectrum': 1,\n",
-       "      'minimum_frequency': 0.054321,\n",
-       "      'maximum_frequency': 0.0987654321,\n",
-       "      'separation_of_wind_sea_and_swell': 3,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'hm0_minimum': 0.01,\n",
-       "      'type_of_h_max': 3,\n",
-       "      'duration': 10800.0,\n",
-       "      'distance_above_bed_for_particle_velocity': 0.0,\n",
-       "      'minimum_direction': 0.0,\n",
-       "      'maximum_direction': 360.0,\n",
-       "      'Total_wave_parameters': {'Significant_wave_height': 1,\n",
-       "       'Maximum_wave_height': 1,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 1,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 1,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 1,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Wind_sea_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0},\n",
-       "      'Swell_parameters': {'Significant_wave_height': 0,\n",
-       "       'Maximum_wave_height': 0,\n",
-       "       'Peak_wave_period': 0,\n",
-       "       'Wave_period_t01': 0,\n",
-       "       'Wave_period_t02': 0,\n",
-       "       'Wave_period_tm10': 0,\n",
-       "       'Peak_wave_direction': 0,\n",
-       "       'Mean_wave_direction': 0,\n",
-       "       'Directional_standard_deviation': 0,\n",
-       "       'Wave_velocity_components': 0,\n",
-       "       'Radiation_stresses': 0,\n",
-       "       'Particle_velocities': 0,\n",
-       "       'Wave_power': 0}},\n",
-       "     'INPUT_PARAMETERS': {'Touched': 1,\n",
-       "      'Surface_elevation': 0,\n",
-       "      'Water_depth': 0,\n",
-       "      'Current_velocity_components': 0,\n",
-       "      'Wind_speed': 0,\n",
-       "      'Wind_direction': 0,\n",
-       "      'Ice_concentration': 0},\n",
-       "     'MODEL_PARAMETERS': {'Touched': 1,\n",
-       "      'Wind_friction_speed': 0,\n",
-       "      'Roughness_length': 0,\n",
-       "      'Drag_coefficient': 0,\n",
-       "      'Charnock_constant': 0,\n",
-       "      'Friction_coefficient': 0,\n",
-       "      'Breaking_parameter_gamma': 0,\n",
-       "      'Courant_number': 0,\n",
-       "      'Time_step_factor': 0,\n",
-       "      'Convergence_angle': 0,\n",
-       "      'Length': 0,\n",
-       "      'Area': 0,\n",
-       "      'Threshold_period': 0,\n",
-       "      'Roller_area': 0,\n",
-       "      'Roller_dissipation': 0,\n",
-       "      'Breaking_index': 0},\n",
-       "     'SPECTRAL_PARAMETERS': {'Touched': 1,\n",
-       "      'separation_of_wind_sea_and_swell': 3.0,\n",
-       "      'threshold_frequency': 0.125,\n",
-       "      'maximum_threshold_frequency': 0.125,\n",
-       "      'wave_energy': 1,\n",
-       "      'wave_action': 0,\n",
-       "      'zeroth_moment_of_wave_action': 0,\n",
-       "      'first_moment_of_wave_action': 0,\n",
-       "      'wave_energy_wind_sea': 0,\n",
-       "      'wave_energy_swell': 0}}}}}}"
-      ]
-     },
-     "execution_count": 20,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "pfs.to_dict()"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 21,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1562,27 +478,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 22,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "{'CLSID': 't1_t0.dll',\n",
-       " 'TypeName': 't1_t0',\n",
-       " 'Setup': {'Name': 'Extract that',\n",
-       "  'InputFileName': '|random.dfs1|',\n",
-       "  'FirstTimeStep': 0,\n",
-       "  'LastTimeStep': 99,\n",
-       "  'X': 2,\n",
-       "  'OutputFileName': '|.\\\\out2.dfs0|'}}"
-      ]
-     },
-     "execution_count": 22,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "setup = {\n",
     "    \"Name\": \"Extract that\",\n",
@@ -1598,29 +496,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 23,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "CLSID = 't1_t0.dll'\n",
-       "TypeName = 't1_t0'\n",
-       "[Setup]\n",
-       "   Name = 'Extract that'\n",
-       "   InputFileName = |random.dfs1|\n",
-       "   FirstTimeStep = 0\n",
-       "   LastTimeStep = 99\n",
-       "   X = 2\n",
-       "   OutputFileName = |.\\out2.dfs0|\n",
-       "EndSect  // Setup"
-      ]
-     },
-     "execution_count": 23,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "section = mikeio.PfsSection(t1_t0)\n",
     "section"
@@ -1628,21 +506,9 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 24,
+   "execution_count": null,
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "<mikeio.Pfs>\n",
-       "t1_t0: CLSID = 't1_t0.dll'TypeName = 't1_t0'[Setup] ..."
-      ]
-     },
-     "execution_count": 24,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "pfs = section.to_Pfs(name=\"t1_t0\")\n",
     "pfs"
@@ -1650,7 +516,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 25,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1666,7 +532,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 26,
+   "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -1679,7 +545,7 @@
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": "Python 3.10.5 ('base')",
+   "display_name": "Python 3.10.6 ('base')",
    "language": "python",
    "name": "python3"
   },
@@ -1693,11 +559,11 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.10.8"
+   "version": "3.10.6"
   },
   "vscode": {
    "interpreter": {
-    "hash": "7aec4f91c09090e98e6ae8203c38529831bb4a3ce54cd1b69639b53cb01a6aa9"
+    "hash": "29241bd0f6dcdc7baf6ca7a8c63eed3702f363cfda55e5fb2434992ede57da6b"
    }
   }
  },


Test patch:
diff --git a/tests/test_pfs.py b/tests/test_pfs.py
index ff911a23..e82c0ba6 100644
--- a/tests/test_pfs.py
+++ b/tests/test_pfs.py
@@ -1027,3 +1027,114 @@ def test_read_write_grid_editor_color_palette(tmpdir):
 
     n_rgb_out = len([line for line in outlines if "RGB_Color_Value" in line])
     assert n_rgb_out == 16
+
+
+
+@pytest.fixture
+def pfs_ABC_text() -> str:
+    text = """
+   [ROOT]
+      [A1]
+         int_1 = 0
+         [B]
+            float_1 = 4.5
+        EndSect  // B
+      EndSect  // A1
+      str_1 = '0'
+      [A2]
+         int_2 = 0
+      EndSect  // A2
+      int_3 = 3
+   EndSect  // ROOT 
+"""
+    return text
+
+    
+
+def test_search_keyword(pfs_ABC_text):
+    pfs = mikeio.Pfs(StringIO(pfs_ABC_text))
+    assert "A2" in pfs.ROOT
+
+    r0 = pfs.search(key="not_there")
+    assert r0 is None
+    
+    r1 = pfs.search(key="float")
+    assert r1.ROOT.A1.B.float_1 == 4.5
+    assert "A2" not in r1.ROOT
+
+    r2 = pfs.ROOT.search(key="float")
+    assert r2.A1.B.float_1 == 4.5
+    assert "A2" not in r2
+
+    r3 = pfs.ROOT.search("float")
+    assert r2 == r3
+
+def test_search_keyword_found_in_multiple_places():
+    pfs = mikeio.Pfs("tests/testdata/pfs/lake.sw")
+    subset = pfs.search("charnock")
+    # the string "Charnock" occurs 6 times in this file
+    len(subset.FemEngineSW.SPECTRAL_WAVE_MODULE.WIND.keys()) ==2 
+    len(subset.FemEngineSW.SPECTRAL_WAVE_MODULE.OUTPUTS) == 4
+    
+
+    
+
+def test_search_param(pfs_ABC_text):
+    pfs = mikeio.Pfs(StringIO(pfs_ABC_text))
+    
+    r0 = pfs.search(param="not_there")
+    assert r0 is None
+    
+    r1 = pfs.search(param=0) 
+    assert len(r1.ROOT) == 2
+    assert r1.ROOT.A1.int_1 == 0
+    assert r1.ROOT.A2.int_2 == 0
+    
+    r2 = pfs.ROOT.search(param=0)
+    assert r2 == r1.ROOT
+
+    r3 = pfs.ROOT.search(param='0')
+    assert len(r3) == 1
+    assert r3.str_1 == '0'
+
+def test_search_section(pfs_ABC_text):
+    pfs = mikeio.Pfs(StringIO(pfs_ABC_text))
+    
+    r0 = pfs.search(section="not_there")
+    assert r0 is None
+    
+    r1 = pfs.search(section='A') 
+    assert len(r1.ROOT) == 2
+    assert r1.ROOT.A1 == pfs.ROOT.A1
+    assert r1.ROOT.A2 == pfs.ROOT.A2
+    
+    r2 = pfs.ROOT.search(section='A')
+    assert r2 == r1.ROOT
+   
+def test_search_keyword_or_param(pfs_ABC_text):
+    pfs = mikeio.Pfs(StringIO(pfs_ABC_text))
+    # assert pfs.ROOT.A1.B.float_1 == 4.5
+
+    r1 = pfs.search(key="float", param=3)
+    assert r1.ROOT.A1.B.float_1 == 4.5
+    assert r1.ROOT.int_3 == 3
+
+    r2 = pfs.search(key="float")
+    r3 = pfs.search(param=3)
+    assert r1 != r2
+    assert r1 != r3
+
+    # r4 = mikeio.pfs._merge_PfsSections([r2, r3])
+    # assert r1 == r4
+
+
+def test_search_and_modify(pfs_ABC_text):
+    # does the original remain un-changed? 
+    pfs = mikeio.Pfs(StringIO(pfs_ABC_text))
+    assert pfs.ROOT.A1.B.float_1 == 4.5
+
+    r1 = pfs.search(key="float")
+    assert r1.ROOT.A1.B.float_1 == 4.5
+    r1.ROOT.A1.B.float_1 = 99.9
+    assert r1.ROOT.A1.B.float_1 == 99.9
+    assert pfs.ROOT.A1.B.float_1 == 4.5