How many cells past the state boundary are you seeing? If it is never more
than one cell past the boundary, it might be an offset issue.

On Fri, Nov 21, 2014 at 1:30 PM, Maria Liukis <liu...@usc.edu> wrote:

> Eric,
>
> Yes, my data is exactly how you understood it. I thought, as you are
> suggesting, to create a masked array for rectangle that bounds state of CA,
> to be used with pcolormesh(). The only existing functionality that I could
> find is griddata(), but it also interpolates data to extra cells outside of
> my CA grid (even with method=‘nearest’ to extra cells within the convex
> hull). It looks like I have to “map” my CA grid to larger rectangular grid
> manually, I just wanted to check if such functionality already exists
> within matplotlib, numpy or scipy packages, and I am just not aware of it.
>
> I also could plot each cell with ax.add_patch(), but would imagine that it
> would be much slower.
>
> And thank you for mentioning basemap, I am using it for my maps :)
>
> Thank you very much for your response!
> Masha
>
>
> On Nov 21, 2014, at 6:54 AM, Eric Firing <efir...@hawaii.edu> wrote:
>
> > On 2014/11/20, 7:11 PM, Maria Liukis wrote:
> >> Hello,
> >>
> >> I have a problem plotting data which is defined on a grid other than
> >> rectangular mesh, and would greatly appreciate any advise. My data is
> >> defined for 0.1degree grid for the state of California, and I don’t
> >> want to interpolate my data outside of the defined grid when plotting
> >> it. I used pcolormesh() function for rectangular area maps, but it
> >> only accepts rectangular grid and I was wondering if there is a
> >> simple solution to my problem.
> >
> > Masha,
> >
> > When you say your data "is defined for a 0.1 degree grid", that makes it
> > sound like it is on a quadrilateral grid, so there should be no problem
> > with using pcolormesh.  Is it on 0.1 degree lon by 0.1 degree lat
> > points, but only for points within California?  Then you can make a
> > masked array with this grid for a rectangle in which the points outside
> > California are masked, and the ones inside are set to your data values.
> >  Your X and Y inputs to pcolormesh should be 2-D arrays with the
> > boundary values rather than the centers.  It sounds like you would want
> > to do all this via mpl_toolkits.basemap.Basemap so that you will end up
> > with a properly proportioned and labeled map.
> >
> > Maybe I am misinterpreting your description of your data, however.
> >
> > Eric
> >
> >>
> >> The only solution I could find was to use
> >> scipy.interpolate,griddata() to “map” my grid to a bounding
> >> rectangular grid (bounding rectangle around CA state), but that would
> >> also interpolate my data to grid cells outside of CA state, which I
> >> don’t want to do.
> >>
> >> Many thanks for any hints! Masha -- liu...@usc.edu
> >>
> >>
> >>
> >
> >>
> ------------------------------------------------------------------------------
> >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> >> with Interactivity, Sharing, Native Excel Exports, App Integration &
> more
> >> Get technology previously reserved for billion-dollar corporations, FREE
> >>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Matplotlib-users@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> >
> >
> >
> ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Matplotlib-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to