#Metview Macro

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

#=============================================================================
# Function      : potential_temperature
#
# Syntax        : number potential_temperature(t: number, p: number)
#                                          
# Category      : THERMODYNAMICS
#
# OneLineDesc   : computes the potential temperature for a given temperature and pressure
#
# Description   : Compute the potential temperature for a given temperature and pressure
#
# Parameters    : t - the temperature (K)
#		 		  p - the pressure (Pa)
#           
# Return Value  : the potential temperature (K)
#
# Dependencies  : none
#
#==============================================================================

function potential_temperature(t: number, p: number)
    
    KAPPA=0.285611 #Rd/cp
    return t*(100000./p)^KAPPA

end potential_temperature

