[MITgcm-support] OBCS prescribed temperature

Ryan Abernathey ryan.abernathey at gmail.com
Wed May 21 20:08:06 EDT 2014


In python, the proper way to use the command pcolormesh(x, y, c) is to have
x and y specify the coordinates of the cell BOUNDARIES, not centers. This
means that x and y have a different shape from c. In MITgcm speak, x and y
would correspond to Xg and Yg, while c would be defined at Xc and Yc. If
reading from mds grid files, you just have to add on the missing final Xg
and Yg points in order to make it work properly. This is a feature, not a
bug, and in fact it makes a lot of sense, especially for irregular grid
geometries! :)
http://matplotlib.org/1.3.1/api/pyplot_api.html#matplotlib.pyplot.pcolor

The lazier option is to use imshow, which works the same as MATLAB's image.
But this won't get the geometry correct unless your grid spacing is
perfectly regular.

-Ryan





On Wed, May 21, 2014 at 7:36 PM, Dimitris Menemenlis
<dmenemenlis at gmail.com>wrote:

> I was going to ask how you plotted.
> Similar problem happens if you use pcolor in matlab.
> That is, it does not plot grid cell-center values but rather interpolates
> between the grid cell centers, that is, the plot has one less column and
> row than does the matrix.
>
> For MITgcm users that use matlab, if you want to plot grid cell center
> values,
> you should use image instead of pcolor.  It's also a lot faster.
> There is a matlab script checked in:
> MITgcm/utils/matlab/cs_grid/latloncap/quikpcolor.m
> that has same syntax as pcolor and does this automatically.
>
> On May 21, 2014, at 2:02 PM, David Hebert <david.hebert at nrlssc.navy.mil>
> wrote:
>
> This indeed seems to be the case. I added an extra row and one can see the
> full prescribed temperature on both side, as shown below. (Note this was
> done with Python pcolormesh if anyone is using that.)
>
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20140521/afb06d82/attachment.htm>


More information about the MITgcm-support mailing list