# Way(s) to illustrate a diagnostic 2D map over the unstructured grid - Python

#### Alex_Cantrel

##### New member
I am a new MPAS user an I apologize in advance if the question/description is not clear or if it doesn't make any sense at all.

I want to work with the original unstructured arrays and am trying to find a way to illustrate a 2D map with python.
I am loading a history file and I can construct the unstructured cells using the verticesOnEdge. However, I can't find a way to 'fill' the cells with actual diagnostic values.

If I try to use verticesOnCell instead of verticesOnEdge to create the grid i get some ab-normal values (if I understood it and used it correctly), i.e. some vertices on specific cells according to their latVertex and lonVertex values seem not to really belong to these specific cells.

I am providing a simple example that I have already converted latVertex and lonVertex to degrees:

For the first cell:
verticesOnCell[0,:] = [1,2,3,4,5,6,0]
latVertex[1,2,3,4,5,6,0] = [58.888172, 58.902447, 58.919384, 58.921234, 58.90695, 51.27235, 58.890034]
lonVertex[1,2,3,4,5,6,0] = [-0.096343994, -0.073791504, -0.08892822, -0.11846924, -0.14099121, -12.128357, -0.12579346]
If I understood it correctly the last element '0' is not included in the vertices (i.e. we have only 6 vertices in this specific cell). However, according to the above arrays, it seems that the 5th element (i.e. vertice 6) is also an outlier?

For the second cell
verticesOnCell[1,:] = [7,8,9,10,11,0,0]
latVertex[7,8,9,10,11,0,0] = [51.28747, 51.280373, 51.2602, 51.255215, 53.97042, 58.890034, 58.890034]
lonVertex[7,8,9,10,11,0,0] =[-12.148529, -12.178497, -12.1762085, -12.145935, 8.525445, -0.12579346, -0.12579346]
In this case it seems that although we have 2 zero elements, i.e. 5 vertices in this specific cell, the '11' vertice seems to be also an outlier.
So, I have three questions:
1. Did I misunderstood something on the above arrays?
2. Is it normal to have these outliers appeared not in zero vertices?
3. Is there any way to plot a 2D map over the unstructured grids and not the unstructured grids and a 'structured' 2D map?

Thank you very much in advace.

Last edited:
This is a question related to the MPAS mesh structure. Please take a look at the document below:

The following variables in history output files are specifically important:

• nEdgesOnCell(nCells) – the number of neighbors for each cell
• cellsOnCell(maxEdges, nCells) – the indices of neighboring cells for each cell
• edgesOnCell(maxEdges, nCells) – the indices of bounding edges for each cell
• verticesOnCell(maxEdges, nCells) – the indices of corner vertices for each cell
• edgesOnVertex(vertexDegree,nVertices) – the indices of edges incident with each vertex • verticesOnEdge(2,nEdges) – the indices of endpoint vertices for each edge
• cellsOnVertex(vertexDegree,nVertices) – the indices of cells meeting at each vertex
• cellsOnEdge(2,nEdges) – the indices of cells separated by each edge

We are working on some python scripts to process data on unstructured meshes using python uxarray. We will post sample scripts to MPAS website once they are ready. Here is the website that shows some initial work: