Meteographica examples main page

Meteorographica examples: Global weathermap (20CR version)ΒΆ

 Global weather map for 16 October 1987, at 6am UTC, as reconstructed by the 20CR2c reanalysis (ensemble member 1 is shown). Contours show mean-sea-level pressure, vectors 10m wind, green shading precipitation rate, and yellow dots observations assimilated.

Collect the data (observations, sea-level pressure, precipitation and 10m-wind ensembles from 20CR2c for October 1987):

```import Meteorographica.data.twcr as twcr
twcr.fetch_observations(1987,version='2c')
for var in ('prmsl','prate','uwnd.10m','vwnd.10m'):
twcr.fetch(var,1987,version='2c')
```

Make the figure:

```# Global weather plot from 20CR2C - rotated pole
# Use Meteorographica weathermap functions
# This version uses 20CR data

import matplotlib

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure

import iris
import os
import numpy
import Meteorographica.data.twcr as twcr
import cartopy
import cartopy.crs as ccrs
import math
import datetime

import Meteorographica.weathermap as wm

# Specify the data to plot
year=1987
month=10
day=16
hour=6
member=1
dte=datetime.datetime(year,month,day,hour)

# set the region to plot
projection=ccrs.RotatedPole(pole_longitude=160.0,
pole_latitude=45.0,
central_rotated_longitude=-40.0)

# Define the page
extent=[-180.0,180.0,-90.0,90.0]
aspect=(extent[3]-extent[2])/(extent[1]-extent[0])
fig=Figure(figsize=(22,22*9/16),              # Width, Height (inches)
dpi=100,
facecolor=(0.88,0.88,0.88,1),
edgecolor=None,
linewidth=0.0,
frameon=False,                # Don't draw a frame
subplotpars=None,
tight_layout=None)
# Attach a canvas
canvas=FigureCanvas(fig)
font = {'family' : 'sans-serif',
'sans-serif' : 'Arial',
'weight' : 'normal',
'size'   : 12}
matplotlib.rc('font', **font)

resolution=0.25

## Axes to provide range and coordinate system - fill the fig.
ax.set_axis_off()
ax.set_extent(extent, crs=projection)
ax.set_aspect('auto')
matplotlib.rc('image',aspect='auto')

# Set the background colour
ax.background_patch.set_facecolor((0.88,0.88,0.88,1))

# Plot the land
land_img=ax.background_img(name='GreyT', resolution='low')

# Add a lat lon grid

# Plot the precip
pe=prate.extract(iris.Constraint(member=member))
prate_img=wm.plot_cmesh(ax,pe)

# Overplot the pressure as a contour plot
pe=prmsl.extract(iris.Constraint(member=member))
pe.data=pe.data/100 # To hPa for labels
CS=wm.plot_contour(ax,pe,
levels=numpy.arange(870,1050,5),
colors='black',
fontsize=8,label=True)

# Overplot the wind vectors as a quiver plot
ue=u.extract(iris.Constraint(member=member))
ve=v.extract(iris.Constraint(member=member))
qv=wm.plot_quiver(ax,ue,ve,scale=1,resolution=1,
max_points=100000)