Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Does the MPAS 120 km uniform grid fully cover the Earth?

panting

Member
Hello!

I am trying to interpolate the EDGAR v8.1 emission inventory onto a 120 km uniform grid of MPAS. I used the following code to extract the MPAS grid information:
Python:
def create_mpas_grid(mpas_file,proj,filename):
    ds = xr.open_dataset(mpas_file)

    indexToCellID = ds['indexToCellID'].values

    verticesOnCell = ds['verticesOnCell'].values
    nEdgesOnCell = ds['nEdgesOnCell'].values

    lonVertex = np.degrees(ds['lonVertex'].values)
    latVertex = np.degrees(ds['latVertex'].values)

    polygons = []
    for i in range(len(indexToCellID)):
        vertex_indices = verticesOnCell[i, :nEdgesOnCell[i]] - 1

        poly_lons = lonVertex[vertex_indices]
        poly_lats = latVertex[vertex_indices]
        polygons.append(Polygon(zip(poly_lons, poly_lats)))

    mpas_grid = gpd.GeoDataFrame({'cellID': indexToCellID}, geometry=polygons)
    mpas_grid.crs = proj
    if os.path.exists(filename+".shp"): os.remove(filename+".shp")
    if os.path.exists(filename+".shx"): os.remove(filename+".shx")
    if os.path.exists(filename+".dbf"): os.remove(filename+".dbf")
    if os.path.exists(filename+".prj"): os.remove(filename+".prj")
    if os.path.exists(filename+".qpj"): os.remove(filename+".qpj")
    if os.path.exists(filename+".cpg"): os.remove(filename+".cpg")
    mpas_grid.to_file(filename+".shp")

    return mpas_grid

# mpas grid
if os.path.exists('mpasgrid.shp'):
    grid2 = gpd.read_file('mpasgrid.shp')
else:
    mpas_file = 'x1.40962.grid.nc'
    proj = 'epsg:4326'
    grid2 = create_mpas_grid(mpas_file,proj,'mpasgrid')

Then, I checked the coverage of the MPAS grid generated from the extracted information, and found that it is not fully closed globally.
Python:
print(grid2.total_bounds)
1742305601061.png

I would like to know if this is an issue with the MPAS grid itself or if my method of extracting the grid information is too rough? If it is the latter, could you teach me a better way to do it?
I look forward to your reply! Thank you!

Sincerely,
Pan.
 
The 120-km (40962) mesh does cover the entire globe. The vertex locations are points, and the fact that the minimum and maximum of the lonVertex field don't equal -180.0 and 180.0 only tells us that there are no vertices that lie exactly on the date line; similarly, it appears that we don't have any vertices that lie exactly at the poles.
 
The 120-km (40962) mesh does cover the entire globe. The vertex locations are points, and the fact that the minimum and maximum of the lonVertex field don't equal -180.0 and 180.0 only tells us that there are no vertices that lie exactly on the date line; similarly, it appears that we don't have any vertices that lie exactly at the poles.
Thank you for your answer! I understand now.|

Wish you all the best,
Pan.
 
Top