Download source and data
Hovmoeller Area Average Example
# Metview Macro # **************************** LICENSE START *********************************** # # Copyright 2018 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 ************************************ # ---------------------------------------------------------------------- # Description: Demonstrates how to use a Hovmoeller View to # compute and plot an area average over time from GRIB data # ---------------------------------------------------------------------- # read the GRIB data from file t_ts = read("t_ts.grib") # set up the view to plot the data into # we will compute the average value along North/South lines over the # given area. We also supply a custom Time Axis definition in order # to increase the size of the date labels time_axis = maxis( axis_type : "date", axis_years_label_height : 0.3, axis_months_label_height : 0.3, axis_days_label_height : 0.3 ) hovmoeller_view = mhovmoellerview( type : "area_hovm", area : [53.4,-58.9,67.2,118.1], average_direction : "north_south", time_axis : time_axis ) # set up the contouring style shade = mcont( legend : "on", contour : "off", contour_level_count : 8, contour_label : "off", contour_shade : "on", contour_shade_colour_method : "list", contour_shade_method : "area_fill", contour_shade_colour_list : ["blue", "sky", "blue_green", "grey", "cream", "yellowish_orange", "reddish_orange", "red"] ) # set up the title, just to make the font bigger title = mtext( text_font_size : 0.5 ) # define the output plot file setoutput(pdf_output(output_name : 'hovmoeller_area')) # plot the data into the Hovmoeller view with visdefs for styling plot(hovmoeller_view, t_ts, shade, title)
Hovmoeller Area Average Example
# Metview Example # **************************** LICENSE START *********************************** # # Copyright 2018 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 ************************************ # ---------------------------------------------------------------------- # Description: Demonstrates how to use a Hovmoeller View to # compute and plot an area average over time from GRIB data # ---------------------------------------------------------------------- import metview as mv # read the GRIB data from file t_ts = mv.read("t_ts.grib") # set up the view to plot the data into # we will compute the average value along North/South lines over the # given area. We also supply a custom Time Axis definition in order # to increase the size of the date labels time_axis = mv.maxis( axis_type = "date", axis_years_label_height = 0.3, axis_months_label_height = 0.3, axis_days_label_height = 0.3 ) hovmoeller_view = mv.mhovmoellerview( type = "area_hovm", area = [53.4,-58.9,67.2,118.1], average_direction = "north_south", time_axis = time_axis ) # set up the contouring style shade = mv.mcont( legend = "on", contour = "off", contour_level_count = 8, contour_label = "off", contour_shade = "on", contour_shade_colour_method = "list", contour_shade_method = "area_fill", contour_shade_colour_list = ["blue", "sky", "blue_green", "grey", "cream", "yellowish_orange", "reddish_orange", "red"] ) # set up the title, just to make the font bigger title = mv.mtext( text_font_size = 0.5 ) # define the output plot file mv.setoutput(mv.pdf_output(output_name = 'hovmoeller_area')) # plot the data into the Hovmoeller view with visdefs for styling mv.plot(hovmoeller_view, t_ts, shade, title)