Skip to content
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

Include mesh location in cube printout #4756

Closed
wjbenfold opened this issue May 19, 2022 · 5 comments
Closed

Include mesh location in cube printout #4756

wjbenfold opened this issue May 19, 2022 · 5 comments
Assignees
Labels
Feature: UGRID Good First Issue A good issue to take on if you're just getting started with Iris development

Comments

@wjbenfold
Copy link
Contributor

✨ Feature Request

In the cube printout, include the mesh location.

Motivation

This important information is currently absent

@wjbenfold wjbenfold self-assigned this May 19, 2022
@trexfeathers trexfeathers added the Good First Issue A good issue to take on if you're just getting started with Iris development label May 19, 2022
@pp-mo
Copy link
Member

pp-mo commented May 19, 2022

I think it also makes sense to print "the mesh"
-- i.e. its name, which is usually a valid thing, certainly when loaded from a file, it at least has a var_name
The ugrid-checker prints this for the netcdf data variables (~the cubes, in Iris), like this :

Mesh Data Variables
    "sample_data"
        mesh : "topology"
        location : "face"

So, I think the key question is where+how should this info appear in the cube listing.
As a starting suggestion , what currently looks like ...

>>> print(meshcube)
values / (m)                        (model_level: 2; -- : 3)
    Dimension coordinates:
        model_level                             x       -
    Mesh coordinates:
        latitude                                -       x
        longitude                               -       x
    Auxiliary coordinates:
        aux                                     x       x
    Attributes:
        extra                       3.2

Might now look like ...

>>> print(meshcube)
values / (m)                        (model_level: 2; -- : 3)
    Dimension coordinates:
        model_level                             x       -
    Mesh:
        Mesh2d : face                                   x
    Mesh coordinates:
        latitude                                -       x
        longitude                               -       x
    Auxiliary coordinates:
        aux                                     x       x
    Attributes:
        extra                       3.2

Some reasons:

  • we would like the info to appear somewhere prominent
  • we don't want it too far away from the MeshCoords
  • but we don't want it to break up the dimensions map..
  • So, I'm making a 'Mesh' section which belongs in the dimensions-map ..
  • Otherwise, if we have CellMeasures/AuxCoords etc, it can really only go after those

Opinions ?!?

@wjbenfold
Copy link
Contributor Author

I'd put it out of the coordinates - it's not a coordinate and I'd find it confusing to have it in there breaking up the coordinates.

That said, I'd far rather this happened in some way and then we can tweak it if we want it moving when we have more mesh users, rather than people spending ages discussing where it perfectly goes and it never getting implemented, so I'm happy with wherever the person who picks up this ticket decides to put it

@pp-mo
Copy link
Member

pp-mo commented May 26, 2022

At the risk of turning this into a discussion thread
-- and probably a contentious one at that ...

To provide this info without a significant re-think to the existing "cube summary object" and "cube printout" implementations, I think the mesh/location info can only go into a new cube summary "section", which then must be either a 'vector' section (i.e. it participates in the dims-map), or a 'scalar' one.
I think anything else would require us to invent a new type of section, which is likely to have awkward knock-ons.
( e.g. the notebook html_repr output : though IIRC that may not work properly for unstructured cubes yet, anyway ?)

So, I wrote a nasty hacky bit of code to populate a cube with all possible sections.
Don't ask, but the outcome prints out like this :

air_potential_temperature / (K)     (time: 6; model_level_number: 70; -- : 100)
    Dimension coordinates:
        time                             x                      -        -
        model_level_number               -                      x        -
    Mesh coordinates:
        grid_latitude                    -                      -        x
        grid_longitude                   -                      -        x
    Auxiliary coordinates:
        level_height                     -                      x        -
        sigma                            -                      x        -
        surface_altitude                 -                      -        x
    Derived coordinates:
        altitude                         -                      x        x
    Cell measures:
        unknown                          -                      -        x
    Ancillary variables:
        vertical_angle                   -                      -        x
    Scalar coordinates:
        forecast_period             0.0 hours
        grid_latitude               -0.08325 degrees, bound=(-0.12825, -0.03825) degrees
    Cell methods:
        mean                        grid_latitude
    Attributes:
        source                      'Iris test case'

So, I the benefit of presenting it as a "vector" section, as above, is that you can put it alongside the mesh-coords within the dims map, and also highlight that it links to the mesh dimension. But, as pointed out, it isn't a coord or any sort of 'dimensional metadata' component, so it doesn't really belong there.

However, if we provide a "scalar" Mesh section, then the awkward part is that it may be some way away from the primary coordinate info in the dims map. The best we can do is put it as the first scalar section.
In the above case, that probably looks something like this :

air_potential_temperature / (K)     (time: 6; model_level_number: 70; -- : 100)
    Dimension coordinates:
        time                             x                      -        -
        model_level_number               -                      x        -
    Mesh coordinates:
        grid_latitude                    -                      -        x
        grid_longitude                   -                      -        x
    Auxiliary coordinates:
        level_height                     -                      x        -
        sigma                            -                      x        -
        surface_altitude                 -                      -        x
    Derived coordinates:
        altitude                         -                      x        x
    Cell measures:
        unknown                          -                      -        x
    Ancillary variables:
        vertical_angle                   -                      -        x
    Mesh:
        var_name                    Mesh2d
        location                    face
    Scalar coordinates:
        forecast_period             0.0 hours
        grid_latitude               -0.08325 degrees, bound=(-0.12825, -0.03825) degrees
    Cell methods:
        mean                        grid_latitude
    Attributes:
        source                      'Iris test case'

What do we think, user-champions ?
@jamesp @wjbenfold @trexfeathers @bjlittle

@trexfeathers
Copy link
Contributor

Looks good, @pp-mo.

it may be some way away from the primary coordinate info in the dims map

Having a Mesh: section stands out enough for me, and for dim-specific stuff we have the Mesh coordinates:.

@wjbenfold
Copy link
Contributor Author

closed by #4778

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: UGRID Good First Issue A good issue to take on if you're just getting started with Iris development
Projects
None yet
Development

No branches or pull requests

3 participants