diff --git a/lib/microwaveprop/weather/narr_client.ex b/lib/microwaveprop/weather/narr_client.ex index b787794b..a170c8e9 100644 --- a/lib/microwaveprop/weather/narr_client.ex +++ b/lib/microwaveprop/weather/narr_client.ex @@ -294,7 +294,7 @@ defmodule Microwaveprop.Weather.NarrClient do grb_path ] - case System.cmd("cdo", args, stderr_to_stdout: false) do + case System.cmd("cdo", args, stderr_to_stdout: true) do {stdout, 0} -> parse_cdo_outputtab(stdout) @@ -312,7 +312,11 @@ defmodule Microwaveprop.Weather.NarrClient do |> Enum.reduce(%{}, &accumulate_cdo_row/2) if raw == %{} do - {:error, "NARR cdo extract: no parseable values in cdo output"} + # Include the first 500 chars of cdo output so the error surfaces + # what cdo actually printed — crucial for diagnosing year-specific + # parameter-table quirks in NARR GRIB1. + snippet = stdout |> String.slice(0, 500) |> String.replace("\n", " | ") + {:error, "NARR cdo extract: no parseable values in cdo output (got: #{snippet})"} else {:ok, build_profile_attrs(raw)} end