Skip to content

Fix ascii file list parsing logic. #1484

@JohnHalleyGotway

Description

@JohnHalleyGotway

Describe the Problem

Tina Kalb ran into unexpected behavior when running pcp_combine in the following way:

pcp_combine -add bad.grib bad.nc -field 'name="Z"; level="P500";'

DEBUG 2: Since the "-field" command line option was used, parsing the command line arguments as a list of files.
DEBUG 2: Performing derivation command (sum) for 17032 files.
DEBUG 1: Reading data (name="Z"; level="P500";) from input file: GRIB
ERROR  : 
ERROR  : grd_file_type() -> file does not exist "GRIB"
ERROR  : 

bad.grib.txt

The input "bad.grib" file is processed by the parse_ascii_file_list() function and one of the first 10 words is "/" which is counted as a valid path. So it's entire contents is treated as a file list and pcp_combine attempts to process the first word ("GRIB") as the path to a file.

Expected Behavior

We should have better logic to distinguish between file lists and data files. An input GRIB file should not be processed as being a file list.

Environment

Describe your runtime environment:

  1. Repeatable on multiple environments. Originally found on eyewall but replicated on Mac.

To Reproduce

Describe the steps to reproduce the behavior:

  1. Save the attached "bad.grib.txt" file as "bad.grib".
  2. Use met-9.1/bin/pcp_combine to run:
pcp_combine -add bad.grib bad.nc -field 'name="Z"; level="P500";'
  1. Observe runtime error:
ERROR  : grd_file_type() -> file does not exist "GRIB"

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

  • Select engineer(s) or no engineer required: John Halley Gotway
  • Select scientist(s) or no scientist required: None required but Tina Kalb can review the PR.

Labels

  • Select component(s)
  • Select priority
  • Select requestor(s)

Projects and Milestone

  • Review projects and select relevant Repository and Organization ones
  • Select milestone

Define Related Issue(s)

Consider the impact to the other METplus components.

Bugfix Checklist

See the METplus Workflow for details.

  • Complete the issue definition above.
  • Fork this repository or create a branch of master_<Version>.
    Branch name: bugfix_<Issue Number>_master_<Version>_<Description>
  • Fix the bug and test your changes.
  • Add/update unit tests.
  • Add/update documentation.
  • Push local changes to GitHub.
  • Submit a pull request to merge into master_<Version> and link the pull request to this issue.
    Pull request: bugfix <Issue Number> master_<Version> <Description>
  • Iterate until the reviewer(s) accept and merge your changes.
  • Delete your fork or branch.
  • Complete the steps above to fix the bug on the develop branch and link the pull request to this issue.
    Branch name: bugfix_<Issue Number>_develop_<Description>
    Pull request: bugfix <Issue Number> develop <Description>
  • Close this issue.

Metadata

Metadata

Labels

requestor: NCARNational Center for Atmospheric Researchtype: bugFix something that is not working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions