ioos / odvc

Ocean Dimensionless Vertical Coordinates
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Conform the formula_terms variables the a broadcast-able shape before computation #12

Closed ocefpaf closed 9 years ago

ocefpaf commented 9 years ago

I want to keep everything around the nc object and the formula_terms dictionary.

We can easily get all the dimensions, including the final z dimension with,

def formula_dims(formula_terms):
    dims = {k: tuple(sorted(nc[v].dimensions)) for k, v in formula_terms.items()}
    z_dims = tuple(sorted(set([item for sublist in dims.values() for item in sublist])))
    dims.update(z=z_dims)
    return dims

I just need to use that later in nc2biggus or any other array backend. Well... Calling these hackish functions a backend might be too much :stuck_out_tongue_winking_eye:

ocefpaf commented 9 years ago

Done in #20