How to use the atlite.config function in atlite

To help you get started, we’ve selected a few atlite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyPSA / atlite / atlite / cutout.py View on Github external
    def __init__(self, name=None, cutout_dir=config.cutout_dir, **cutoutparams):
        self.name = name

        self.cutout_dir = os.path.join(cutout_dir, name)
        self.prepared = False

        if 'bounds' in cutoutparams:
            x1, y1, x2, y2 = cutoutparams.pop('bounds')
            cutoutparams.update(xs=slice(x1, x2),
                                ys=slice(y2, y1))

        if os.path.isdir(self.cutout_dir):
            self.meta = meta = xr.open_dataset(self.datasetfn()).stack(**{'year-month': ('year', 'month')})
            # check datasets very rudimentarily, series and coordinates should be checked as well
            if all(os.path.isfile(self.datasetfn(ym)) for ym in meta.coords['year-month'].to_index()):
                self.prepared = True
            else: