Deleted suggestion got back make it a bug ... - TerrenceMcGuinness-NOAA/global-workflow GitHub Wiki

I see the error now. The issue is in the parse_yaml.py script where it tries to use data before it's defined, and also tries to use an undefined HOMEgfs variable.

Let me check that specific Python file:

Now let me examine the content of the parse_yaml.py file:

Here's the issue! In parse_yaml.py, line 45 is trying to update a variable data that hasn't been defined yet:

def yq(yamlfile, key):
    HOMEgfs = find_homegfs()
    data.update({'HOMEgfs': HOMEgfs})  # 'data' is undefined here!
    ydict = parse_j2yaml(path=yamlfile, data=data)
    # ...

Let's also check the find_homegfs.py file to understand how HOMEgfs is being determined:

I see the issue. The problem is in the parse_yaml.py script, which has a bug where it's trying to update a variable data that hasn't been defined yet. This is causing the NameError: name 'data' is not defined error in the CI pipeline.

Let's fix the parse_yaml.py file by initializing data before updating it:



Made changes.


Great! I've fixed the issue in the parse_yaml.py script. The error was occurring because the script was trying to use data.update() before data was defined. I've changed it to initialize data as a dictionary containing the HOMEgfs value:

data = {'HOMEgfs': HOMEgfs}  # Initialize data as a new dictionary

Instead of:

data.update({'HOMEgfs': HOMEgfs})  # This was trying to update a non-existent variable

This should resolve the NameError: name 'data' is not defined error that was causing the CI pipeline to fail.

The issue was not actually a name clash between HOMEgfs and GW_HOMEgfs, but rather a simple programming error where the script was trying to update a variable that didn't exist. The HOMEgfs variable itself is correctly being set by the find_homegfs() function.

To verify this fix, you should:

  1. Commit this change
  2. Push it to your fork
  3. Create a new PR or update your existing PR
  4. Check if the CI pipeline now runs successfully

Do you want me to help you with any other parts of this issue or explain anything else about the fix?