Using pcolorm with irregular model grids

15 visualizaciones (últimos 30 días)
Andrew Yool
Andrew Yool el 3 de Ag. de 2015
Comentada: Andrew Yool el 28 de Nov. de 2020
Hi,
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.
Cheers,
Andrew.

Respuestas (2)

Rob Comer
Rob Comer el 6 de Ag. de 2015
Hi Andrew,
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.
Regards, Rob
  1 comentario
Andrew Yool
Andrew Yool el 6 de Ag. de 2015
Hi Rob,
Thanks very much for your response. Using the cell centre kind-of makes sense, but I'm still not sure that it's quite right.
The reason that I originally asked my question was because when I plotted at low grid resolution (1-degree) there was a noticeable offset when I added coastlines to my maps (i.e. the position of land cells didn't align well with the coast). This doesn't occur - or, more likely, is much less noticeable - with higher resolution grids. But it was noticeable enough at low resolution that I played around with my xx and yy values until I got a better "fit" (I think I subtracted 0.5 degrees from both in the end).
Anyway, I've got my workaround for now, but I'd still like to know if there's a better solution.
Cheers,
Andrew.

Iniciar sesión para comentar.


C. Zu Bai
C. Zu Bai el 28 de Nov. de 2020
Hi Andrew,
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.
Regards,
Hengqian
  1 comentario
Andrew Yool
Andrew Yool el 28 de Nov. de 2020
Hi Hengqian,
Thanks for your answer. Yes, this is an alternative solution. It still leaves you with the issue about whether you specify grid cell centres or corners for the longitude and latitude position, but it avoids the sometimes-glitchy "North Fold".
Cheers,
Andrew.

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by