import pandas as pd
import mikeio
= pd.DataFrame(dict(station=["Foo", "Bar"],include=[0,1]), index=[1,2])
df df
station | include | |
---|---|---|
1 | Foo | 0 |
2 | Bar | 1 |
Name | Description |
---|---|
clear | Remove all items from the PfsSection. |
copy | Return a copy of the PfsSection. |
find_replace | Update recursively all old_value with new_value. |
from_dataframe | Create a PfsSection from a DataFrame. |
get | Return the value for key if key is in the PfsSection, |
items | Return a new view of the PfsSection’s items ((key, value) pairs). |
keys | Return a new view of the PfsSection’s keys. |
pop | If key is in the dictionary, remove it and return its |
search | Find recursively all keys, sections or parameters |
to_dataframe | Output enumerated subsections to a DataFrame. |
to_dict | Convert to (nested) dict (as a copy). |
update_recursive | Update recursively all matches of key with value. |
values | Return a new view of the PfsSection’s values. |
Remove all items from the PfsSection.
Return a copy of the PfsSection.
Update recursively all old_value with new_value.
Create a PfsSection from a DataFrame.
Name | Type | Description | Default |
---|---|---|---|
df | pd.DataFrame | data | required |
prefix | str | section header prefix | required |
Return the value for key if key is in the PfsSection, else default. If default is not given, it defaults to None, so that this method never raises a KeyError.
Return a new view of the PfsSection’s items ((key, value) pairs).
Return a new view of the PfsSection’s keys.
If key is in the dictionary, remove it and return its value, else return default. If default is not given and key is not in the dictionary, a KeyError is raised.
Find recursively all keys, sections or parameters matching a pattern.
NOTE: logical OR between multiple conditions
Name | Type | Description | Default |
---|---|---|---|
text | str | Search for text in either key, section or parameter, by default None | None |
key | str | text pattern to seach for in keywords, by default None | None |
section | str | text pattern to seach for in sections, by default None | None |
param | (str, bool, float, int) | text or value in a parameter, by default None | None |
case | bool | should the text search be case-sensitive?, by default False | False |
Name | Type | Description |
---|---|---|
PfsSection | Search result as a nested PfsSection |
Output enumerated subsections to a DataFrame.
Name | Type | Description | Default |
---|---|---|---|
prefix | str | The prefix of the enumerated sections, e.g. “OUTPUT_”, which can be supplied if it fails without this argument, by default None (will try to “guess” the prefix) | None |
Name | Type | Description |
---|---|---|
pd.DataFrame | The enumerated subsections as a DataFrame |
Touched | include | title | file_name | type | format | flood_and_dry | coordinate_type | zone | input_file_name | ... | last_time_step | time_step_frequency | number_of_points | POINT_1 | LINE | AREA | INTEGRAL_WAVE_PARAMETERS | INPUT_PARAMETERS | MODEL_PARAMETERS | SPECTRAL_PARAMETERS | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | Wave parameters in domain | Wave_parameters.dfsu | 1 | 2 | 2 | UTM-32 | 0 | || | ... | 450 | 10 | 1 | {'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0} | {'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,... | {'number_of_points': 4, 'POINT_1': {'x': -400.... | {'Touched': 1, 'type_of_spectrum': 1, 'minimum... | {'Touched': 1, 'Surface_elevation': 0, 'Water_... | {'Touched': 1, 'Wind_friction_speed': 0, 'Roug... | {'Touched': 1, 'separation_of_wind_sea_and_swe... |
2 | 1 | 0 | Wave parameters along line | Wave_line.dfs1 | 1 | 1 | 2 | UTM-32 | 0 | || | ... | 450 | 10 | 1 | {'name': 'POINT_1', 'x': 20000.0, 'y': 20000.0} | {'npoints': 41, 'x_first': 0.0, 'y_first': 200... | {'number_of_points': 4, 'POINT_1': {'x': -400.... | {'Touched': 1, 'type_of_spectrum': 1, 'minimum... | {'Touched': 1, 'Surface_elevation': 0, 'Water_... | {'Touched': 1, 'Wind_friction_speed': 0, 'Roug... | {'Touched': 1, 'separation_of_wind_sea_and_swe... |
3 | 1 | 1 | Wave parameters in a point | Waves_x20km_y20km.dfs0 | 1 | 0 | 2 | UTM-32 | 0 | || | ... | 450 | 1 | 1 | {'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0} | {'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,... | {'number_of_points': 4, 'POINT_1': {'x': -400.... | {'Touched': 1, 'type_of_spectrum': 1, 'minimum... | {'Touched': 1, 'Surface_elevation': 0, 'Water_... | {'Touched': 1, 'Wind_friction_speed': 0, 'Roug... | {'Touched': 1, 'separation_of_wind_sea_and_swe... |
4 | 1 | 1 | Spectrum in a point | spectrum_x20km_y20km.dfsu | 4 | 0 | 2 | UTM-32 | 0 | || | ... | 450 | 10 | 1 | {'name': 'POINT_1', 'x': 38000.0, 'y': 20000.0} | {'npoints': 3, 'x_first': 0.0, 'y_first': 0.0,... | {'number_of_points': 4, 'POINT_1': {'x': -400.... | {'Touched': 1, 'type_of_spectrum': 1, 'minimum... | {'Touched': 1, 'Surface_elevation': 0, 'Water_... | {'Touched': 1, 'Wind_friction_speed': 0, 'Roug... | {'Touched': 1, 'separation_of_wind_sea_and_swe... |
4 rows × 24 columns
Convert to (nested) dict (as a copy).
Update recursively all matches of key with value.
Return a new view of the PfsSection’s values.