def surface_parcel(self,mixdepth=125): """Returns parameters for a parcel initialised by: 1. Surface pressure (i.e. pressure of lowest level) 2. Surface temperature determined from max(theta) of lowest <mixdepth> mbar 3. Dew point temperature representative of lowest <mixdepth> mbar Inputs: mixdepth (mbar): depth to average mixing ratio over """ pres=self.data["pres"] temp=self.data["temp"] dwpt=self.data["dwpt"] # identify the layers for averaging layers=pres>pres[0]-mixdepth # parcel pressure is surface pressure pres_s=pres[0] # average theta over mixheight to give # parcel temperature thta_mix=Theta(temp[layers]+273.15,pres[layers]*100.).max() temp_s=TempK(thta_mix,pres_s*100)-273.15 # average mixing ratio over mixheight vpres=SatVap(dwpt) mixr=MixRatio(vpres,pres*100) mixr_mix=mixr[layers].mean() vpres_s=MixR2VaporPress(mixr_mix,pres_s*100) # surface dew point temp dwpt_s=DewPoint(vpres_s) return pres_s,temp_s,dwpt_s
def mixed_layer_parcel(self, depth=100): """Returns parameters for a parcel initialised by: 1. Surface pressure (i.e. pressure of lowest level) 2. Surface temperature determined from mean(theta) of lowest <depth> mb 3. Dew point temperature representative of lowest <depth> mbar Inputs: depth (mbar): depth to average mixing ratio over """ pres = self.soundingdata["pres"] temp = self.soundingdata["temp"] dwpt = self.soundingdata["dwpt"] pres0, temp0, dwpt0, null = self.surface_parcel() # identify the layers for averaging layers = pres > (pres0-depth) # average theta over mixheight to give # parcel temperature thta_mix = Theta(temp[layers]+degCtoK, pres[layers]*100.).mean() temp_s = TempK(thta_mix, pres0*100) - degCtoK # average mixing ratio over mixheight vpres = VaporPressure(dwpt) mixr = MixRatio(vpres, pres*100) mixr_mix = mixr[layers].mean() vpres_s = MixR2VaporPress(mixr_mix, pres0*100) # surface dew point temp dwpt_s = DewPoint(vpres_s) # print "----- Mixed Layer Parcel Characteristics -----" # print "Mixed layer depth : %5d mb "%depth # print "Mean mixed layer potential temperature: %5.1f K"%thta_mix # print "Mean mixed layer mixing ratio : %5.2f g/kg"% # (mixr_mix*1e3) return pres0, temp_s, dwpt_s, 'ml' raise NotImplementedError