Exemplo n.º 1
0
medium gray backgrounds.  We'll initialize two ``MapDesign``s, since we want
slightly different maps (longitude labels), and make one Basemap per axis.
"""

fig, (ax0, ax1) = plt.subplots(nrows=2, figsize=(8, 10))

mapcorners = [-155, 10, -50, 55]
standard_pm = [-110, 20, 40, 30]

# Note we draw every 15 degrees of longitude, but only label every 30
# Check the pysplit.MapDesign() docs for more options than param_dict shows
param_dict = {'projection':'lcc', 'latlon_labelspacing':(10,30),
              'latlon_spacing':(10,15), 'latlon_fs':16, 'drawstates':True,
              'resolution':'l', 'mapcolor':'medium'}

map_params0 = pysplit.MapDesign(mapcorners, standard_pm, **param_dict)
map_params1 = pysplit.MapDesign(mapcorners, standard_pm, lon_labels=['bottom'], **param_dict)

scattermap0 = map_params0.make_basemap(ax=ax0)
scattermap1 = map_params1.make_basemap(ax=ax1)

"""
Plotting ``Trajectory`` data
----------------------------
This is at present the best way to approximate a color-graded line.
Here, we'll scatter plot along-trajectory pressure data.

Scatter plotting can be performed in a couple ways.  The first is to use the
standard ``basemap.scatter()``, and the second is to use
pysplit.traj_scatter()``.  Both are shown in the example below,
and achieve exactly the same result- the top and bottom maps should be
Exemplo n.º 2
0
PySPLIT's ``MapDesign`` class uses the matplotlib Basemap toolkit to quickly
set up attractive maps.  The user is not restricted to using maps
produced from ``MapDesign``, however- any Basemap will serve in the section
below entitled 'Plotting ``Trajectory`` Paths.

Creating a basic cylindrical map using ``MapDesign``  only requires
``mapcorners``, a list of the lower-left longitude, lower-left latitude,
upper-right longitude, and upper-right latitude values.
The ``standard_pm``, a list of standard parallels and meridians,
may be passed as ``None``.

"""
mapcorners = [10, 50, 80, 90]
standard_pm = None

bmap_params = pysplit.MapDesign(mapcorners, standard_pm)
"""
Once the ``MapDesign`` is initialized it can be used to draw a map:

"""
bmap = bmap_params.make_basemap()
"""
Plotting ``Trajectory`` Paths
-----------------------------
For this example, we will color-code by initialization (t=0) altitude,
(500, 1000, or 1500 m), which can be accessed via ``Trajectory.data.geometry``,
 a ``GeoSeries`` of Shapely ``Point`` objects.

We can store the trajectory color in ``Trajectory.trajcolor`` for convenience.

"""
                              r'C:/hysplit4/working',
                              r'E:/gdas',
                              meteo_interval='weekly',
                              hysplit="C:\\hysplit4\\exec\\hyts_std")

    traj.generate_clippedtraj(r'C:/trajectories/umn_example/clippedtraj')
"""
Loading and Mapping Reverse Trajectories
----------------------------------------
Load the reverse trajectory data via ``Trajectory.load_reversetraj()``.

For details on the sample basic plotting procedure, see
``basic_plotting_example.py``.  The original trajectories are plotted in
gold and the reverse trajectories in maroon.  Ideally, the reverse
trajectories will overlay the original trajectories.

"""
for traj in warm_trajgroup:
    traj.load_reversetraj()

mapcorners = [-150, 15, -50, 65]
standard_pm = None

testmap = pysplit.MapDesign(mapcorners, standard_pm)

bmap = testmap.make_basemap()

for traj in warm_trajgroup[::5]:
    bmap.plot(*traj.path.xy, c='#FFB71E', latlon=True, zorder=20)
    bmap.plot(*traj.path_r.xy, c='#5B0013', latlon=True, zorder=20)
Exemplo n.º 4
0
traj_assignment = r'C:/hysplit4/cluster/working/CLUSLIST_7'
clusterpath_dir = r'C:/hysplit4/cluster/working'

clusgroup = pysplit.spawn_clusters(trajgroup, traj_assignment, clusterpath_dir)
"""
An example mapping procedure is below.  The ``Cluster`` path linewidths
represent the portion of trajectories that are members relative to the total
number of trajectories clustered.


"""
colors = np.linspace(0, 0.95, 7)

mapcorners = [-150, 15, -50, 65]
standard_pm = None
mapdesign0 = pysplit.MapDesign(mapcorners, standard_pm)
mapdesign1 = pysplit.MapDesign(mapcorners, standard_pm, lon_labels=['bottom'])

fig, (ax0, ax1) = plt.subplots(nrows=2, figsize=(10, 10))
map0 = mapdesign0.make_basemap(ax=ax0)
map1 = mapdesign1.make_basemap(ax=ax1)

# Text on maps
x, y = map0(-135, 25)
font_params = {
    'horizontalalignment': 'center',
    'verticalalignment': 'center',
    'fontsize': 20,
    'weight': 'bold'
}