#Metview Macro

#Read odb
amsua_2e_odb = read("AMSUA.odb")

#Perform the query - the output is an ODB
filter_dep = odb_filter(
		odb_query	:	"select " &
					"  lat@hdr as lat, " &
					"  lon@hdr as lon, " &
					"  fg_depar@body as fg_dep, " &
					"  an_depar@body as an_dep " &
					"where " &
					"  vertco_reference_1@body = 5 ",
		odb_data	:	amsua_2e_odb
		)


#Acces values from the result	
lat = values(filter_dep,"lat")
lon = values(filter_dep,"lon")
fg_dep = values(filter_dep,"fg_dep")
an_dep = values(filter_dep,"an_dep") 

#Compute the analysis increment as the difference of the analysis departure
#and first guess depature
num=count(lat)
incr = vector(num)
incr = an_dep - fg_dep
 
#Build a geopoints object for visualisation
geo=create_geo(count(lat),"xyv")
geo=set_latitudes(geo,lat)
geo=set_longitudes(geo,lon)
geo=set_values(geo,incr)

#Visualise
plot(geo)