Skip to content

Commit 6dd988e

Browse files
authored
minor tweaks to sdd io section (#203)
1 parent 68da84e commit 6dd988e

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ venv/
55
.ruff_cache
66
*.egg-info
77
**/__pycache__/
8-
9-
# pixi environments
108
.pixi
119
*.egg-info
10+
temp/

docs/dev/sdd.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,21 @@ Loaders and writers can be registered for any component class and format. The re
143143

144144
The conversion layer uses `cattrs` to transform between the product's `xarray`/`attrs`-based object model and plain Python data structures suitable for serialization. This layer is format-agnostic and handles structural transformations common across formats.
145145

146-
**Unstructuring (write path)**: A `cattrs` converter with appropriate hooks will convert components to nested dictionaries organized by block, handling tasks like
146+
**Unstructuring (write time)**: A `cattrs` converter with appropriate unstructuring hooks converts components to a form suitable for serialization, handling transformations like:
147147

148-
- Organizing fields into blocks according to their `block` metadata from DFN files
149-
- Converting child components to binding records for parent component name files
150-
- Sliceing time-varying (period block) arrays by stress period
151-
- Converting `Path` objects to records (`FILEOUT` etc)
148+
- Grouping fields into blocks according to their `block` metadata from DFNs
149+
- Converting child components to binding tables for parent component name files
150+
- Slicing time-varying arrays by stress period, returned in a period-indexed `dict`
151+
- Converting `Path` objects to tuples (`<name>`, `FILEIN`/`FILEOUT`, `<path>`)
152152

153-
**Structuring (read path)**: The reverse transformation turns dictionaries of primitives into component instances. A `cattrs` converter with appropriate hooks will, among other things,
153+
The unstructuring phase aims to avoid a) unnecessary copies and b) materializing data in memory.
154154

155-
- Instantiate child components from binding records
156-
- Convert sparse list-input representations to arrays
157-
- Reconstruct time-varying array variables from indexed blocks
158-
- Guarantee `xarray` objects have proper dimensions/coordinates
155+
**Structuring (load time)**: A `cattrs` converter with appropriate structuring hooks converts dictionaries of primitives into component instances, including:
156+
157+
- Instantiating child components from bindings
158+
- Converting sparse list input data representations to arrays
159+
- Reconstructing time-varying array variables from indexed blocks
160+
- Guaranteeing `xarray` objects have proper dimensions/coordinates
159161

160162
#### Serialization
161163

0 commit comments

Comments
 (0)