contours not contained to map and simular issues

Howdy All,

I'm hoping someone can give me a quick solution to a couple of
problems. I think I'm just missing an idea or two.

Problem 1: I'm creating a map using the 'llc' lambert conformal
projection and pcolormesh. Here is a sampling of the source.

            self.m = Basemap(lat_0=self.lat_0,lon_0=self.lon_0,projection='lcc',

width=store_comp.base_width,height=store_comp.base_height,
                             resolution='i',area_thresh=100000)
           self.fig = plt.figure(figsize=(width,hieght),frameon=True)
           self.ax = self.fig.add_subplot(111)
           self.xx, self.yy = self.m(*numpy.meshgrid(self.x,self.y))
           self.the_image =
self.m.pcolormesh(self.xx,self.yy,z,edgecolors='None',cmap=self.color_scheme)

           The problem I have is two fold: 1) the map segment isn't
fully shown unless I drive up the width and size in basemap so that
the map floats in a lot of whitespace. 2) when I use drawparallels
etc. the lines extend beyond the map in a way that I wish they
wouldn't. See map1 in http://gallery.me.com/ohtinsel#100149

Problem 2: This problem comes up when I use contourf on the same
data, which occupies only a limited domain (i.e., there is no data
outside the lat/lon bounds shown in map1). Here the contours spill out
onto the plot in a way that I wish they wound't (some of the source
is below). See map2 in http://gallery.me.com/ohtinsel#100149

                self.x = numpy.where(self.x < 180.0,self.x,self.x-360.0)
                scale = 1
                dx = self.width/((len(self.x)-1)*scale)
                dy = self.height/((len(self.y)-1)*scale)
                nx = int((self.m.xmax-self.m.xmin)/dx)+1
                ny = int((self.m.ymax-self.m.ymin)/dy)+1
                self.z,self.xx,self.yy = self.m.transform_scalar(
                    self.z,self.x,self.y,nx,ny,returnxy=True)
                self.the_image =
self.m.contour(self.xx,self.yy,self.z,colors='k')
                self.the_image = self.m.contourf(self.xx,self.yy,self.z,
                     cmap=self.color_scheme,extend=self.extend)

No doubt I'm doing something wrong and probably obvious, but I can't
figure it out. Suggestions are much appreciated.

Mike

Mike Bauer wrote:

Howdy All,

I'm hoping someone can give me a quick solution to a couple of
problems. I think I'm just missing an idea or two.

Problem 1: I'm creating a map using the 'llc' lambert conformal
projection and pcolormesh. Here is a sampling of the source.

            self.m = Basemap(lat_0=self.lat_0,lon_0=self.lon_0,projection='lcc',

width=store_comp.base_width,height=store_comp.base_height,
                             resolution='i',area_thresh=100000)
           self.fig = plt.figure(figsize=(width,hieght),frameon=True)
           self.ax = self.fig.add_subplot(111)
           self.xx, self.yy = self.m(*numpy.meshgrid(self.x,self.y))
           self.the_image =
self.m.pcolormesh(self.xx,self.yy,z,edgecolors='None',cmap=self.color_scheme)

           The problem I have is two fold: 1) the map segment isn't
fully shown unless I drive up the width and size in basemap so that
the map floats in a lot of whitespace. 2) when I use drawparallels
etc. the lines extend beyond the map in a way that I wish they
wouldn't. See map1 in http://gallery.me.com/ohtinsel#100149

Problem 2: This problem comes up when I use contourf on the same
data, which occupies only a limited domain (i.e., there is no data
outside the lat/lon bounds shown in map1). Here the contours spill out
onto the plot in a way that I wish they wound't (some of the source
is below). See map2 in http://gallery.me.com/ohtinsel#100149

                self.x = numpy.where(self.x < 180.0,self.x,self.x-360.0)
                scale = 1
                dx = self.width/((len(self.x)-1)*scale)
                dy = self.height/((len(self.y)-1)*scale)
                nx = int((self.m.xmax-self.m.xmin)/dx)+1
                ny = int((self.m.ymax-self.m.ymin)/dy)+1
                self.z,self.xx,self.yy = self.m.transform_scalar(
                    self.z,self.x,self.y,nx,ny,returnxy=True)
                self.the_image =
self.m.contour(self.xx,self.yy,self.z,colors='k')
                self.the_image = self.m.contourf(self.xx,self.yy,self.z,
                     cmap=self.color_scheme,extend=self.extend)

No doubt I'm doing something wrong and probably obvious, but I can't
figure it out. Suggestions are much appreciated.

Mike

Mike: It's difficult to tell what's going on (or even what you're really trying to do) from the code snippets you posted. If you can send a complete, self-contained example of the problem you're having that anybody can run, then we can probably help.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg