From c3922e4c44206a9490947a02718b4c5acb8a4b3f Mon Sep 17 00:00:00 2001 From: Daniel Cumpton Date: Mon, 11 May 2026 11:10:30 -0600 Subject: [PATCH 1/6] add LASAM soil type based parameters to parameter metadata initial values --- src/icefabric/modules/divide_attributes.py | 23 +++++++++++++++++++ .../modules/get_parameter_metadata.py | 7 ++++++ 2 files changed, 30 insertions(+) diff --git a/src/icefabric/modules/divide_attributes.py b/src/icefabric/modules/divide_attributes.py index fac5e70..1f2a94e 100644 --- a/src/icefabric/modules/divide_attributes.py +++ b/src/icefabric/modules/divide_attributes.py @@ -125,6 +125,11 @@ class DivideAttributesNHF(enum.Enum): NOV = "temp_delta_nov_mean" DEC = "temp_delta_dec_mean" QUARTZ = "quartz_mean" + THETA_R = "theta_r" + THETA_E = "theta_e" + ALPHA = "alpha" + N = "n" + KS = "Ks" class ParametersToDivideAttributesNHF: @@ -157,6 +162,11 @@ class ParametersToDivideAttributesNHF: "max_gw_storage": DivideAttributesNHF.ZMAX.value, "Cgw": DivideAttributesNHF.COEFF.value, "expon": DivideAttributesNHF.EXPON.value, + "theta_r": DivideAttributesNHF.THETA_R.value, + "theta_e": DivideAttributesNHF.THETA_E.value, + "alpha": DivideAttributesNHF.ALPHA.value, + "n": DivideAttributesNHF.N.value, + "Ks": DivideAttributesNHF.KS.value, } @@ -191,3 +201,16 @@ class ParametersToDivideAttributesHF: "Cgw": DivideAttributesHF.COEFF.value, "expon": DivideAttributesHF.EXPON.value, } + + +class LASAMParameters: + """LASAM paramters based on soil type (ISLTYP) from https://github.com/NOAA-OWP/LGAR-C/blob/master/data/README.md""" + + lasam_params = { + "isltyp_mode": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], + "theta_r": [0.045, 0.057, 0.065, 0.067, 0.034, 0.078, 0.1, 0.089, 0.095, 0.1, 0.07, 0.068], + "theta_e": [0.43, 0.41, 0.41, 0.45, 0.46, 0.43, 0.39, 0.43, 0.41, 0.38, 0.36, 0.38], + "alpha": [0.145, 0.124, 0.075, 0.02, 0.016, 0.036, 0.059, 0.01, 0.019, 0.027, 0.005, 0.008], + "n": [2.68, 2.28, 1.89, 1.41, 1.37, 1.56, 1.48, 1.23, 1.31, 1.23, 1.09, 1.09], + "Ks": [29.7, 14.59166667, 4.420833333, 0.45, 0.25, 1.04, 1.31, 0.07, 0.26, 0.12, 0.02, 0.2], + } diff --git a/src/icefabric/modules/get_parameter_metadata.py b/src/icefabric/modules/get_parameter_metadata.py index da999bc..e8638ef 100644 --- a/src/icefabric/modules/get_parameter_metadata.py +++ b/src/icefabric/modules/get_parameter_metadata.py @@ -7,6 +7,7 @@ from icefabric.modules.create_ipes import get_subset from icefabric.modules.divide_attributes import ( + LASAMParameters, ParametersToDivideAttributesHF, ParametersToDivideAttributesNHF, ) @@ -90,6 +91,12 @@ def get_parameter_metadata( else: divide_attrs = pd.DataFrame(gauge["divides"]) + lasam_params = pd.DataFrame(LASAMParameters.lasam_params) + + if "lasam" in modules: + divide_attrs = pd.merge(divide_attrs, lasam_params, on="isltyp_mode", how="outer") + print(divide_attrs) + output_list = [] for module in modules: From 84f977b765285550b7b9bb3a5c54c44f35e23d3b Mon Sep 17 00:00:00 2001 From: Daniel Cumpton Date: Mon, 11 May 2026 11:17:41 -0600 Subject: [PATCH 2/6] remove print statement --- src/icefabric/modules/get_parameter_metadata.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/icefabric/modules/get_parameter_metadata.py b/src/icefabric/modules/get_parameter_metadata.py index e8638ef..b88920c 100644 --- a/src/icefabric/modules/get_parameter_metadata.py +++ b/src/icefabric/modules/get_parameter_metadata.py @@ -95,7 +95,6 @@ def get_parameter_metadata( if "lasam" in modules: divide_attrs = pd.merge(divide_attrs, lasam_params, on="isltyp_mode", how="outer") - print(divide_attrs) output_list = [] From 09d527c3c22ccc6e654b2b8c9117d7b7433aa676 Mon Sep 17 00:00:00 2001 From: Daniel Cumpton Date: Tue, 12 May 2026 17:04:55 -0600 Subject: [PATCH 3/6] change lookup table to match the one used in MSWM --- src/icefabric/modules/divide_attributes.py | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/icefabric/modules/divide_attributes.py b/src/icefabric/modules/divide_attributes.py index 1f2a94e..f863a7e 100644 --- a/src/icefabric/modules/divide_attributes.py +++ b/src/icefabric/modules/divide_attributes.py @@ -208,9 +208,22 @@ class LASAMParameters: lasam_params = { "isltyp_mode": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], - "theta_r": [0.045, 0.057, 0.065, 0.067, 0.034, 0.078, 0.1, 0.089, 0.095, 0.1, 0.07, 0.068], - "theta_e": [0.43, 0.41, 0.41, 0.45, 0.46, 0.43, 0.39, 0.43, 0.41, 0.38, 0.36, 0.38], - "alpha": [0.145, 0.124, 0.075, 0.02, 0.016, 0.036, 0.059, 0.01, 0.019, 0.027, 0.005, 0.008], - "n": [2.68, 2.28, 1.89, 1.41, 1.37, 1.56, 1.48, 1.23, 1.31, 1.23, 1.09, 1.09], - "Ks": [29.7, 14.59166667, 4.420833333, 0.45, 0.25, 1.04, 1.31, 0.07, 0.26, 0.12, 0.02, 0.2], + "theta_r": [0.05, 0.05, 0.04, 0.07, 0.05, 0.06, 0.06, 0.09, 0.08, 0.12, 0.11, 0.1], + "theta_e": [0.38, 0.39, 0.39, 0.44, 0.49, 0.4, 0.38, 0.48, 0.44, 0.39, 0.48, 0.46], + "alpha": [0.04, 0.03, 0.03, 0.01, 0.01, 0.01, 0.02, 0.01, 0.02, 0.03, 0.02, 0.01], + "n": [ + 3.18, + 1.75, + 1.45, + 1.66, + 1.68, + 1.47, + 1.33, + 1.52, + 1.42, + 1.21, + 1.32, + 1.25, + ], + "Ks": [26.64, 4.32, 1.584, 0.756, 1.836, 0.504, 0.54, 0.468, 0.3348, 0.468, 0.432, 0.612], } From a7963cf8079f4ebf03d4661a5092cadcba4dfa25 Mon Sep 17 00:00:00 2001 From: Daniel Cumpton Date: Tue, 12 May 2026 17:12:21 -0600 Subject: [PATCH 4/6] fix formatting --- src/icefabric/modules/divide_attributes.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/icefabric/modules/divide_attributes.py b/src/icefabric/modules/divide_attributes.py index f863a7e..2ce6f1a 100644 --- a/src/icefabric/modules/divide_attributes.py +++ b/src/icefabric/modules/divide_attributes.py @@ -211,19 +211,6 @@ class LASAMParameters: "theta_r": [0.05, 0.05, 0.04, 0.07, 0.05, 0.06, 0.06, 0.09, 0.08, 0.12, 0.11, 0.1], "theta_e": [0.38, 0.39, 0.39, 0.44, 0.49, 0.4, 0.38, 0.48, 0.44, 0.39, 0.48, 0.46], "alpha": [0.04, 0.03, 0.03, 0.01, 0.01, 0.01, 0.02, 0.01, 0.02, 0.03, 0.02, 0.01], - "n": [ - 3.18, - 1.75, - 1.45, - 1.66, - 1.68, - 1.47, - 1.33, - 1.52, - 1.42, - 1.21, - 1.32, - 1.25, - ], + "n": [3.18, 1.75, 1.45, 1.66, 1.68, 1.47, 1.33, 1.52, 1.42, 1.21, 1.32, 1.25], "Ks": [26.64, 4.32, 1.584, 0.756, 1.836, 0.504, 0.54, 0.468, 0.3348, 0.468, 0.432, 0.612], } From 73328d48fe00ee82759b935530fcbf3b165843b8 Mon Sep 17 00:00:00 2001 From: Daniel Cumpton Date: Wed, 13 May 2026 12:54:33 -0600 Subject: [PATCH 5/6] correct LASAM parameter source reference --- src/icefabric/modules/divide_attributes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/icefabric/modules/divide_attributes.py b/src/icefabric/modules/divide_attributes.py index 2ce6f1a..8342a35 100644 --- a/src/icefabric/modules/divide_attributes.py +++ b/src/icefabric/modules/divide_attributes.py @@ -204,7 +204,7 @@ class ParametersToDivideAttributesHF: class LASAMParameters: - """LASAM paramters based on soil type (ISLTYP) from https://github.com/NOAA-OWP/LGAR-C/blob/master/data/README.md""" + """LASAM paramters based on soil type (ISLTYP) from https://github.com/NOAA-OWP/LGAR-C/blob/master/data/vG_default_params.dat""" lasam_params = { "isltyp_mode": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], From 070dae880e6989bc96ed646cfdf715dbc60a4f12 Mon Sep 17 00:00:00 2001 From: Dylan Lee Date: Thu, 14 May 2026 09:31:14 -0400 Subject: [PATCH 6/6] Fix LASAM params and no-gage error Added LASAM soil parameter mappings to ParametersToDivideAttributesHF for HF 2.2 domain support, and fixed 500 error when calling parameter metadata without a gage_id by conditionally merging LASAM params only when gage_id is provided. --- src/icefabric/modules/divide_attributes.py | 5 +++++ src/icefabric/modules/get_parameter_metadata.py | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/icefabric/modules/divide_attributes.py b/src/icefabric/modules/divide_attributes.py index 8342a35..8500506 100644 --- a/src/icefabric/modules/divide_attributes.py +++ b/src/icefabric/modules/divide_attributes.py @@ -200,6 +200,11 @@ class ParametersToDivideAttributesHF: "max_gw_storage": DivideAttributesHF.ZMAX.value, "Cgw": DivideAttributesHF.COEFF.value, "expon": DivideAttributesHF.EXPON.value, + "theta_r": "theta_r", + "theta_e": "theta_e", + "alpha": "alpha", + "n": "n", + "Ks": "Ks", } diff --git a/src/icefabric/modules/get_parameter_metadata.py b/src/icefabric/modules/get_parameter_metadata.py index b88920c..545db91 100644 --- a/src/icefabric/modules/get_parameter_metadata.py +++ b/src/icefabric/modules/get_parameter_metadata.py @@ -91,9 +91,13 @@ def get_parameter_metadata( else: divide_attrs = pd.DataFrame(gauge["divides"]) - lasam_params = pd.DataFrame(LASAMParameters.lasam_params) + if gage_id is not None and "lasam" in modules: + lasam_params = pd.DataFrame(LASAMParameters.lasam_params) + + # For HF 2.2, the ISLTYP column name differs from NHF's "isltyp_mode" + if not domain.is_nhf and "mode.ISLTYP" in divide_attrs.columns: + divide_attrs = divide_attrs.rename(columns={"mode.ISLTYP": "isltyp_mode"}) - if "lasam" in modules: divide_attrs = pd.merge(divide_attrs, lasam_params, on="isltyp_mode", how="outer") output_list = []