Skip to content

Commit

Permalink
FIX: Ensure storage options passed properly (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrover1 authored Jun 9, 2023
1 parent 54ef20b commit f043add
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion intake_esm/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def _get_xarray_open_kwargs(data_format, xarray_open_kwargs=None, storage_option
and 'storage_options' not in xarray_open_kwargs['backend_kwargs']
):
xarray_open_kwargs['backend_kwargs']['storage_options'] = {} or storage_options

return xarray_open_kwargs


Expand All @@ -47,8 +48,12 @@ def _open_dataset(
additional_attrs=None,
expand_dims=None,
data_format=None,
storage_options=None,
):
storage_options = xarray_open_kwargs.get('backend_kwargs', {}).get('storage_options', {})
storage_options = storage_options or xarray_open_kwargs.get('backend_kwargs', {}).get(
'storage_options', {}
)

# Support kerchunk datasets, setting the file object (fo) and urlpath
if data_format == 'reference':
xarray_open_kwargs['backend_kwargs']['storage_options']['fo'] = urlpath
Expand Down Expand Up @@ -231,6 +236,7 @@ def _open_dataset(self):
requested_variables=self.requested_variables,
data_format=record['_data_format_'],
additional_attrs=record[~record.isnull()].to_dict(),
storage_options=self.storage_options,
)
for _, record in self.df.iterrows()
]
Expand Down

0 comments on commit f043add

Please sign in to comment.