NOAA-ORR-ERD / gridded

A single API for accessing / working with gridded model results on multiple grid types
https://noaa-orr-erd.github.io/gridded/index.html
The Unlicense
64 stars 14 forks source link

variables on the boundaries... #19

Open ChrisBarker-NOAA opened 6 years ago

ChrisBarker-NOAA commented 6 years ago

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.

jay-hennen commented 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

ChrisBarker-NOAA commented 6 years ago

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.

ChrisBarker-NOAA commented 6 years ago

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.

ChrisBarker-NOAA commented 6 years ago

I'll leave this open 'till I actually add it....