shakemap.coremods.kml¶
-
class
shakemap.coremods.kml.
KMLModule
(eventid)[source]¶ Bases:
shakemap.coremods.base.CoreModule
kml – Generate KML/KMZ files for ShakeMap.
Instantiate a KMLModule class with an event ID.
-
command_name
= 'kml'¶
-
targets
= ['products/shakemap\\.kmz']¶
-
dependencies
= [('products/shake_result.hdf', True)]¶
-
execute
()[source]¶ Create KML files.
- Raises:
NotADirectoryError – When the event data directory does not exist.
FileNotFoundError – When the the shake_result HDF file does not exist.
-
-
shakemap.coremods.kml.
place_legend
(datadir, document)[source]¶ Place the ShakeMap intensity legend in the upper left corner of the viewer’s map.
-
shakemap.coremods.kml.
create_epicenter
(container, document)[source]¶ Place a star marker at earthquake epicenter.
- Parameters:
container (ShakeMapOutputContainer) – Results of model.conf.
document (Element) – LXML KML Document element.
-
shakemap.coremods.kml.
create_contours
(container, document)[source]¶ Create a KML file containing MMI contour lines.
- Parameters:
container (ShakeMapOutputContainer) – Results of model.conf.
datadir (str) – Path to data directory where output KMZ will be written.
document (Element) – LXML KML Document element.
-
shakemap.coremods.kml.
set_look
(document, container)[source]¶ Set the view location, altitude, and angle.
- Parameters:
document (Element) – LXML KML Document element.
container (ShakeMapOutputContainer) – Results of model.conf.
-
shakemap.coremods.kml.
create_overlay
(container, datadir, document)[source]¶ Create a KML file and intensity map.
- Parameters:
container (ShakeMapOutputContainer) – Results of model.conf.
datadir (str) – Path to data directory where output KMZ will be written.
document (SubElement) – KML document where the overlay tags should go.
- Returns:
(Path to output KMZ file, Path to output overlay image)
- Return type:
-
shakemap.coremods.kml.
create_overlay_image
(container, filename)[source]¶ Create a semi-transparent PNG image of intensity.
- Parameters:
container (ShakeMapOutputContainer) – Results of model.conf.
filename (str) – Path to desired output PNG file.
- Returns:
GeoDict object for the intensity grid.
- Return type:
GeoDict
-
shakemap.coremods.kml.
create_stations
(container, datadir, document)[source]¶ Create a KMZ file containing station KML and necessary icons files.
-
shakemap.coremods.kml.
make_placemark
(folder, station, cpalette, style_map)[source]¶ Create a placemark element in station KML.
- Parameters:
folder (Element) – KML Folder element.
station (dict) – Dictionary containing station data.
cpalette (ColorPalette) – Object allowing user to convert MMI to color.
style_map (skml.StyleMap) – The style map for the station type.
-
shakemap.coremods.kml.
get_intensity
(station)[source]¶ Retrieve the intensity value from a station dictionary.
-
shakemap.coremods.kml.
get_description_table
(station)[source]¶ Get station description as HTML table.
-
shakemap.coremods.kml.
get_description
(station)[source]¶ Get station description as HTML definition list.
-
shakemap.coremods.kml.
get_imt_text
(station, imt)[source]¶ Get a text string describing the value of input IMT.
-
shakemap.coremods.kml.
create_styles
(document, icon_text, scale_normal, scale_highlight, color)[source]¶ Create styles/style maps for station KML.
- Parameters:
document (Element) – LXML KML Document element.