intake / intake-xarray

Intake plugin for xarray
https://intake-xarray.readthedocs.io/
BSD 2-Clause "Simplified" License
74 stars 36 forks source link

Pass engine to xr.open_mfdataset in OpenDapSource #127

Closed lukecampbell closed 2 years ago

lukecampbell commented 2 years ago

When OpenDapSource._open_dataset is called when urlpath is a list of OPeNDAP URLs, no engine is specified in the call toxr.open_mfdataset even if engine is set in the class. This prevents clients from using a specified engine and reverts to xarray's default engine selection.

This commit changes the call to xr.open_mfdataset to include the engine argument as the self.engine value.

martindurant commented 2 years ago

+1 Do you have an easy way to test this?

lukecampbell commented 2 years ago

I can't seem to get the unit tests to run. They get stuck at S3 list files, but yes I have an easy way to test that involves mocks, let me see if I can get it running.

martindurant commented 2 years ago

They get stuck at S3 list files

I suppose you need the moto server running

lukecampbell commented 2 years ago

I added a simple test that simply mocks open_mfdataset and invokes the OpenDapSource calls in unit test and asserts that open_mfdataset was called with the specified engine.

martindurant commented 2 years ago

phew

lukecampbell commented 2 years ago

:+1: thanks!