def hgt_500mb(self): u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) height = wrf.unstaggerZ(self.height) ref_val = 50000. #Switched to Cython #self.u10 = wrf.loglinear_interpolate(u_corr, self.press, ref_val) #self.v10 = wrf.loglinear_interpolate(v_corr, self.press, ref_val) self.u10 = np.array(wrf_cython.loglinear_interpolate(u_corr, self.press, ref_val)) self.v10 = np.array(wrf_cython.loglinear_interpolate(v_corr, self.press, ref_val)) #self.var = wrf.hypsometric(height,self.press, ref_val, self.temp) self.var = np.array(wrf_cython.hypsometric(height, self.press, ref_val, self.temp)) self.var2 = self.var self.varTitle = "500-mb Geopotential Height (m)\n" + self.dataSet.getTime() #Set short variable title for time series self.sTitle = "500-mb Geopotential Height (m)"
def PotentialVorticity(self): #Read in variables u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') f = self.dataSet.readNCVariable('F') #Define grid spacing in meters dx = self.dataSet.dx[self.dataSet.currentGrid-1] dy = self.dataSet.dy[self.dataSet.currentGrid-1] u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) self.u10 = u_corr self.v10 = v_corr self.var = wrf.pot_vort(u,v,f,dx,dy,self.press,self.theta) self.var2 = self.var self.varTitle = "Potential Voricity (PVU)\n"+ self.dataSet.getTime() #Set short variable title for time series self.sTitle = "Potential Voricity (PVU)"
def vort_850mb(self): u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) ref_val = 85000. #Switched to Cython #self.u10 = wrf.loglinear_interpolate(u_corr, self.press, ref_val) #self.v10 = wrf.loglinear_interpolate(v_corr, self.press, ref_val) self.u10 = np.array(wrf_cython.loglinear_interpolate(u_corr, self.press, ref_val)) self.v10 = np.array(wrf_cython.loglinear_interpolate(v_corr, self.press, ref_val)) self.var = wrf.rel_vort(self.u10,self.v10, self.dataSet.dx[self.dataSet.currentGrid-1], self.dataSet.dy[self.dataSet.currentGrid-1]) self.var2 = wrf.get_mslp(self.height, self.press, self.temp, self.qvapor) self.varTitle = "850-mb Relative Voriticity ($10^{-5}$ $s^{-1}$)\n" +\ self.dataSet.getTime() #Set short variable title for time series self.sTitle = "850-mb Relative Voriticity ($10^{-5}$ $s^{-1}$)"
def winds_300mb(self): u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) height = wrf.unstaggerZ(self.height) ref_val = 30000. #Switched to Cython #self.u10 = wrf.loglinear_interpolate(u_corr, self.press, ref_val) #self.v10 = wrf.loglinear_interpolate(v_corr, self.press, ref_val) self.u10 = np.array(wrf_cython.loglinear_interpolate(u_corr, self.press, ref_val)) self.v10 = np.array(wrf_cython.loglinear_interpolate(v_corr, self.press, ref_val)) var1 = wrf.get_bulk_wind(self.u10,self.v10) self.var = wrf.convertWind_MStoKT(var1) #self.var2 = wrf.hypsometric(height, self.press, ref_val, self.temp) self.var2 = np.array(wrf_cython.hypsometric(height, self.press, ref_val, self.temp)) self.varTitle = "300-mb Wind\n" + self.dataSet.getTime() #Set short variable title for time series self.sTitle = "300-mb Wind"
def richardson(self): u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) wind = (u_corr*u_corr + v_corr*v_corr)**(0.5) height = wrf.unstaggerZ(self.height) #compute the vertical gradient of theta dtheta = np.gradient(self.theta)[0] du = np.gradient(wind)[0] dz = np.gradient(height)[0] #compute the richardson number self.u10 = u_corr self.v10 = v_corr self.var = ((self.g/self.theta)*(dtheta/dz))/(du/dz)**(2) self.var2 = self.var self.varTitle = "Richardson Number\n" + self.dataSet.getTime() #Set short variable title for time series self.sTitle = "Richardson Number"
def temp_500mb(self): u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) height = wrf.unstaggerZ(self.height) ref_val = 50000. #Switched to Cython #var1 = wrf.loglinear_interpolate(self.temp, self.press, ref_val) #self.u10 = wrf.loglinear_interpolate(u_corr, self.press, ref_val) #self.v10 = wrf.loglinear_interpolate(v_corr, self.press, ref_val) var1 = np.array(wrf_cython.loglinear_interpolate(self.temp, self.press, ref_val)) self.u10 = np.array(wrf_cython.loglinear_interpolate(u_corr, self.press, ref_val)) self.v10 = np.array(wrf_cython.loglinear_interpolate(v_corr, self.press, ref_val)) self.var = wrf.convertT_KtoC(var1) #self.var2 = wrf.hypsometric(height, self.press, ref_val, self.temp) self.var2 = np.array(wrf_cython.hypsometric(height, self.press, ref_val, self.temp)) self.varTitle = "500-mb Temperature ($^{\circ}$C)\n" + self.dataSet.getTime() #Set short variable title for time series self.sTitle = "500-mb Temperature ($^{\circ}$C)"
def divergence(self): u = self.dataSet.readNCVariable('U') v = self.dataSet.readNCVariable('V') u_corr = wrf.unstaggerX(u) v_corr = wrf.unstaggerY(v) #For the WRF-ARW Arakawa C grid we don't need to use the unstagger winds # to calculate the gradient at the mass points #du = np.gradient(u_corr)[2] #dv = np.gradient(v_corr)[1] #Get dimensions dimsu = u.shape dimsv = v.shape du = u[:,:,1:dimsu[2]] - u[:,:,0:dimsu[2]-1] dv = v[:,1:dimsv[1],:] - v[:,0:dimsv[1]-1,:] dx = self.dataSet.dx[self.dataSet.currentGrid-1] dy = self.dataSet.dy[self.dataSet.currentGrid-1] self.u10 = u_corr self.v10 = v_corr self.var = (du/dx + dv/dy)*pow(10,5) self.var2 = self.var self.varTitle = "Divergence (10$^{-5}$ s$^{-1}$)\n" + self.dataSet.getTime() #Set short variable title for time series self.sTitle = "Divergence (10$^{-5}$ s$^{-1}$)"