Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed behaviour of
source._open_dataset
to: (#681)
* Changed behaviour of `source._open_dataset` to: - Search for data & coordinate variables from just data variables. - Don't check to remove unnecessary coordinates & variables from dataset as this automatically removes all requested coordinate variables. - If no data variables are found, load the first dataset returned: this avoids concatenation issues resulting from trying to concatenate along nonexistent dimenions. Added a 'test_request_coord_vars' test to test/test_source to ensure the following behaviour: - Only data variables requested & coordinates they depend on are returned if only data variables are requested (no change from previous behaviour). - Entire dataset (all data & coordinate variables) are returned if no variables are requested (no change from previous behaviour). - Only requested coordinate variables are returned if only coordinate variables are requested (updated behaviour). - Data variables requested, coordinates they depend on, and additional requested coordinate variables are returned both data and coordinate variables are requested (updated behaviour). * restored ``` datasets = [ ds.set_coords(set(ds.variables) - set(ds.attrs[OPTIONS['vars_key']])) for ds in datasets ] ``` to _open_dataset - ought to fix failing test. Removal was based on wrong assumption that this check always removes specified coordinate variables, which is only true if they are not passed in the __init__ of the ESMDataSource class. * Changed behaviour to catch 'no valid dimension coordinates' error and return first dataset if so - necessary to indexing static files * Changed behaviour to catch 'no valid dimension coordinates' error and return first dataset if so - necessary to indexing static files Appears to be potential intermittent issue with Read the Docs build - unable to reproduce reliably locally.
- Loading branch information