[pyngl-talk] Updates for using Pyngl

Mary Haley haley at ucar.edu
Wed Oct 26 11:17:14 MDT 2016

Hi Xiaoni,

The image looks to me like the land is getting filled in and covering up
the filled contours underneath the map.

Please try setting:

res.mpLandFillColor = "transparent"
res.mpInlandWaterFillColor = "transparent"

I've updated the geodesic example at so you can see the structure of the
"cx" and "cy" grid:


Click on the second image of the first example:


Does your ISCCP NetCDF file have any variables on it that look like they
might define grid corners or some kind of cell bounds?

If you can provide us with a copy of your file, or else the output from the
following command,

ncl_filedump *yourfile*.nc

then we can have a look to see if there's anything that might help.

"yourfile.nc" needs to be replaced with the name of your NetCDF file.


On Tue, Oct 25, 2016 at 9:41 AM, Xiaoni Wang <xiaoni.wang at obspm.fr> wrote:

> Hi Mary,
>      Thank you very much for your prompt response and helpful information
> !
> 1)  in order to plot non-ocean part, I added the following lines in my
> code.
> res.mpFillOn = True
> res.mpOceanFillColor = "white"
> The resulting figure still contains ocean. Then I added
> res.mpFillDrawOrder = "PostDraw"
>> This time, the ocean part disappeared. But the color scale is greatly
> changed in the figure. I attach two figures in the below to show their
> effects. isccp_19V.000001.png with PostDraw added,
> and isccp_19V.000001.png.old without Postdraw.
> How can I have the same color as isccp_19V.000001.png.old, but without
> ocean ?
> 2)  I also looked at how to fill the small islands in your examples. There
> are something that I would like to clarify.
>      It seems that , we need the latitude/longitude of grid center, and
> also information about grid corner, in order to constrain the interpolation.
>      In my case, between any two grids, the distance between their center
> is 0.25 degree in latitude, and varying in longitude. So I have the
> distance between two grid center in latitude and longitude (in degree).  My
> question is : how to use them ? The geodesic example just read in  the
> corner_lat/lon, but are they the latitude/longitude of the 4 corners of a
> grid ? if so, which corder is the first one, and in which order are they
> organized ? (In the mpas example, they seem to read in latVertex and
> lonVertex and they define latvoc/lonvoc. Yet I have the same question….)
> Thank you again !!
> Best wishes,
> Xiaoni
>> 2) Over small islands, the interpolation method also produced some
>> effects (see large yellow areas on the ocean in figure
>> isccp_19V.00001.png). Again I do not need the ocean around the island, just
>> the results over (small) islands.
> ​This is simply an artifact of having a few values surrounded by a lot of
> missing values.  In order to plot data like this correctly, you need to
> have some kind of cell boundary or grid corner information, so the
> interpolation stays within these bounds.
> If you look at our NCL examples for geodesic and MPAS grids, they set
> these two special resources:
>   res at sfXCellBounds        = cx
>   res at sfYCellBounds        = cy
> ​which were read off a file, and are usually dimensioned something like N
> x 4 or N x 3 where N is the number of cell centers, and the 3 or 4
> represents the number of vertices of a polygon that surrounds each cell
> center.
> You can see the NCL code for these examples at:
> http://www.ncl.ucar.edu/Applications/geodesic.shtml
> http://www.ncl.ucar.edu/Applications/mpas.shtml  (see example
> mpas_cell_3.ncl)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20161026/357c3ffd/attachment.html 

More information about the pyngl-talk mailing list