Пример #1
0
currentyr = str(now.year)
currenttime = currentmn + '_' + currentdy + '_' + currentyr
titletime = currentmn + '/' + currentdy + '/' + currentyr
print '\n' '----Plot NCEP - %s----' % titletime

### Alott time series
yearmin = 1979
yearmax = 2015
years = np.arange(yearmin, yearmax + 1, 1)
months = [
    r'Jan', r'Feb', r'Mar', r'Apr', r'May', r'Jun', r'Jul', r'Aug', r'Sep',
    r'Oct', r'Nov', r'Dec'
]

### Read in functions
lats, lons, h7 = NP.readNCEP(directorydata, years, 'heights', '700')

latq = np.where(lats >= 70)[0]
lats = lats[latq]
h7 = h7[:, :, latq, :]


### calculate climo
def climo(var, years, yearmin, yearmax):
    """
    Calculates climatology based on given years
    """
    yr = np.where((years >= yearmin) & (years <= yearmax))[0]

    meanvar = np.nanmean(var[yr, :, :, :], axis=0)
Пример #2
0
currentyr = str(now.year)
currenttime = currentmn + '_' + currentdy + '_' + currentyr
titletime = currentmn + '/' + currentdy + '/' + currentyr
print '\n' '----Plot NCEP - %s----' % titletime

### Alott time series
yearmin = 1979
yearmax = 2015
years = np.arange(yearmin, yearmax + 1, 1)
months = [
    r'Jan', r'Feb', r'Mar', r'Apr', r'May', r'Jun', r'Jul', r'Aug', r'Sep',
    r'Oct', r'Nov', r'Dec'
]

### Read in functions
lats, lons, tas = NP.readNCEP(directorydata, years, 'tas', '925')


### calculate climo
def climo(var, years, yearmin, yearmax):
    """
    Calculates climatology based on given years
    """
    yr = np.where((years >= yearmin) & (years <= yearmax))[0]

    meanvar = np.nanmean(var[yr, :, :, :], axis=0)

    print 'Completed: Calculated mean climatology!'
    return meanvar

currentmn = str(now.month)
currentdy = str(now.day)
currentyr = str(now.year)
currenttime = currentmn + '_' + currentdy + '_' + currentyr
titletime = currentmn + '/' + currentdy + '/' + currentyr
print '\n' '----Plot NCEP - %s----' % titletime 

### Alott time series
yearmin = 1948
yearmax = 2015
years = np.arange(yearmin,yearmax+1,1)
months = [r'Jan',r'Feb',r'Mar',r'Apr',r'May',r'Jun',r'Jul',r'Aug',
          r'Sep',r'Oct',r'Nov',r'Dec']
          
### Read in functions
lats,lons,slp = NP.readNCEP(directorydata,years,'slp','surface') 

### Slice above 70
latq = np.where(lats >=70)[0]
lats = lats[latq]
lats = np.squeeze(lats)
slp = slp[:,:,latq,:]

### calculate climo
def climo(var,years,yearmin,yearmax):
    """
    Calculates climatology based on given years
    """
    print '\n>>> Using climo function!'
    yr = np.where((years >= yearmin) & (years <= yearmax))[0]
    
Пример #4
0
import read_NCEP as NP
import nclcmaps as ncm

### Define directories
directorydata1 = '/home/zlabe/Surtsey/NCEP/'
directorydata2 = '/home/zlabe/Surtsey3/'

### Alott time series
yearmin = 1979
yearmax = 2015
years = np.arange(yearmin, yearmax + 1, 1)

varnames = 'slp'

### Call functions
lat1, lon1, var = NP.readNCEP(directorydata1, years, varnames, 'surface')

### Read new lat/lon grid
files = 'CESM_large_ensemble/SIT/interp_1deg/'
filename = directorydata2 + files + 'b.e11.B20TRC5CNBDRD.f09_g16.002.cice.h.hi_nh.192001-200512.nc'
data = Dataset(filename)
lat2 = data.variables['lat'][:]
lon2 = data.variables['lon'][:]
data.close()

if lat2.ndim == 1:
    if lon2.ndim == 1:
        lon2, lat2 = np.meshgrid(lon2, lat2)
        print 'Made meshgrid of new lats/lons!'

if lat1.ndim == 1: