Exemple #1
0
    def build_stamp(self, page_num=0, layout="", view=None):

        if True:
            coast_empty = mv.mcoast(
                map_coastline="off", map_grid="off", map_label="off"
            )

            empty_view = mv.geoview(
                page_frame="off",
                subpage_frame="off",
                coastlines=coast_empty,
                subpage_x_position=40,
                subpage_x_length=10,
                subpage_y_length=10,
            )

            title_page = mv.plot_page(
                top=0, bottom=5, left=30, right=70, view=empty_view
            )

        r, c = self._grid_row_col(page_num=page_num, layout=layout)

        pages = mv.mvl_regular_layout(view, c, r, 1, 1, [5, 100, 15, 100])
        pages.append(title_page)
        return mv.plot_superpage(pages=pages)
Exemple #2
0
def test_definitions():
    mcont_def = mv.mcont({'legend': True})
    msymb_def = mv.msymb({'symbol_type': 'marker'})
    mcoast_def = mv.mcoast({'map_coastline_land_shade': True})
    mobs_def = mv.mobs({'obs_temperature': False})
    mtext_def = mv.mtext({'text_font_size': '0.80'})
    geoview_def = mv.geoview({'map_projection': 'polar_stereographic'})
    ps_output_def = mv.ps_output({'output_name': 'test'})
    assert mcont_def['LEGEND'] == 'ON'
    assert msymb_def['SYMBOL_TYPE'] == 'MARKER'
    assert mcoast_def['MAP_COASTLINE_LAND_SHADE'] == 'ON'
    assert mobs_def['OBS_TEMPERATURE'] == 'OFF'
    assert mtext_def['TEXT_FONT_SIZE'] == 0.8
    assert geoview_def['MAP_PROJECTION'] == 'POLAR_STEREOGRAPHIC'
    assert ps_output_def['OUTPUT_NAME'] == 'test'
Exemple #3
0
    def make_geo_view(self, area=None, style=None, plot_type=None):
        if style is None and plot_type == "diff":
            style = "base_diff"

        a, s = self.find(area=area, style=style)
        if a is not None and a:
            a = copy.deepcopy(a)
        else:
            a = {}

        if s is not None:
            if isinstance(s, mv.Request):
                s = Visdef.from_request(s)
            else:
                s = s.clone()
            if plot_type == "stamp":
                s = s.update({"map_grid": "off", "map_label": "off"})
            if s:
                a["coastlines"] = s.to_request()

        return mv.geoview(**a)
Exemple #4
0
"""
import metview as mv

# define a view over the area of interest and set land shading on

land_shade = mv.mcoast(
    map_coastline_land_shade=True,
    map_coastline_land_shade_colour="RGB(0.98,0.95,0.82)",
    map_coastline_sea_shade=False,
    map_coastline_sea_shade_colour="RGB(0.85,0.93,1)",
)

area_view = mv.geoview(
    map_area_definition="corners",
    area=[45.83, -13.87, 62.03, 8.92],
    coastlines=land_shade,
)

# Simplest plot:
# NOTE that when plotting a 'raw' BUFR file, Magics will plot synop symbols as shown in
# https://software.ecmwf.int/wiki/display/METV/Data+Part+1 "Plotting BUFR Data"

obs = mv.read("../tests/obs_3day.bufr")

mv.setoutput(mv.png_output(output_width=1200, output_name="./obsplot1"))
mv.plot(area_view, obs)

# ALTERNATIVELY, add an Observations Plotting visual definition

obs_plotting = mv.mobs(
--------------------------------------------------------------------------------
4. Analyst customises many features of his graph in order to create
   publication-quality plots
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
5. Analyst plots the data
--------------------------------------------------------------------------------
"""

import metview as mv

# define a view over the area of interest

area_view = mv.geoview(map_area_definition="corners",
                       area=[45.83, -13.87, 62.03, 8.92])

t2m_grib = mv.read("./t2m_grib.grib")

obs_3day = mv.read("./obs_3day.bufr")

t2m_gpt = mv.obsfilter(parameter="012004", output="geopoints", data=obs_3day)

diff = t2m_grib - t2m_gpt

diff_symb = mv.msymb(
    legend=True,
    symbol_type="marker",
    symbol_table_mode="advanced",
)
Exemple #6
0
 def to_request(self):
     v = copy.deepcopy(self.params)
     if self.style is not None and self.style:
         v["coastlines"] = self.style.to_request()
     return mv.geoview(**v)