Skip to content

Commit

Permalink
Merge branch 'release/0.16.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Aug 30, 2023
2 parents 80cab9e + a04b2d8 commit 96e841c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions climetlab/readers/bzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#

import bz2
import os

from . import Reader
from . import reader as find_reader
Expand All @@ -33,7 +32,7 @@ def uncompress(target, _):
)

def mutate(self):
print('mutare', self.source, self.unzipped)
print("mutare", self.source, self.unzipped)
return find_reader(self.source, self.unzipped)


Expand Down
4 changes: 2 additions & 2 deletions climetlab/readers/grib/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import numpy as np

# from climetlab.ml.torch import to_pytorch_dataloader

from .tensorflow import default_merger, to_funcs

LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -63,6 +61,8 @@ def __getitem__(self, i): # -> Tuple[np.ndarray, ...]:

class PytorchMixIn:
def to_pytorch_dataloader(self, *args, dataloader_kwargs=None, **kwargs):
from climetlab.ml.torch import to_pytorch_dataloader

if dataloader_kwargs is None:
dataloader_kwargs = {}
dataset = self.to_pytorch(*args, **kwargs)
Expand Down
8 changes: 5 additions & 3 deletions climetlab/utils/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

RE3 = re.compile(r"\(([^}]*)\)")


class Any:
def substitute(self, value, name):
return value
Expand Down Expand Up @@ -115,11 +116,13 @@ def substitute(self, params):
raise ValueError("Missing parameter '{}'".format(self.name))
return self.kind.substitute(params[self.name], self.name)


FUNCTIONS = dict(lower=lambda s: s.lower())


class Function:
def __init__(self, value):
functions = value.split('|')
functions = value.split("|")
self.name = functions[0]
self.variable = Variable(functions[0])
self.functions = functions[1:]
Expand All @@ -131,7 +134,6 @@ def substitute(self, params):
return value



class Pattern:
def __init__(self, pattern, ignore_missing_keys=False):
self.ignore_missing_keys = ignore_missing_keys
Expand All @@ -142,7 +144,7 @@ def __init__(self, pattern, ignore_missing_keys=False):
if i % 2 == 0:
self.pattern.append(Constant(p))
else:
if '|' in p:
if "|" in p:
v = Function(p)
else:
v = Variable(p)
Expand Down
2 changes: 1 addition & 1 deletion climetlab/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.5
0.16.6

0 comments on commit 96e841c

Please sign in to comment.