Skip to content

Commit 70afe12

Browse files
committed
CDAT Migration Phase 3: Fix LHFLX name and add catch for non-existent or empty TE stitch file (#876)
1 parent ef84f32 commit 70afe12

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

e3sm_diags/derivations/formulas.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ def qflx_convert_to_lhflx_approxi(var: xr.DataArray):
175175
new_var = var * 2.5e6
176176

177177
new_var.name = "LHFLX"
178+
new_var.attrs["units"] = "W/m2"
179+
new_var.attrs["long_name"] = "Surface latent heat flux"
180+
178181
return new_var
179182

180183

e3sm_diags/driver/tc_analysis_driver.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ def generate_tc_metrics_from_te_stitch_file(te_stitch_file: str) -> Dict[str, An
195195
end_ind = line_ind[-1]
196196
lines = lines_orig[0:end_ind]
197197

198+
if not lines:
199+
raise ValueError(f"The file {te_stitch_file} is empty.")
200+
198201
# Calculate number of storms and max length
199202
num_storms, max_len = _calc_num_storms_and_max_len(lines)
200203
# Parse variables from TE stitch file

0 commit comments

Comments
 (0)