NarrClient: include cdo output snippet in parse-failure errors
Prod hit "no parseable values in cdo output" for a 2007 record. Without the actual cdo output it's guesswork whether it's a different parameter-table format, an empty result, or something else. Capture stderr (stderr_to_stdout: true) and include first 500 chars of output so the error message has enough signal to diagnose.
This commit is contained in:
parent
a2cdee7a31
commit
f005ddcaac
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue