# 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")

levs = grib_get_long(tuv_data, 'level')
print(levs)

units = grib_get_string(tuv_data, 'units')
print('all units: ', units)

k = find(units, 'K', 'all')
print('indexes of k: ', k)



# perform a simple filtering of the fieldset using these indexes
result = nil
for i = 1 to count(k) do
    result = result & tuv_data[k[i]]
end for

return result
