source: qesdi/geoplot/trunk/lib/geoplot/tests/drawing/draw_test_grid_plot.py @ 5890

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/geoplot/trunk/lib/geoplot/tests/drawing/draw_test_grid_plot.py@5890
Revision 5890, 2.7 KB checked in by pnorton, 11 years ago (diff)

Fixed a problem with the subsetting in the grid_builder_lat_lon_subset.py file.

Line 
1import os
2import logging
3
4import geoplot
5from geoplot.tests.make_data_functions import fnSinXAddCosY_10to10
6from geoplot.layer_drawer_grid_fast import LayerDrawerGridFast
7log = logging.getLogger(__name__)
8       
9
10if __name__ == '__main__':
11
12    from geoplot.tests.drawing import getDrawingOutputDir
13    from geoplot.log_util import SHORT_LOG_FORMAT_STRING, LOG_FORMAT_STRING
14    logging.basicConfig(level=logging.DEBUG, format=SHORT_LOG_FORMAT_STRING)
15   
16    outputDir = getDrawingOutputDir()
17   
18    from geoplot.grid_plot import GridPlot
19    from geoplot.tests.make_ll_grid_data import makeLLVar
20
21    plot_format = 'png'
22    outputFile = outputDir + '/grid_plot_lat_lon.' + plot_format
23
24    eg_metadata_list = [("Dataset", "MOHC Probabilistic Land"),
25                        ("Variable", "Mean Temperature"),
26                        ("Emissions Scenario", "Medium (A1B)"),
27                        ("Time Slice", "2040-2079"),
28                        ("Temporal Av. Period", "Spring"),
29                        ("Percentile", "10th")]
30
31    # show the whole grid
32    #xLimits=(-13.0, 6.2), yLimits=(47.0, 61.0)
33    # show the whole of the uk
34    #xLimits=(-11.0, 2.8), yLimits=(48.0, 60.0)
35    #xLimits=( -2.0,   2.0), yLimits=( 50.0, 54.0),
36    #xLimits=(  0.0, 359.8), yLimits=(-90.0, 89.8),
37    xLimits=(-20.0,  15.0); yLimits=( 40.0, 70.0)
38    #xLimits=( -7.0,   2.0), yLimits=( 54.0, 64.0)  scotland
39    #xLimits=( -8.0,   1.0), yLimits=( 52.0, 64.0) ,
40
41    #var = makeLLVar(lonBounds=xLimits, latBounds=yLimits, nx=20, ny=20)
42   
43    var = makeLLVar(lonBounds=xLimits, latBounds=yLimits, nx=12, ny=50, 
44                    function=fnSinXAddCosY_10to10, missing_value=-999,
45                    axisOrder='xy')
46
47    plot =  GridPlot(cdmsVar=var, format = plot_format,
48                    fontSize = 'medium', units = 'A Test Plot',
49                    plotTitle = "A Test Plot", showGridLines = True,
50                    drawLogo = True, metadataList = eg_metadata_list,
51                    drawCoast = True, drawRivers = False,
52                    drawColourBar = True, drawValues = False,
53                    xLimits=xLimits, yLimits=yLimits,
54                    colourBarPosition='vertical',
55                    intervals="-10,-7.5,-5,-2.5,0,2.5,5,7.5,10",
56                    #intervalNames=','.join(list('abcdefgh'))
57                   
58                    #intervalNames=','.join(list('abcdefghijklmnopqrst'))
59                    )
60
61    plot.drawMap(outputFile)
62   
63    log.debug('wrote %s' % outputFile)
64   
65    outputFile = outputDir + '/layer_drawer_plot_lat_lon.' + plot_format
66    fld = LayerDrawerGridFast(var)
67    img = fld.makeImage(xLimits, yLimits, 600, 900)
68    img.save(outputFile)
69    log.debug('wrote %s' % outputFile)
70   
Note: See TracBrowser for help on using the repository browser.