Download source and data
Cross Section with Orography 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 fs = read(source : "fc_ml.grib") # read temperature and scale it to C t = read(data : fs, param : "t") t = t - 273.16 # read wind components and compute speed u = read(data : fs, param : "u") v = read(data : fs, param : "v") sp = sqrt(u*u + v*v) # read log of surface pressure lnsp = read(data : fs, param : "lnsp") # define cross section line line = [41,-2,78,32] # define shading for wind speed sp_cont = mcont(legend : "on", contour_automatics_settings : "style_name", contour_style_name : "sh_red_f5t70lst") # define contouring for temperature t_cont = mcont( contour_line_style : "dash", contour_line_thickness : 2, contour_line_colour : "charcoal", contour_highlight : "off", contour_level_selection_type : "interval", contour_interval : 5 ) # define cross section in log pressure from surface up to 80 hPa xs_view = mxsectview( line : line, top_level : 80, vertical_scaling : "log" ) # define orography area orog_graph = mgraph( graph_type : "area", graph_shade_colour : "charcoal" ) # define the output plot file setoutput(pdf_output(output_name : 'cross_section_orog')) # generate plot plot(xs_view, sp & lnsp, sp_cont, t & lnsp, t_cont, orog_graph)
Cross Section with Orography 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 fs = mv.read(source="fc_ml.grib") # read temperature and scale it to C t = mv.read(data = fs, param = "t") t = t - 273.16 # read wind components and compute speed u = mv.read(data = fs, param = "u") v = mv.read(data = fs, param = "v") sp = mv.sqrt(u*u + v*v) # read log of surface pressure lnsp = mv.read(data = fs, param = "lnsp") # define cross section line line = [41,-2,78,32] # define shading for wind speed sp_cont = mv.mcont(legend= "on", contour_automatics_settings = "style_name", contour_style_name = "sh_red_f5t70lst") # define contouring for temperature t_cont = mv.mcont( contour_line_style = "dash", contour_line_thickness = 2, contour_line_colour = "charcoal", contour_highlight = "off", contour_level_selection_type = "interval", contour_interval = 5 ) # define cross section in log pressure from surface up to 80 hPa xs_view = mv.mxsectview( line = line, top_level = 80, vertical_scaling = "log" ) # define orography area orog_graph = mv.mgraph( graph_type = "area", graph_shade_colour = "charcoal", ) # define cross section data (field + lnsp) xs_t_data = mv.merge(t,lnsp) xs_sp_data = mv.merge(sp,lnsp) # define the output plot file mv.setoutput(mv.pdf_output(output_name = 'cross_section_orog')) # generate plot mv.plot(xs_view, xs_sp_data,sp_cont, xs_t_data,t_cont, orog_graph)