Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  • a horizontal regular axis for a temperature range going from -60oC to 20oC.
  • a vertical logarithmic axis going from 1020 hPa to 10 hPa

Have a look at the Subpage Documentation and at the Axis Plotting Documentation, and try to get the 0oC grid line highlighted.

...

We want to plot these winds as red falgs flags on the vertical of -20.

The mgraph object can then be used to  to preform the visualisation. All the parameters can be found in the Graph Plotting Page.

Do not forget the to add a legend with a some meaningful text!

Section
Column
width50%
Info
titleParameters to check

 


 

Useful input parameters

input_x_values

input_y_values
input_x_component_values
input_y_component_values
Useful graph parameters
graph_type
graph_flag_colour
graph_flag_length
legend
legend_user_text
Code Block
themeConfluence
languagepython
titlePython - Input data and Flags plotting
collapsetrue
# importing Magics module
from Magics.macro import *
# define the output
output = output(output_formats=['png'],
        output_name_first_page_number='off',
        output_name="profile_step2")
projection = mmap(
    subpage_map_projection='cartesian',
    subpage_x_axis_type='regular',
    subpage_y_axis_type='logarithmic',   
    subpage_x_min=-70.,
    subpage_x_max=20.,
    subpage_y_min=1020.,
    subpage_y_max=10.,)
#define the vertical axis
vertical = maxis(
    axis_orientation='vertical',
    axis_grid='on',
    axis_type='logarithmic',
    axis_tick_label_height=0.4,
    axis_tick_label_colour='charcoal',
    axis_grid_colour='charcoal',
    axis_grid_line_style='dash',
    axis_title='on',
    axis_title_text='Pressure',
    axis_title_font='arial',
    axis_title_font_style='bold',
    axis_title_height=1.,
    )
# define the horizontal axis
horizontal = maxis(
    axis_orientation='horizontal',
    axis_type='regular',
    axis_tick_label_height=0.4,
    axis_tick_label_colour='charcoal',
    axis_grid='on',
    axis_grid_colour='charcoal',
    axis_grid_thickness=1,
    axis_grid_reference_level=0.,
    axis_grid_reference_line_style='solid',
    axis_grid_reference_thickness=1,
    axis_grid_line_style='dash',)
levels = [1.,2.,3,5,7,10,20,30,50,70,100,150,200,250,300,400,500,600,700,800,850,900,925,950,1000]
kelvin = numpy.array([263.118652344,254.822738647,242.517868042,223.301025391,219.254943848,216.710174561,216.507095337,
    215.398986816,211.643295288,207.18812561,207.172134399,217.097396851,
    223.809326172,235.13168335,243.377059937,260.635147095,272.02935791,
    272.145584106,273.448501587,279.562927246,281.745040894,285.503082275,287.543685913,289.284072876,292.170974731]) 
celsius = kelvin -273.16
# Define the input of the graph
data = minput(input_x_values = celsius,
        input_y_values = levels, )
#define the graph action.
graph = mgraph( legend='on' ,
( legend='on' ,
            legend_user_text= 'Tempe', 
            graph_line_colour="navy", 
            graph_line_thickness= 3, )
#define the input for the wind plotting
wind_position = [-20.] * len(levels)
u_component = [77.815612793,63.232711792,44.9090881348,28.2789916992,17.401763916,
    11.8307037354,-0.725036621094,-4.75889587402,-7.83796691895,-3.76489257812,
    -6.18388366699,-13.1139526367,-13.05027771,-15.1851959229,-23.5844726562,
    -27.866394043,-33.0458984375,-45.8946380615,-41.540222168,-39.6210327148,
    -37.6231689453,-32.947265625,-29.4743499756,-22.0828552246,-10.0008392334]
v_component = [7.38911437988,5.23355102539,0.636322021484,-3.75567626953,
    0.167388916016,-3.12893676758,-3.60003662109,0.0688171386719,
    0.305236816406,7.06889343262,8.10516357422,11.1141815186,
    -2.29931640625,3.08065795898,7.5965423584,11.0112915039,
    13.6437530518,11.2753143311,11.1552124023,13.1494903564,
    6.01538085938,1.37588500977,-0.0724334716797,-0.953598022461,-0.508377075195]
wind = minput(
        input_y_component_values = v_component,
        input_x_values = wind_position,
        input_x_component_values = u_component,
        input_y_values = levels)
#define wind plotting
flags = mgraph(graph_type = "flag",
        graph_flag_colour = "red",
    legend_user_text= 'Tempe', 
  legend = "on",
        graph_lineflag_colour="navy", length = 1.00,
            graph_line_thickness= 3, )
    
plotlegend_user_text = " Wind ")

 plot(output, projection, vertical, horizontal, data, graph, wind, flags)
Column
width200px

 

 

Time Series: Setting the Cartesian Projection for the Mean Sea Level Pressure time series

...

  • a horizontal date axis going from the 2012-10-27at  00:00:00 to 2012-11-02 12:00:00
  • a vertical regular axis  going from 950 hPa to 1005 1050 hPa

Have a look at the Subpage Documentation and at the Axis Plotting Documentation,

...

This information need to be given to Magics . This can be done with the mtable data action,. See the full documentation.

The mgraph action will the then be used to define the curev curve attributes. All the parameters can be found in the Graph Plotting Page.

...

We will perhaps need to check quickly

...

Section
Column
width50%
Info
titleParameters to check

 


 

Useful page parameters

layout

page_x_position
page_y_position
page_x_length
page_y_length
subpage_x_position
subpage_y_position
subpage_x_length
subpage_y_length
page_id_line
page_frame
Code Block
themeConfluence
languagepython
titlePython - complex layout
collapsetrue
# importing Magics module
from Magics.macro import *
from profile import profile
from timeserie import msl_timeserie
from timeserie import precip_timeserie
#Setting the output
output = output(output_name = 'layout', 
                output_formats = ["png"],
                output_name_first_page_number = "off")
profile_left = page(
        layout='positional',
        page_frame='off', 
        page_x_length=15., 
        page_id_line='off',
        subpage_y_length=17.,
        )
        
graph_bottom = page(
        layout='positional',
        page_frame='off', 
        page_x_length=15., 
        page_y_length= 10., 
        page_id_line='off',
        page_x_position=15., 
        page_y_position=0.5,
        subpage_x_position=1.5,
        subpage_y_position=0.5,
        subpage_y_length=7.,
        )
        
graph_top = page(
        layout='positional',
        page_frame='off', 
        page_x_length=15., 
        page_y_length=10., 
        page_id_line='off',
        page_x_position=15.,
        page_y_position=10.5, 
        subpage_x_position=1.5,
        subpage_y_position=0.5,    
        subpage_y_length=7.,
        )
plot(output, 
    profile_left, profile(title_size=0.6),
    graph_bottom, msl_timeserie(title_size=0.6),
    graph_top, precip_timeserie(title_size=0.6),
    )
Column
width200px

Go to the next step...

Go to to the Main Magics Tutorial page...