4 from .base
import Creator
7 from refractor
import framework
as rf
15 val = self.
value(**kwargs)
18 if hasattr(val,
"value"):
20 val_shape = val.value.shape
24 if retrieved
is None or retrieved:
25 return np.ones(val_shape, dtype=bool)
27 return np.zeros(val_shape, dtype=bool)
35 val = self.
value(**kwargs)
38 if hasattr(val,
"value"):
40 val_shape = val.value.shape
45 return np.ones(val_shape, dtype=bool)
47 flags = np.empty(val_shape, dtype=bool)
48 for chan_idx, chan_flag
in enumerate(retrieved):
49 flags[chan_idx, :] = chan_flag
53 "Create an array with unit class from a numpy array and type string" 60 value = self.
value(**kwargs)
63 num_dims = len(value.shape)
65 return rf.ArrayWithUnit_double_3(value, units)
67 return rf.ArrayWithUnit_double_2(value, units)
69 return rf.ArrayWithUnit_double_1(value, units)
71 raise param.ParamError(
"Unsupported number of dimensions %s for array" % (num_dims))
81 contents = netCDF4.Dataset(self.
filename(),
"r") 83 def extract_datasets(group, values):
84 for v_name, v_ds
in group.variables.items():
85 v_path = (group.path +
"/" + v_ds.name).lstrip(
"/")
86 values[v_path] = v_ds[:]
87 for g_name, child_group
in group.groups.items():
88 extract_datasets(child_group, values)
90 extract_datasets(contents, values)
def retrieval_flag(self, kwargs)
def register_parameter(self, param_name, param_def)
def param(self, param_name, kwargs)
def retrieval_flag(self, kwargs)