예제 #1
0
from reference import c_act
import h5py

fh = h5py.File(argv[1], 'r')

points = fh['points']
stations = fh['stations']
mu_C = fh['mu'][-1,:]
sd_C = fh['sd'][-1,:]

plt.rcParams.update(rcParams)
fig = plt.figure(figsize=(6.5,4))
fig.subplots_adjust(wspace=0.02)

ax_mu = fig.add_subplot(121)
m = prepare_map(ax_mu)
x, y = m(points['lon'], points['lat'])
pcol = ax_mu.tripcolor(x, y, mu_C, cmap='seismic', rasterized=True, vmin=3900, vmax=4100)
cbar = m.colorbar(pcol, location='bottom', pad="5%")
cbar.set_ticks(c_act.levels(20))
cbar.solids.set_edgecolor("face")
m.scatter(stations['lon'], stations['lat'], latlon=True, marker='.', color='g', s=4)

# Make a lat, lon grid with extent of the map
N = 150j
grid = np.rec.fromarrays(np.mgrid[lllat:urlat:N, lllon:urlon:N], dtype=dt_latlon)
levels = c_act.levels(20)
m.contour(grid['lon'], grid['lat'], c_act(grid), latlon=True, leverls=levels, colors='k')

ax_sd = fig.add_subplot(122)
m = prepare_map(ax_sd, pls=[0,0,0,0])
예제 #2
0
import h5py

plt.rcParams.update(rcParams)

# FIXME Prone to errors
infile = argv[1]
outfile = infile.replace('dat/', 'fig_').replace('.hdf5', '_sd_V_pst.pgf')

fh = h5py.File(infile, 'r')
points = fh['points']
sd_C_pst = np.sqrt(np.diagonal(fh['cov_CC_pst']))

# Prepare map
fig = plt.figure()
ax_map = fig.add_subplot(111)
m = prepare_map(ax=ax_map)
# Add axes for the colorbar
bbox = ax_map.get_position()
ax_cbr = fig.add_axes((bbox.x0, bbox.y0 - 0.06, bbox.width, 0.04))

# Plot realization
x, y = m(points['lon'], points['lat'])
pcol = ax_map.tripcolor(x, y, sd_C_pst, cmap=cmap_sd, rasterized=True)
# Make colorbar
cbar = plt.colorbar(pcol, cax=ax_cbr, orientation='horizontal')
cbar.set_label(r'$^m/_s$')
cbar.solids.set_edgecolor("face")

# Save PGF file
plt.savefig(outfile, transparent=True)
예제 #3
0
from reference import dt_obs

plt.rcParams.update(rcParams)

# Read station coordinates
all_stations = read_station_file('../dat/stations.dat')
# Read pseudo data
pseudo_data = np.genfromtxt('../dat/pseudo_data.dat', dtype=dt_obs)
# Instantiate
pairs = ListPairs(pseudo_data, all_stations)
# Stations
stations = pairs.stations
# Discretization
points = pairs.points

# Prepare map
m = prepare_map()

# Plot station locations
m.scatter(stations['lon'], stations['lat'], lw=0, color='g', latlon=True)

# Plot great circle for all combinations
for pair in pairs:
    path = pair.great_circle_path
    if path.size == 2:
        continue
    m.plot(path['lon'], path['lat'], latlon=True, \
           linewidth=0.5, color='g', alpha=0.35)

plt.savefig('../fig_path_coverage.pgf', transparent=True)