# Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2016 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 ************************************

lat = 51
lon = 1


fs = read("t2m_forecast_24.grib")
vals_fc = nearest_gridpoint(fs, lat, lon)
print(vals_fc)

fs = read("t2m_analysis.grib")
vals_an = nearest_gridpoint(fs, lat, lon)
print(vals_an)

fc_vs_an = input_visualiser(
    input_x_values : vals_an,
    input_y_values : vals_fc
    )

markers = msymb(
    symbol_type                            : "marker",
    symbol_table_mode                      : "advanced",
    symbol_advanced_table_max_level_colour : "red",
    symbol_advanced_table_min_level_colour : "blue",
    symbol_advanced_table_colour_direction : "clockwise",
    symbol_advanced_table_height_list      : 0.6
    )

# compute the min and max values from the data
all_vals = vector(vals_an & vals_fc)

diagonal = input_visualiser(
    input_x_values : [minvalue(all_vals) - 2, maxvalue(all_vals) + 2],
    input_y_values : [minvalue(all_vals) - 2, maxvalue(all_vals) + 2]
    )

graph = mgraph()

plot(fc_vs_an, markers, diagonal, graph)



