Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_features(cutout, module, features, tmpdir=None):
"""
Load the feature data for a given module.
This get the data for a set of features from a module. All modules in
`atlite.datasets` are allowed.
"""
parameters = cutout.data.attrs
lock = SerializableLock()
datasets = []
get_data = datamodules[module].get_data
for feature in features:
feature_data = get_data(cutout, feature, tmpdir=tmpdir, lock=lock, **parameters)
datasets.append(feature_data)
if len(datasets) >= 1 and isinstance(datasets[0], Delayed):
datasets = dask.compute(*datasets)
ds = xr.merge(datasets, compat='equals')
for v in ds:
ds[v].attrs['module'] = module
return ds