background preloader

Python

Facebook Twitter

The key differences between Python 2.7.x and Python 3.x with examples | Spartan Ideas. Primary Source: Sebastian Raschka Many beginning Python users are wondering with which version of Python they should start. My answer to this question is usually something along the lines “just go with the version your favorite tutorial was written in, and check out the differences later on.” But what if you are starting a new project and have the choice to pick?

In my opinion, there is no “right” or “wrong” as long as both Python 2.7.x and Python 3.x support the libraries that you are planning to use. However, it is worthwhile to have a look at the major differences between those two most popular versions of Python to avoid common pitfalls when writing the code for either one of them, or if you are planning to port your project. Sections An IPython Notebook for this article can be found here Input code will be shown with Python syntax highlighting, and the output after execution in blue. The __future__ module (Source: The print function Python 2. Introduction au module Tkinter de python 2.5. Apprendre à programmer avec Python. Jusqu'à présent, nous avons utilisé Python exclusivement « en mode texte ». Nous avons procédé ainsi parce qu'il nous fallait absolument d'abord dégager un certain nombre de concepts élémentaires ainsi que la structure de base du langage, avant d'envisager des expériences impliquant des objets informatiques plus élaborés (fenêtres, images, sons, etc.).

Nous pouvons à présent nous permettre une petite incursion dans le vaste domaine des interfaces graphiques, mais ce ne sera qu'un premier amuse-gueule : il nous reste en effet encore bien des choses fondamentales à apprendre, et pour nombre d'entre elles l'approche textuelle reste la plus abordable. 8.1. Interfaces graphiques (GUI)▲ Si vous ne le saviez pas encore, apprenez dès à présent que le domaine des interfaces graphiques (ou GUI : Graphical User Interface) est extrêmement complexe. 8.2. Pour la suite des explications, nous supposerons bien évidemment que le module Tkinter a déjà été installé sur votre système. 8.3. 8.3.1. 8.1. 8.2.

GIT IT Jacques Grelet. Plot in 3d using python. Plot in 3d using python. Getting started An Axes3D object is created just like any other axes using the projection=‘3d’ keyword. Create a new matplotlib.figure.Figure and add a new axes to it of type Axes3D: import matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dfig = plt.figure()ax = fig.add_subplot(111, projection='3d') New in version 1.0.0: This approach is the preferred method of creating a 3D axes.

Note Prior to version 1.0.0, the method of creating a 3D axes was different. Line plots Axes3D.plot(xs, ys, *args, **kwargs) Plot 2D or 3D data. Other arguments are passed on to plot() (Source code, png, hires.png, pdf) Scatter plots Axes3D.scatter(xs, ys, zs=0, zdir='z', s=20, c='b', *args, **kwargs) Create a scatter plot. Keyword arguments are passed on to scatter(). Returns a Patch3DCollection (Source code, png, hires.png, pdf) Wireframe plots Axes3D.plot_wireframe(X, Y, Z, *args, **kwargs) Plot a 3D wireframe. Keyword arguments are passed on to LineCollection. Returns a Line3DCollection Surface plots Examples: Text. Nemo codes... some details. The following sequence of command should result in a complete and functionnal installation. Define the following alias to use SVNalias svn_ano='svn co modipsl'Create and go to the working directory mkdir TRY ; cd TRY Extract modipslsvn_ano Extract NEMOcd modipsl/util. /model NEMOChoose a configuration.. /modeles/UTIL/fait_config "CONFIG_NAME" with "CONFIG_NAME"=ORCA2_LIM (or GYRE)Install the makefilesins_make [ -t "target host" ]Compilecd ..

/config/ORCA2_LIM [or GYRE]gmakeCreate a script../.. /util/ins_script [-t "target host" ]Your executable should be in ../.. cd EXP00 ; qsub Job_LO1 Compiling NEMO on Darwin 9.7.0: GYRE experiment Hereafter is my workflow to get running the GYRE experiment as a starter. After downloading the code (svn_ano), I go under modipsl/util and run:. My first problem was that I didn't have the netcdf.mod file. After retyping gmake, libraries are being created. (cd ../.. Another problem was about the CPP keys. cd util. Titaud personnal webpage. Olivier Titaud - Professional web page "Observation operators based on Lagrangian Coherent Structures for the assimilation of ocean tracer images ", GlobCurrent 2012, Brest, France, 07-09 March 2012 co-authors: J.

-M. Brankart, J. Verron "On the use of Lagrangian Coherent Structures in direct assimilation of ocean tracer images", The Ninth International Workshop on Adjoint Model Applications in Dynamic Meteorology, Cefalù, Sicily, Italia, 10–14 October 2011 (annotated slides) co-authors: A. Vidard, I. Matplotlib Examples — Matplotlib v0.99.1.1 documentation.