Beispiel #1
0
def staggered_component_box(resolution, axis, box_like=None):
    staggered_box = AABox(0, resolution) if box_like is None else AABox.to_box(
        box_like, resolution_hint=resolution)
    unit = np.array([
        (staggered_box.size[axis] / resolution[axis]) if d == axis else 0
        for d in range(len(resolution))
    ])
    box = AABox(staggered_box.lower - unit / 2, staggered_box.upper + unit / 2)
    return box
Beispiel #2
0
 def box(self, box):
     return AABox.to_box(box, resolution_hint=self.resolution)
Beispiel #3
0
 def box(self, box):
     box = AABox.to_box(box, resolution_hint=self.resolution)
     assert_same_rank(len(self.data), self.box,
                      'StaggeredGrid.data does not match box.')
     return box