cfdm.H5netcdfArray.get_storage_options

H5netcdfArray.get_storage_options(create_endpoint_url=True, filename=None, parsed_filename=None)[source]

Return s3fs.S3FileSystem options for accessing S3 files.

New in version (cfdm): 1.12.0.0

Parameters
create_endpoint_url: bool, optional

If True, the default, then create an 'endpoint_url' option if and only if one was not set during object initialisation. In this case the 'endpoint_url' will be set from the file name returned by get_filename, unless either of the filename or parsed_filename parameters is also set.

filename: str, optional

Used to set the 'endpoint_url' if it was not set during object initialisation and create_endpoint_url is True. Ignored if the parsed_filename parameter has been set.

parsed_filename: urllib.parse.ParseResult, optional

Used to set the 'endpoint_url' if it was not set during object initialisation and create_endpoint_url is True. Ignored if the filename parameter has been set.

Returns
dict or None

The s3fs.S3FileSystem options.

Examples

>>>
>>> f.get_filename()
's3://store/data/file.nc'
>>> f.get_storage_options(create_endpoint_url=False)
{}
>>> f.get_storage_options()
{'endpoint_url': 'https://store'}
>>> f.get_storage_options(filename='s3://other-store/data/file.nc')
{'endpoint_url': 'https://other-store'}
>>> f.get_storage_options(create_endpoint_url=False,
...                       filename='s3://other-store/data/file.nc')
{}
>>>
>>> f.get_storage_options()
{'key': 'scaleway-api-key...',
 'secret': 'scaleway-secretkey...',
 'endpoint_url': 'https://s3.fr-par.scw.cloud',
 'client_kwargs': {'region_name': 'fr-par'}}