-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
group_dict
variable
#140
Comments
One problem is that 'process_name' is not known before creating a |
+1 to this feature, even if @xs.process
class CoordsX:
x = xs.index(groups=['coords'], dims='x')
def initialize(self):
self.x = range(3)
@xs.process
class CoordsY:
y = xs.index(groups=['coords'], dims='y')
def initialize(self):
self.y = range(5)
@xs.process
class InitArray:
DIMS = ('x', 'y')
arr = xs.variable(dims=DIMS, intent='out')
coords = xs.group('coords')
def initialize(self):
self.arr = xr.DataArray(
data=0.,
dims=self.DIMS,
# Attribute.name in this instance
coords={k: self.coords[k] for k in self.DIMS}
) My suboptimal workaround has been to use |
@eho-tacc your code example made me think about a possible way in #141 to better access variable metadata across the package. |
xsimlab.group_dict()
variable would be like toxsimlab.group()
, but instead of iterating over the values only, it would provide dict-like access where keys are 2-length tuples ('process_name', 'variable_name').The text was updated successfully, but these errors were encountered: