Using pcolorm with irregular model grids
13 views (last 30 days)
Having been a long-term m_map user, I've recently switched to using Matlab's mapping toolbox (v2013a at the moment). On the whole, it's pretty great, and it more-or-less replaces m_map's functionality.
In particular, I've been using it to generate quick, and rather nice, plots of geographical output from a model that I use, NEMO. As aficionados will know, this ocean model has a strange tripolar grid that's regular in the southern hemisphere, but distorts to two poles in the north to avoid the dreaded north pole singularity. When plotting, I use pcolorm as follows:
pcolorm (yy, xx, fld);
Where yy is a 2D matrix of latitude locations, xx is a 2D matrix of longitude locations and fld is whatever 2D matrix of model properties I'm interested in at the time. The matrices xx and yy have to be 2D because of this distorted grid, and they are usually the position (in latitude and longitude degrees) of the centre of a given grid cell.
I can't find anything on the Matlab webpages to help me, but I suspect I shouldn't be using the position of grid cell centres for this sort of plot, and should instead be doing something like using the southwest corner of a grid cell. Or, in fact, doing something completely different in which I formally specify the grid cell edges.
Does anyone know of any resources that would explain what the best approach is? The Matlab page is a bit too thin in detail to my mind - especially as a geographical example is used to illustrate it. And though the impact may be less significant, the question of grid cell centres vs. grid cell edges occurs even on a regular grid.
Rob Comer on 6 Aug 2015
With an irregular grid, for which a full latitude-longitude geolocation mesh is needed, I think it's always appropriate to specify centers (sample locations, that is) rather than cell boundaries. Cell boundaries, particularly if the grid is not global, can be defined only indirectly at best. The spherical version of Voronoi cells could be used in the interior, perhaps, but at the edges things become unconstrained.
So, I think you're doing the right thing in your call to pcolorm.
In the case of regular grids, the distinction between cells and point sample locations (postings) is more critical, and you can find some documentation on that here:
See the description of RasterInterpretation.
C. Zu Bai on 28 Nov 2020
I have encountered with the same problem when I tried to plot the map of NEMO model. It took me a lot of time to find the solution. A feasible method is to interpolate the irregular grid onto the regular one using "griddata" or "ScatteredInterpolate". This would introduce some errors of interpolation (not evaluated though). Hope it would help.