Skip to content

Commit

Permalink
Again
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Mar 14, 2021
1 parent b05cd33 commit 4975413
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
3 changes: 3 additions & 0 deletions climetlab.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
},
{
"path": "../magics-python"
},
{
"path": "../magics-test"
}
],
"settings": {
Expand Down
14 changes: 7 additions & 7 deletions climetlab/sources/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ def __init__(self, *sources):
self.sources = sources
self._lengths = [None] * len(sources)

def mutate(self):
if len(self.sources) == 1:
return self.sources[0].mutate()
# def not_yet_mutate(self):
# if len(self.sources) == 1:
# return self.sources[0].mutate()

t = type(self.sources[0])
if all(type(s) == t for s in self.sources):
return t.multi_merge(self.sources).mutate()
# t = type(self.sources[0])
# if all(type(s) == t for s in self.sources):
# return t.multi_merge(self.sources).mutate()

return self
# return self

def _set_dataset(self, dataset):
super()._set_dataset(dataset)
Expand Down
14 changes: 2 additions & 12 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
# coding: utf-8

# In[73]:
import climetlab as cml


import cfgrib
import xarray as xr

from climetlab import load_source
from climetlab.sources.readers.grib import FieldSetIndex

source = load_source("file", "docs/examples/test.grib")

store = xr.backends.CfGribDataStore(FieldSetIndex(source))

d = xr.open_dataset(store, engine="cfgrib")
ds = cml.load_dataset("era5-temperature", period=(1979, 1982), domain="France", time=12)

0 comments on commit 4975413

Please sign in to comment.