source: trunk/UTIL/PYTHON/planetoplot_v2/examples/ppclass_additional/maskradius.py @ 1192

Last change on this file since 1192 was 1176, checked in by aslmd, 11 years ago

planetoplot. added an example script for movie. added an example script for masking.

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#! /usr/bin/env python
2from ppclass import pp
3import numpy as np
4
5# settings
6fi = ["nest1_rad.nc","nest2_rad.nc","nest3_rad.nc"]
7limvmr=5.0
8
9# get radius
10rad=pp()
11rad.file=fi
12rad.var=["RICE","VMR_ICE"]
13rad.vargoal=["main","contour"]
14rad.x=-120.
15rad.t=4
16rad.changetime = "mars_meso_lt"
17rad.verbose = True
18rad.filename = "radius"
19rad.out = "png"
20rad.includedate = False
21rad.get()
22
23# radius in microns
24rad = rad*1.e6
25rad.units = "$\mu$m"
26rad.fmt = "%.0f"
27
28# define plot
29rad.defineplot()
30
31# loop on all plots
32for plotobj in rad.p:
33    # mask plotted field with contoured field
34    plotobj.f[np.where(plotobj.c<limvmr)]=np.nan
35    # a few plot settings
36    # (some of them could have been actually set globally in rad object)
37    plotobj.vmin = 0.
38    plotobj.vmax = 10.
39    plotobj.div = 20
40    plotobj.xmin = 12.
41    plotobj.xmax = 16.
42    plotobj.colorbar = "spectral"
43    plotobj.ycoeff = 1.e-3
44    plotobj.ylabel = "Altitude above MOLA zero areoid (km)"
45    plotobj.xlabel = 'Latitude ($^{\circ}$N)'
46    plotobj.nxticks = 4
47
48# set different titles
49rad.p[0].title = "Ice radius. Nest 1."
50rad.p[1].title = "Ice radius. Nest 2."
51rad.p[2].title = "Ice radius. Nest 3."
52
53
54# make final plot
55rad.makeplot()
Note: See TracBrowser for help on using the repository browser.