Live from AGU Fall Meeting 2010, I can’t resist to share some waves with you all !!

# Year: 2010

## Matplotlib Fonts (plots, basemaps, etc.)

Here is the trick (well documented on the matplotlib webpage) to define the font family and size of what appears on your matplotlib plot:

## Numpy Trick 01

I usually forget how much Numpy makes life easy : Say, you have a 101 element array, e.g.: import numpy as np a = np.linspace(0,100,101) and you want to take every 4th item in that array, that’s as easy as…

## Numpy.ma not always necessary

I just discovered that there is an easier way to do this (e.g. from tutorial06): import numpy.ma as ma mask = ma.masked_where(countries[‘ISO’] != iso, countries[‘ISO’]) country = ma.array(countries[‘country’],mask=mask.mask).compressed()[0] by using the built-in numpy.where method: import numpy as np index =…

## Don’t be scared …

Don’t be scared, you are on geophysique.be ! I’m just trying some new themes for this blog/website. I want to make it more readable, but also easier to search/scroll. I kinda like this “eos” theme, the “content” column is nice…

## Matplotlib Basemap tutorial 06: Real Case pie charts

Here is a new tutorial that will include “a bit of all” tutorials previously published on this blog and some new cool stuff to play with ! Idea: Find some resources on the Internet and plot them on the map…

## Matplotlib Basemap tutorial 05 : Adding some pie charts !

Hi folkes, Following a question by Gui on this website, I checked the “how to” draw pie charts on a basemap plot ! Here below I generalise the example given by Manuel Metz on the matplotlib website. The idea is…

## Pack an Enthought Traits app inside a .exe using py2exe !

[DEPRECATED if you use ETS 4.0 — see the new version] So, guys, today is a great day, BIG news : I succeeded packaging an Enthought Traits UI script inside a standalone package. Keys to remember: To get things to…

## Update to ETS 3.5.0 !

Great news from last week : ETS 3.5.0 is out ! Note the change in the source-download process.. Now using an unique ets.py file instead of the ProjectTools ! http://blog.enthought.com/open-source/enthought-tool-suite-3-5-0-released/ http://www.optiniche.com/blog/117/wordpress-trackback-tutorial/

## Matplotlib Basemap tutorial 04 : using inside_poly() to select data !

# remember to define the ax instance : ax = plt.subplot(111) zone = “Roetgen – Monschau” x,y = m(6.15,50.41) x2,y2 = m(6.59,50.67) x3,y3 = m(6.34,50.855) x4,y4 = m(5.83,50.65) data = np.array(([x,x2,x3,x4], [y,y2,y3,y4])) p = Polygon(data.T,edgecolor=’red’,linewidth=1.5,facecolor=’none’) ax.add_artist(p) Note that we have…

## Earthquake | Séisme | Erdbeben : Frankfurt (Hofheim am Taunus)

During the night, an earthquake struck the vicinity of Hofheim am Taunus. If you felt this earthquake, please fill in the inquiry on the “Royal Obseravtory of Belgium | University of Cologne” website : Link = http://seismologie.oma.be/

## Matplotlib Basemap tutorial 03 : Masked arrays & Zoom

Here, we will focus on adding a “zoom box” on the top left corner of the plot. But before that, we will mask a part of the earthquakes, in order to have a “cleaner” map ! This is achieved by…

## Matplotlib Basemap tutorial 02 : Let’s add some earthquakes !

Now, let’s imagine we have a dataset containing latitude/longitudes of earthquakes, plus their depth and magnitude. Of course, you don’t always have this dataset available, so let’s build a fake one : import numpy as np lon = np.random.random_integers(11,79,1000)/10. lat…

## Matplotlib Basemap tutorial 01 : Your first map

# # BaseMap example by geophysique.be # tutorial 01 from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np fig = plt.figure(figsize=(11.7,8.3)) #Custom adjust of the subplots plt.subplots_adjust(left=0.05,right=0.95,top=0.90,bottom=0.05,wspace=0.15,hspace=0.05) ax = plt.subplot(111) #Let’s create a basemap around Belgium m…

## Installing EPD on Windows 7 (64bits)

I finally managed to install Enthought Python Distribution on my Windows 7 64bit box. In fact, I installed EPD 32bits (I’m a student, the academic licence is free). So, the solution was in the Mailing List Archive (enthought-dev) : Disable…

## Resistivity Data Inversion – Use R2 !

Tired of using Res2Dinv ? Why not switching to another software, and… FREE ! Andrew Binley provides some excellent programs on his website. I have created some python scripts for easing the I/O to R2. These scripts will soon be…

## Stop using griddata, use matplotlib.mlab.griddata !

I just discovered that I was using from griddata import griddata in quite a lot of python scripts I wrote for scientific data plotting. While struggling to recompile it under my new win7 x64 box, I googled a little and…

## Bonjour tout le monde !

Premier billet de “Géophysique.be”, où je publierai des informations en relation avec la Géophysique, les méthodes de prospection, leur théorie, des exemples de codes informatiques de traitement de données scientifiques, … Un premier code python pour démarrer : print “Hello…