# Metview Macro
# **************************** LICENSE START ***********************************
#
# Copyright 2020 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 the GRIB data into a fieldset
g = read('ozone_pl.grib')
# extract the values at a point, and the vertical levels
levels = grib_get_double(g, 'level')
ozone = nearest_gridpoint(g, [-85, 0])
# define curve
vis_curve = input_visualiser(input_x_values: ozone, input_y_values: levels)
# define curve style
gr_curve = mgraph(
graph_type: "curve", graph_line_colour: "coral", graph_line_thickness: 4
)
# define a nice title for the x axis
x_title = grib_get_string(g[1], "name") & " in " & grib_get_string(g[1], "units")
x_axis = maxis(axis_title_text: x_title)
# define y axis title
y_title = "Pressure in hPa"
y_axis = maxis(axis_title_text: y_title)
# define view, setting a log y axis
view = cartesianview(x_automatic: "off",
x_min: 0,
x_max: maxvalue(vector(ozone)),
y_automatic: "on",
y_axis_type: "logarithmic",
horizontal_axis: x_axis,
vertical_axis: y_axis)
# define the output plot file
setoutput(pdf_output(output_name: "cartesian_log_y_axis"))
# generate plot
plot(view, vis_curve, gr_curve)
|