Exemplo n.º 1
0
# current arrows
cdx = 7
cdy = 11  # in indices

plotdates = netCDF.num2date(ts, units)
if year == 2014:
    monthdates = [datetime(year, month, 1, 0, 0, 0) for month in np.arange(1, 10)]
else:
    monthdates = [datetime(year, month, 1, 0, 0, 0) for month in np.arange(1, 13)]

# if not os.path.exists('figures/' + str(year)):
#     os.makedirs('figures/' + str(year))

# Colormap for model output
levels = (37 - np.exp(np.linspace(0, np.log(36.0), 10)))[::-1] - 1  # log for salinity
cmap = cmPong.salinity(cmocean.cm.salt, levels)
# cmap = cmPong.salinity('YlGnBu_r', levels)
ilevels = [0, 1, 2, 3, 4, 5, 8]  # which levels to label
ticks = [int(tick) for tick in levels[ilevels]]  # plot ticks
##

## Wind forcing ##

# There are multiple file locations
if year <= 2012:
    w = netCDF.Dataset("/atch/raid1/zhangxq/Projects/narr_txla/txla_blk_narr_" + str(year) + ".nc")
elif year == 2013:
    w = netCDF.Dataset("/rho/raid/home/kthyng/txla/txla_wind_narr_2013.nc")
elif year == 2014:
    w = netCDF.Dataset("/rho/raid/home/kthyng/txla/txla_wind_narr_2014.nc")
Exemplo n.º 2
0
## Model output ##
m = netCDF.Dataset(loc)

# Model time period to use
units = m.variables['ocean_time'].units
year = 2008
starttime = netCDF.date2num(datetime(year, 5, 1, 12, 0, 0), units)
endtime = netCDF.date2num(datetime(year, 10, 1, 12, 0, 0), units)
dt = m.variables['ocean_time'][1] - m.variables['ocean_time'][0] # 4 hours in seconds
ts = np.arange(starttime, endtime, dt)
itshift = find(starttime==m.variables['ocean_time'][:]) # shift to get to the right place in model output
dates = netCDF.num2date(m.variables['ocean_time'][:], units)

# Colormap for model output
levels = (37-np.exp(np.linspace(0,np.log(36.), 10)))[::-1]-1 # log for salinity
cmap = cmPong.salinity('YlGnBu_r', levels)
ilevels = [0,1,2,3,4,5,8] # which levels to label
ticks = [int(tick) for tick in levels[ilevels]] # plot ticks
##

## Wind forcing ##




    # # Change axis and label color
    # ax.spines['bottom'].set_color('0.2')
    # ax.spines['top'].set_color('0.2')
    # ax.spines['left'].set_color('0.2')
    # ax.spines['right'].set_color('0.2')
    # ax.xaxis.label.set_color('0.2')