Open ChrisBarker-NOAA opened 6 years ago
Actually, it should be making that association automatically and implicitly. What do you mean by 'associated' here? There's no specific attribute that stores this information, but the var.infer_location(data)
function should be able to tell you where the data fits on the grid, if at all
hmm, it seems it would be better to be able to be be explicit about it. Doesn't a variable need to know which part of the grid it's associated with???
In this case, I have data on the boundaries, and the boundaries aren't properly set up, 'caue they are non-conforming, so there's a bit of chicken-egg here.
Let's hash this out offline, maybe gridded already does what it needs to do.
found it -- here in ugrid.py:
def infer_location(self, data):
"""
:param data:
Returns 'nodes' if data will fit to the nodes, 'faces' if the data will fit to the faces,
and None otherwise.
"""
size = None
try:
size = data.shape[-1]
except:
return None # Variable has no shape attribute!
if size == self.nodes.shape[0]:
return 'nodes'
if size == self.faces.shape[0]:
return 'faces'
return None
it's looking for nodes and faces, but not boundaries. So I need to add boundary code.
I'll leave this open 'till I actually add it....
with UGRIDS, variables can be associated with the nodes, faces, or boundaries.
There doesn't appear to be a way for a gridded Variable to be associated with anything but the nodes.
See pyugrid.UVar to see how I did it there.