pyatoa.visuals.map_maker
Map making functionality for the Pyatoa package. Creates Cartopy basemaps featuring events and stations w/ optional moment tensors
Module Contents
Classes
A class to call on the Basemap package to generate a map with |
Functions
|
Create a scale bar on a Cartopy plot. |
Attributes
- class pyatoa.visuals.map_maker.MapMaker(cat, inv, dpi=100, figsize=None, figure=None, gridspec=None, corners=None, corner_buffer_deg=2.0, **kwargs)[source]
A class to call on the Basemap package to generate a map with source-receiver information
- define_bounding_box(corners=None, corner_buffer_deg=2)[source]
Distribute the corners provided by the user, or determine corners using the event and station locations with a reasonable buffer.
- Parameters:
corners (dict) – dict containing corner points, if None, lat lon values to be determiend by station and receiver locations
buffer (float) – if no corners are given, put a buffer of length ‘buffer’ in units of degrees, around the min and max lat and lon values, to ensure that atleast some extra extent of map is covered. Defaults to 1 deg or roughly 111.11 km. But, if the distance covered between source and receiver is greater than ‘buffer’, than a quarter that distance will be used as the buffer. Confusing?
corner_buffer_deg (float) – size of the bounding box to be generated around the source and receiver, units of degrees
- Return type:
- Preturn:
[lon_min, lon_max, lat_min, lat_max]
- initiate_figure(figsize=None, dpi=100, figure=None, gridspec=None, **kwargs)[source]
Create a very barebones minimalist (black and white) map to plot data on
Note
kwargs passed to projection https://scitools.org.uk/cartopy/docs/v0.15/crs/projections.html
- source(fm_type='focal_mechanism')[source]
Plot the source, either as a focal mechanism, moment tensor, or as a simple point, based on the input.
Note
scale_source kwarg was guessed with trial and error and is based on the guessed returned length from the scale_bar() function defined at the bottom, which tries to guess a reasonable length of the scale bar based on the dimensions of the map
- Parameters:
fm_type (str) – choice to plot focal_mechanism: 6 component focal mechanism strike_dip_rake: classic double couple look
- annotate(location='lower-right', anno_latlon=False)[source]
Annotate event receiver information into bottom right corner of the map
TODO figure out where to put definition of ‘location’
- pyatoa.visuals.map_maker.scale_bar(ax, length=None, location=(0.85, 0.95), linewidth=3, return_length=False, ref_proj=ccrs.PlateCarree())[source]
Create a scale bar on a Cartopy plot. Modifiedd from: https://stackoverflow.com/questions/32333870/
how-can-i-show-a-km-ruler-on-a-cartopy-matplotlib-plot
- Parameters:
ax (matplotlib.pyplot.axes) – axes to draw the scalebar on.
length (float) – length of the scalebar in km.
location (tuple of floats) – center of the scalebar in axis coordinates. (ie. 0.5 is the middle of the plot)
linewidth (float) – the thickness of the scalebar.
return_length (bool) – Simply returns the scaled length of the bar, added to use for scaling of the moment tensor