Skip to content

Commit

Permalink
Design
Browse files Browse the repository at this point in the history
  • Loading branch information
ecomodeller committed Feb 22, 2024
1 parent daa3396 commit 89e3222
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
2 changes: 2 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ website:
- examples/Dfsu-2D-interpolation.qmd
- examples/Time-interpolation.qmd
- examples/Generic.qmd
- text: Design philosophy
href: design.md
- text: API Reference
href: api/index.qmd

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/user-guide/dataarray.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# {{< fa database >}} DataArray
# DataArray

The [DataArray](`mikeio.DataArray`) is the common MIKE IO data structure
for *item* data from dfs files.
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/dataset.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# {{< fa database >}} Dataset
# Dataset

The [Dataset](`mikeio.Dataset`) is the MIKE IO data structure
for data from dfs files.
Expand Down
18 changes: 9 additions & 9 deletions docs/user-guide/generic.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Generic

The generic module contains functionality that works for all dfs files:

* [`concat()`](generic.concat) - Concatenates files along the time axis
* [`extract()`](generic.extract) - Extract timesteps and/or items to a new dfs file
* [`diff()`](generic.diff) - Calculate difference between two dfs files with identical geometry
* [`sum()`](generic.sum) - Calculate the sum of two dfs files
* [`scale()`](generic.scale) - Apply scaling to any dfs file
* [`avg_time()`](generic.avg_time) - Create a temporally averaged dfs file
* [`quantile()`](generic.quantile) - Create a dfs file with temporal quantiles
The generic module contains functionality that works for all types of dfs (dfs0, dfs1, dfs2, dfs3, dfsu) files:

* [`concat()`](`mikeio.generic.concat`) - Concatenates files along the time axis
* [`extract()`](`mikeio.generic.extract`) - Extract timesteps and/or items to a new dfs file
* [`diff()`](`mikeio.generic.diff`) - Calculate difference between two dfs files with identical geometry
* [`sum()`](`mikeio.generic.sum`) - Calculate the sum of two dfs files
* [`scale()`](`mikeio.generic.scale`) - Apply scaling to any dfs file
* [`avg_time()`](`mikeio.generic.avg_time`) - Create a temporally averaged dfs file
* [`quantile()`](`mikeio.generic.quantile`) - Create a dfs file with temporal quantiles



Expand Down
10 changes: 5 additions & 5 deletions docs/user-guide/pfs.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ EndSect // TARGET2

When a PFS file is read with MIKE IO, a `PfsDocument` object is created. It will contain one or more `PfsSection` objects - one for each target. The PfsSections will typically contain other PfsSections together with a number of key-value pairs.

A PFS file is read using `mikeio.read_pfs()`:
A PFS file is read using [](`mikeio.read_pfs`):

```{python}
import mikeio
Expand All @@ -41,20 +41,20 @@ pfs

### PfsDocument

The `PfsDocument` is the MIKE IO equivalent to a PFS file. Its targets can be accessed by their name (as properties), like this:
The [](`-mikeio.PfsDocument`) is the MIKE IO equivalent to a PFS file. Its targets can be accessed by their name (as properties), like this:

```{python}
pfs.txconc
```

Or by the `pfs.targets` object (which is a list of PfsSections). Each of the targets is a `PfsSection` object consisting of key-value pairs (keyword-parameter) and other PfsSections.

The `PfsDocument` object is similar to a dictionary. You can loop over its contents with `items()`, `keys()` and `values()` like a dictionary.
The [](`-mikeio.PfsDocument`) object is similar to a dictionary. You can loop over its contents with `items()`, `keys()` and `values()` like a dictionary.


### PfsSection

The `PfsSection` object is also similar to a dictionary. You can loop over its contents with `items()`, `keys()` and `values()` like a dictionary.
The [](`-mikeio.PfsSection`) object is also similar to a dictionary. You can loop over its contents with `items()`, `keys()` and `values()` like a dictionary.

```{python}
pfs.txconc.keys()
Expand Down Expand Up @@ -88,7 +88,7 @@ pfs.txconc.Setup.to_dataframe(prefix="File_")

### Unique or non-unique keywords

Depending on the engine intended for reading the PFS file it may or may not make sense to have multiple identical keywords in the same PfsSection. MIKE 21/3 and the marine tools does *not* support non-unique keywords---if non-unique keywords are present, only the first will be read and the presence is most likely a mistake made by hand-editing the file. In other tools, e.g. MIKE Plot Composer, non-unique keywords are used a lot. How MIKE IO shall deal with non-unique keywords can be specified using the `unique_keywords` argument in the `read_pfs()` method:
Depending on the engine intended for reading the PFS file it may or may not make sense to have multiple identical keywords in the same PfsSection. MIKE 21/3 and the marine tools does *not* support non-unique keywords---if non-unique keywords are present, only the first will be read and the presence is most likely a mistake made by hand-editing the file. In other tools, e.g. MIKE Plot Composer, non-unique keywords are used a lot. How MIKE IO shall deal with non-unique keywords can be specified using the `unique_keywords` argument in the [](`-mikeio.read_pfs`) function:

```python
pfs = mikeio.read_pfs("myplot.plt", unique_keywords=False)
Expand Down
6 changes: 3 additions & 3 deletions mikeio/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ def concat(
Parameters
----------
infilenames: List[str]
infilenames:
filenames to concatenate
outfilename: str | pathlib.Path
outfilename:
filename of output
keep: str | pathlib.Path
keep:
either 'first' (keep older), 'last' (keep newer)
or 'average' can be selected. By default 'last'
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ notebooks= [
"jupyter",
"xarray",
"netcdf4",
"rasterio",
"geopandas",
"scikit-learn",
"matplotlib",
Expand Down

0 comments on commit 89e3222

Please sign in to comment.