basemap: make loading earth data optional

Hi Jeff!

I've been using your basemap package as a way to skip the thinking step
when plotting stuff on spheres, which I often do in relation to my
studies of flies' eyes... Anyhow, given that basemap comes with 82 MB
of Earth-specific data which I don't need all the time, I think it would
be really great if it would be possible to make the inclusion of such
data optional. I attach a patch which suffices for my extremely limited
needs (I simply call the __call__ method of the Basemap.Basemap class),
but doubtless causes breakage elsewhere. So, I haven't checked it in,
hoping that you might take the idea and make it a little less brittle.

I suspect there are lots of people who would like to plot things on
spheres, but wouldn't necessarily want the inclusion of coastlines,
rivers, and such. :wink: So, I think this is a general purpose improvement
and ask you to consider completing the job.

Unrelated note 1: I committed a patch to setup.py and setupegg.py to
make the thing respect setuptools even if setupegg.py wasn't run.

Unrelated note 2: The setuptools/.egg approach to data is to include it
with the .py files. Initially I thought about modifying the basemap data
path scheme to support this, but in the case of 82M, though, I'd say
that's stretching it a bit, especially with the tendancy for people
(well, me, at least), to have the last 5-100 versions of the .eggs I
built lying in site-packages.

Cheers!
Andrew

load_earth_data_start.patch (1.18 KB)

Andrew Straw wrote:

Anyhow, given that basemap comes with 82 MB
of Earth-specific data which I don't need all the time, I think it would
be really great if it would be possible to make the inclusion of such
data optional.

That wasn't particularly clear. What I meant to say was that when
running basemap, it would be nice if the contents in the data path were
optionally not loaded if the user knew she was not going to plot
coastlines, etc. I have no problems with actually installing the data,
although to be fair the reason I'd like this feature is so that I don't
have to have a basemap data path at all.

Andrew Straw wrote:

Andrew Straw wrote:

Anyhow, given that basemap comes with 82 MB
of Earth-specific data which I don't need all the time, I think it would
be really great if it would be possible to make the inclusion of such
data optional.

That wasn't particularly clear. What I meant to say was that when
running basemap, it would be nice if the contents in the data path were
optionally not loaded if the user knew she was not going to plot
coastlines, etc. I have no problems with actually installing the data,
although to be fair the reason I'd like this feature is so that I don't
have to have a basemap data path at all.
  

Andrew: OK, now I get it. I've implemented your suggestion, except that instead of adding a new parameter to Basemap.__init__, I've just skipped the processing of boundary data if the resolution keyword is set to None.

-Jeff

ยทยทยท

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...236...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : Jeffrey S. Whitaker: NOAA Physical Sciences Laboratory

Jeff Whitaker wrote:

Andrew: OK, now I get it. I've implemented your suggestion, except that instead of adding a new parameter to Basemap.__init__, I've just skipped the processing of boundary data if the resolution keyword is set to None.

Thanks Jeff, this works great!