Metview's documentation is now on readthedocs!

Download source and data


Cross Section 3D Parallel Wind Component Example
#Metview Macro

#  **************************** LICENSE START ***********************************
#
#  Copyright 2019 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
#
#  ***************************** LICENSE END ************************************
#
 
# read grib file - contains model level data with u, v, w, t and lnsp
fs = read("joachim_ml.grib")
 
# define cross section line
line = [48.32, 1.18, 40.43, 2.44]
  
# define vertical axis
vertical_axis = maxis(
    axis_orientation        : "vertical",
    axis_type               : "position_list",
    axis_tick_position_list : [1000,925,850,700,500,400,300,250],
    axis_tick_label_height: 0.4
    )  
  
# define cross section for 3D wind projected onto the cross section
# plane 
# - log pressure axis from 1015 to 250 hPa
# - the vertical velocity in m/s is computed from w (=omega),
#   then an additional scaling is applied to it (defined via w_wind_scaling_factor)     
xs_view = mxsectview(
  line : line,
  wind_parallel:    "on",
  w_wind_scaling_factor_mode:   "compute",
  w_wind_scaling_factor:   "50",
  bottom_level : 1015,
  top_level : 250,
  vertical_scaling : "log",
  vertical_axis: vertical_axis
)
 
# define wind plotting
wind_plotting = mwind(
    wind_arrow_colour : "purplish_blue"
    )

# define orography area
orog_graph = mgraph(
    graph_type          : "area",
    graph_shade_colour  : "charcoal"
)
 
# define title
title = mtext(text_lines: ["3D wind projected onto cross section plane"],
              text_font_size : 0.4
)
 
# define the output plot file
setoutput(pdf_output(output_name : 'cross_section_wind_3d'))
 
# generate plot
plot(xs_view, fs, wind_plotting, orog_graph, title)
Cross Section 3D Parallel Wind Component Example
#  **************************** LICENSE START ***********************************
#
#  Copyright 2019 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
#
#  ***************************** LICENSE END ************************************
#
 
import metview as mv
 
# read grib file - contains model level data with u, v, w, t and lnsp
fs = mv.read("joachim_ml.grib")
 
# define cross section line
line = [48.32, 1.18, 40.43, 2.44]
  
# define vertical axis
vertical_axis = mv.maxis(
    axis_orientation        = "vertical",
    axis_type               = "position_list",
    axis_tick_position_list = [1000,925,850,700,500,400,300,250],
    axis_tick_label_height= 0.4
    )  
  
# define cross section for 3D wind projected onto the cross section
# plane 
# - log pressure axis from 1015 to 250 hPa
# - the vertical velocity in m/s is computed from w (=omega),
#   then an additional scaling is applied to it (defined via w_wind_scaling_factor)     
xs_view = mv.mxsectview(
  line = line,
  wind_parallel=    "on",
  w_wind_scaling_factor_mode=   "compute",
  w_wind_scaling_factor=   "50",
  bottom_level = 1015,
  top_level = 250,
  vertical_scaling = "log",
  vertical_axis= vertical_axis
)
 
# define wind plotting
wind_plotting = mv.mwind(
    wind_arrow_colour = "purplish_blue"
    )

# define orography area
orog_graph = mv.mgraph(
    graph_type          = "area",
    graph_shade_colour  = "charcoal"
)
 
# define title
title = mv.mtext(text_lines= ["3D wind projected onto cross section plane"],
              text_font_size = 0.4
)
 
# define the output plot file
mv.setoutput(mv.pdf_output(output_name = 'cross_section_wind_3d'))
 
# generate plot
mv.plot(xs_view, fs, wind_plotting, orog_graph, title)