source: qesdi/geoplot/trunk/README @ 5403

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/geoplot/trunk/README@5403
Revision 5403, 4.8 KB checked in by pnorton, 12 years ago (diff)

Moved QESDI tree from DCIP repository
 http://proj.badc.rl.ac.uk/svn/dcip/qesdi@3900.

Line 
1= Installation =
2
3Geoplot now uses setuptools as it's distribution framework.  This changes the
4way it is deployed and how the development environment is configured.
5
6== Developing ==
7
8 1. Make sure setuptools is installed on your system.  If you have the easy_install command available, it is.
9 1. Build the package info file (lib/geoplot.egg-info).
10    {{{
11    $ python setup.py egg_info
12    }}}
13 1. As superuser run the {{{setup.py develop}}} command from the geoplot sandbox:
14    {{{
15    $ sudo python setup.py develop
16    }}}
17
18geoplot from your development sandbox should now always be importable without setting $PYTHONPATH.
19
20== Deploying ==
21
22 1. Make sure setuptools is installed on your development and deployment system.  If you have the easy_install command available, it is.
23 1. Build the egg of the package.
24    {{{
25    $ python setup.py bdist_egg
26    }}}
27 1. Install the egg (in the dist directory) into the python interpreter you
28    want to deploy into
29    {{{
30    $ easy_install <path-to-egg>
31    }}}
32
33
34= Testing =
35
36Tests should be designed to be discovered by the nose test discovery
37tool (http://www.somethingaboutorange.com/mrl/projects/nose/).  See
38the nose documentation for how tests are discovered.  Tests can be run
39in several ways:
40
41 1. Via {{{setup.py}}}
42    {{{
43    $ python setup.py test
44    }}}
45
46 1. Via {{{nosetests}}}
47    {{{
48    $ nosetests [test-module/file/class]
49    }}}
50
51 1. Executing individual test modules
52    {{{
53    $ python lib/geoplot/tests/acceptance/test_rotated_grid.py
54    }}}
55    This last method relies on a little magic at the bottom of each
56    test module:
57    {{{#!python
58    if __name__ == '__main__':
59        import nose
60        nose.main()
61    }}}
62
63= Examples =
64
65The three plotting classes are
66from geoplot.plot_lat_lon import PlotLatLon             # to plot latitude/longitude grids
67
68from geoplot.plot_national_grid import PlotNationalGrid # to plot British National Grid
69                                                        # (eastings/northings) grids.
70
71from geoplot.plot_rotated_grid import PlotRotatedGrid   # to plot rotated pole lat/lon grids
72
73#plot the cdms variable var containing a lat lon grid
74pll = PlotLatLon(var)
75pll.drawMap('output.png')   #draw the output to the file 'output.png'
76
77#plot the cdms variable var containing a national grid
78# output as 'jpg', draw grid values, use the medium size of font, units are 'degrees C'
79# the plot title is 'A Test Plot',
80#the limits of the plot are between -1 and 5 degrees longitude and 52 and 54 degrees latitude.
81png = PlotNationalGrid(var, format='jpg', drawValues=True,
82                         fontSize="medium", units="degrees C",
83                         plotTitle="A Test Plot",
84                         xLimits=(-1.0, 0.5), yLimits=(52.0, 54.0),
85
86png.drawmap('output.jpg') #draw the output to the file 'output.jpg'
87
88
89#create a list of key-value pairs for metadata
90eg_metadata_list = [("Dataset", "MOHC Probabilistic Land"),
91                    ("Variable", "Mean Temperature"),
92                    ("Emissions Scenario", "Medium (A1B)")]
93
94#plot cmds variable var containing a rotated lat-lon grid,
95#rotated_pole_var is a cmds variable that contains the details of the rotated pole
96#set the metadata to the eg_metadata_list
97#dont draw a colour bar
98prg = PlotRotatedGrid(var, rotated_pole_var, metadataList = eg_metadata_list,
99                      drawColourBar = False)
100
101= Overview =
102
103We require 4 plot types, 3 of which all implement the interface
104described in iface.py:
105
106 - PlotLatLon() - plot a cdms variable defined on a latitude/longitude grid.
107 - PlotRotatedPole() - plot a cdms variable defined on a rotated pole lat/lon grid.
108 - PlotBNG() - plot a cdms variable defined on British National Grid eastings/northings.
109
110The final plot type is a generic boxplot function (!TODO: more detail)
111
112These Plot classes relate to the INPUT geophysical representation.
113However, each plot might have different output physical format (png,
114ps, pdf or jpg) and one of 3 different coordinate reference system
115(lat/lon, Google or BNG)
116
117= Todo list of how we build geoplot from the current scripts =
118
119 1. Concentrate on PlotRotatedPole first, using test_rotgrid.py as a template
120 2. Some arguments can be supported by small changes to rotgrid_grid_plot.py and can be implemented in the first iteration.  These are:
121    - cdmsVar (obviously)
122    - format
123    - height
124    - width
125    - dpi
126    - drawColourbar
127    - minValue
128    - maxValue
129    - drawLogo
130    - drawCoast
131    - drawRivers
132    - metadata
133    - xLimits
134    - yLimits
135    - cmap
136 3. Other arguments should be replaced by defaults:
137    - projection: assume BNG for now
138    - printColours: This is a separate task to implement RGB -> CMYK mapping
139          in postscript output.
140    - colourbarPosition: Probably trivial but doesn't need to be done
141      initially.
142    - fontSize: We need more detail of what our requirements are.
Note: See TracBrowser for help on using the repository browser.