pp-mo / ugrid-checks

UGRID file format compliance checking
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

Show dimensions of data variables in structure report #51

Open pp-mo opened 2 years ago

pp-mo commented 2 years ago

I think this would be useful. N.B. we have chosen so far to show only dimension names, not numbers, so you don't know how "big" things actually are. But I still think it would still make sense to list dimensions of data variables, so we at least know the dimensionality, just as we identify the location dimensions within the mesh printouts. For example, referencing this file (though it does also have some problems) ...

$ python -m ugrid_checks -seq unstructured_grid/lfric_ngvat_2D_1t_face_half_levels_main_conv_rain.nc 

File mesh structure
-------------------
Meshes
    "Mesh2d_half_levels"
        node("nMesh2d_half_levels_node")
            coordinates : "Mesh2d_half_levels_node_x", "Mesh2d_half_levels_node_y"
        edge("nMesh2d_half_levels_edge")
            edge_node_connectivity : "Mesh2d_half_levels_edge_nodes"
            coordinates : "Mesh2d_half_levels_edge_x", "Mesh2d_half_levels_edge_y"
        face("nMesh2d_half_levels_face")
            face_node_connectivity : "Mesh2d_half_levels_face_nodes"
            coordinates : "Mesh2d_half_levels_face_x", "Mesh2d_half_levels_face_y"

?? Connectivities with no mesh ??
    "Mesh2d_half_levels_face_edges" ("nMesh2d_half_levels_face", "nMesh2d_half_levels_vertex")
        cf_role = "face_edge_connectivity"

Mesh Data Variables
    "conv_rain"
        mesh : "Mesh2d_half_levels"
        location : "face"

So, that last bit could easily (and probably usefully) say :

Mesh Data Variables
    "conv_rain" ("time_counter", "nMesh2d_half_levels_face")
        mesh : "Mesh2d_half_levels"
        location : "face"

N.B. this would be different from how we report on connectivity/coordinate variables. But I think that is reasonable, as the dimensions of those are mostly clear from their role ( except for : (a) dimension ordering ; (b) sizes of indexing dimensions -- which are anyway generally small ) Whereas in this case, for example, the change would show you that the data variable also has time as a dimension.

pp-mo commented 2 years ago

NOTE: It's not probably not worth addressing this until #50 is sorted out, as this will presumably (eventually) include re-writing the structure report in terms of the structure-analysis object.