Skip to content

[BUG] GMAO failing to load data: KeyError f.variables['x'] #755

Description

@nate-kean

Describe the bug
The GMAO class is failing in .load() on the data it fetches.

tools/RAiDER/processWM.py:87: in prepareWeatherModel
    f = weather_model.load()
        ^^^^^^^^^^^^^^^^^^^^
tools/RAiDER/models/weatherModel.py:247: in load
    self.load_weather(path_wm_raw, *args, **kwargs)
tools/RAiDER/models/gmao.py:163: in load_weather
    self._load_model_level(f)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <RAiDER.models.gmao.GMAO object at 0x72749ba07620>
filename = 'test/scenario_1/weather_files/GMAO_2018_07_01_T00_00_00.nc'

    def _load_model_level(self, filename) -> None:
        """Get the variables from the GMAO link using OpenDAP."""
        # adding the import here should become absolute when transition to netcdf
        from netCDF4 import Dataset
    
        with Dataset(filename, mode='r') as f:
>           lons = np.array(f.variables['x'][:])
                            ^^^^^^^^^^^^^^^^
E           KeyError: 'x'

tools/RAiDER/models/gmao.py:171: KeyError

To Reproduce

import datetime as dt
from RAiDER.models import GMAO
from RAiDER.processWM import prepareWeatherModel

BBOX = [15.75, 18.25, -103.25, -99.75]
DATETIME = dt.datetime(2018, 7, 1, 0, 0)

wm = GMAO()
wm.set_latlon_bounds(BBOX)
wm.setTime(DATETIME)
prepareWeatherModel(wm, DATETIME, BBOX)

Expected behavior
This is data straight from GMAO._fetch(), so it should be able to read it.

Desktop (please complete the following information):

  • RAiDER git tag: dev 784237b
  • OS: Winch WSL on Windows 10, kernel 6.6.87.2-microsoft-standard-WSL2

Additional context
Add any other context about the problem her

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions