|
From: Lionel R. <lro...@li...> - 2006-07-07 09:05:49
|
Work very fine here, thanks for the links. Le Vendredi 07 Juillet 2006 10:11, dd...@ja... a =C3=A9crit=C2=A0: > On Friday 07 July 2006 4:11 pm, Lionel Roubeyrie wrote: > > Hi all, > > Is it possible to import colormap file from GMT (.cpt) to basemap? > > If yes how can we do that? > > Thanks > > It's possible. Here's how I've been doing it. > > (1) I use the gmtcolormapPylab function defined in: > http://sourceforge.net/mailarchive/message.php?msg_id=3D11255878 > > (2) Using the above function and a GMT cpt file (e.g. > GMT_no_green.cpt), I set a color dictionary as: > cdict =3D gmtcolormapPylab("GMT_no_green") > > (3) I define a colormap using: > mycmap =3D cm.colors.LinearSegmentedColormap("GMT_no_green",cdict,256) > > (4) I apply the above using cmap=3Dmycolormap in contourf or pcolormesh. > > By the way, in case you don't know of the following site, it has an > exhaustive selection of color palettes: http://cpt-city.org.uk/ > > I've also attached an example of a basemap image using a cpt from the > above site. Masked values not defined by the colormap are shown in > gray. =2D-=20 Lionel Roubeyrie - lro...@li... LIMAIR http://www.limair.asso.fr |