Skip to content

Commit 0f26945

Browse files
authored
oc print_format, whitespace consistency (#188)
1 parent d127a0d commit 0f26945

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

flopy4/mf6/codec/writer/templates/macros.jinja

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
{% macro keystring(name, value) %}
2424
{% for option in (value|data2keystring) -%}
25-
{{ record("", option) }}
26-
{% endfor %}
25+
{{ record("", option) }}{% if not loop.last %}{{ "\n" }}{% endif %}
26+
{%- endfor %}
2727
{% endmacro %}
2828

2929
{% macro record(name, value) %}
@@ -37,26 +37,26 @@
3737
{% endmacro %}
3838

3939
{% macro array(name, value, how="internal") %}
40-
{{ name.upper() }}{% if "layered" in how %} LAYERED{% endif %}
40+
{{ inset ~ name.upper() }}{% if "layered" in how %} LAYERED{% endif %}
4141

4242
{% if how == "constant" %}
43-
CONSTANT {{ value.item() }}
43+
CONSTANT {{ value.item() }}
4444
{% elif how == "layered constant" %}
4545
{% for layer in value -%}
46-
CONSTANT {{ layer.item() }}
46+
CONSTANT {{ layer.item() }}
4747
{%- endfor %}
4848
{% elif how == "internal" %}
49-
INTERNAL
49+
INTERNAL
5050
{% for chunk in value|array_chunks -%}
51-
{{ chunk|array2string }}
51+
{{ (2 * inset) ~ chunk|array2string }}
5252
{%- endfor %}
5353
{% elif how == "external" %}
54-
OPEN/CLOSE {{ value }}
54+
OPEN/CLOSE {{ value }}
5555
{% endif %}
5656
{% endmacro %}
5757

5858
{% macro list(name, value) %}
5959
{% for row in (value|data2list) %}
60-
{{ inset ~ row|join(" ") }}
61-
{% endfor %}
60+
{{ inset ~ row|join(" ") }}{% if not loop.last %}{{ "\n" }}{% endif %}
61+
{%- endfor %}
6262
{% endmacro %}

flopy4/mf6/gwf/oc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
class Oc(Package):
1717
@define(slots=False)
1818
class Format:
19+
fmt_kw: str = field(default="print_format")
1920
columns: int = field(default=10)
2021
width: int = field(default=11)
2122
digits: int = field(default=4)
@@ -49,7 +50,8 @@ class Period:
4950
converter=to_path,
5051
default=None,
5152
)
52-
format: Optional[Format] = field(block="options", default=None, init=False)
53+
# TODO: needs coverter and then rename?
54+
head: Optional[Format] = field(block="options", default=None)
5355
save_head: Optional[NDArray[np.object_]] = array(
5456
object,
5557
block="period",

flopy4/mf6/ims.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class Ims(Solution):
1313
solution_package: ClassVar[Sln] = Sln(abbr="ims", pattern="*")
1414
slntype: ClassVar[str] = "ims"
1515

16-
mxiter: Optional[int] = field(default=1)
1716
print_option: Optional[str] = field(block="options", default=None)
1817
complexity: str = field(block="options", default="simple")
1918
csv_outer_output_file: Optional[Path] = field(default=None, block="options")

test/test_component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def test_gwf_chd01(function_tmpdir):
321321
parent=gwf,
322322
budget_file=f"{gwf_name}.cbc",
323323
head_file=f"{gwf_name}.hds",
324-
# COLUMNS 10 WIDTH 15 DIGITS 6 GENERAL
324+
head="PRINT_FORMAT COLUMNS 10 WIDTH 15 DIGITS 6 GENERAL",
325325
save_head=["last"],
326326
# save_head={0: "last"},
327327
save_budget=["last"],

0 commit comments

Comments
 (0)