source: trunk/UTIL/PYTHON/planetoplot_v2/examples/easy_get_field.py @ 930

Last change on this file since 930 was 930, checked in by aslmd, 12 years ago

UTIL PYTHON planetoplot_v2. Added attribute allfield so that the user can easily access values. See examples/easy_get_field.py. Added attribute includedate to select option for naming files. Corrected index bug in meanarea mode. Added an example intercompare.py which shows how to easily compare results in two quite different netCDF files.

  • Property svn:executable set to *
File size: 939 bytes
Line 
1#! /usr/bin/env python
2from ppclass import pp
3import numpy as np
4import matplotlib.pyplot as mpl
5
6test = pp()
7test.file = [ \
8  "/planeto/jllmd/Earth/Nmix/F1525/output/diagfi4.nc", \
9  "/planeto/jllmd/Earth/Nmix/F1550/output/diagfi4.nc", \
10  "/planeto/jllmd/Earth/Nmix/F1500/output/diagfi4.nc" ]
11test.var = ["tsurf","ASR"]
12test.x = "-180.,175."
13test.y = "-90.,90."
14test.t = "0,1000"
15#test.verbose = True
16test.compute = "meanarea"
17test.get()
18
19# -----------------------------
20# self.allfield contains data !
21# -----------------------------
22# index ordering:
23# - file
24# - var
25# - request t
26# - request z
27# - request y
28# - request x
29# - field dimensions
30# -----------------------------
31# ALL DIM == 1 HAVE BEEN SQUEEZED
32# -----------------------------
33
34# for instance here, shape of allfield is (3,2)
35# because the user requested 3 files, 2 vars, 0D values
36
37tsurf = test.allfield[:,0]
38asr = test.allfield[:,1]
39
40mpl.plot(tsurf,asr)
41mpl.show()
Note: See TracBrowser for help on using the repository browser.