@@ -248,6 +248,14 @@ def _unstructure_block_param(
248248 for n , v in dat .items ():
249249 period_data [n ] = v
250250 else :
251+ arr_spec = xatspec .arrays .get (field_name )
252+ field_meta = (arr_spec .metadata or {}) if arr_spec is not None else {}
253+ if "prefix" in field_meta or "row_keyword" in field_meta :
254+ field_value = field_value .copy ()
255+ if "prefix" in field_meta :
256+ field_value .attrs ["prefix" ] = field_meta ["prefix" ]
257+ if "row_keyword" in field_meta :
258+ field_value .attrs ["row_keyword" ] = field_meta ["row_keyword" ]
251259 blocks [block_name ][field_name ] = field_value
252260 case _:
253261 blocks [block_name ][field_name ] = field_value
@@ -306,15 +314,17 @@ def _unstructure_array_component(value: Component) -> dict[str, Any]:
306314
307315# Block names that MF6 rejects if present but empty.
308316# These blocks should only be written when they contain data.
309- _SKIP_IF_EMPTY = frozenset ({"dimensions" , "tracktimes" })
317+ _SKIP_IF_EMPTY = frozenset ({"dimensions" , "fileinput" , " tracktimes" })
310318
311319# Block names whose fields are list columns (one array per column, same dim)
312320# rather than independent grid arrays. Only these blocks are auto-combined
313321# into an xr.Dataset for row-per-record output. griddata-style blocks must
314322# NOT be in this set — their fields are written individually with
315323# INTERNAL/CONSTANT/NETCDF format.
316324# "sources" is the SSM sources block (pname/srctype/auxname per-row tabular input).
317- _LIST_BLOCK_NAMES = frozenset ({"packagedata" , "packages" , "perioddata" , "sources" , "table" })
325+ _LIST_BLOCK_NAMES = frozenset (
326+ {"packagedata" , "packages" , "perioddata" , "sources" , "fileinput" , "table" }
327+ )
318328
319329
320330def _unstructure_component (value : Component ) -> dict [str , Any ]:
0 commit comments