# Metview Macro

# **************************** LICENSE START ***********************************
#
# Copyright 2012 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 BUFR file and extract t2m
obs_area_bufr = read("../obs_area.bufr")

t2_geo = obsfilter(
        output  :  "geopoints",
        data    :  obs_area_bufr
        )


# read the GRIB file of 2T analysis
t2_grib = read("../t2_an.grib")


# Compute the difference
diff = t2_geo - t2_grib

# Extract geopoints that are hotter by 1 deg or more
hotter = filter(diff, diff >= 1)

# Extract geopoints that are colder by 1 deg or more
colder = filter(diff, diff <= -1)

# Get geopoints that are within +/-1
exact  = filter(diff, (diff>-1)*(diff<1))

# Symbol visdefs for each classification
red = msymb(
    symbol_type   : 'marker',
    symbol_colour : "red"
    )

blue  = msymb(
    symbol_type   : 'marker',
    symbol_colour : "blue"
    )

grey  = msymb(
    symbol_type   : 'marker',
    symbol_colour : "grey"
    )

# Plot the data
plot(hotter,red,colder,blue,exact,grey)
