# 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 ************************************


tuv_data = read('../TUV_Data')
t  = tuv_data[1]    # select just the first field (which we know is Temperature)
uv = tuv_data[2,3]  # select the u/v fields (which we know are fields 2 and 3 in the file)

cold_mask = t < 273.15           # cold_mask contains just 1s and 0s
cold_mask = bitmap(cold_mask, 0) # turn 0s into missing values


# alternative:
#cold_mask = t >= 273.15          # cold_mask contains just 1s and 0s
#cold_mask = bitmap(cold_mask, 1) # turn 1s into missing values



uv_cold_only = bitmap(uv, cold_mask) # apply the temperature mask to the u/v
plot(uv_cold_only)


