climate.map_plots¶
Provides classes for analyzing spatially embedded complex networks, handling multivariate data and generating time series surrogates.
-
class
pyunicorn.climate.map_plots.
MapPlots
(grid, title)[source]¶ Bases:
object
Encapsulates map plotting functions.
Provides functionality to easily bundle multiple geo-datasets into a single file.
-
__init__
(grid, title)[source]¶ Initialize an instance of MapPlots.
Plotting of maps is powered by PyNGL.
Parameters: - grid (
Grid
) – The Grid object describing the map data to be plotted. - title (str) – The title describing the map data.
- grid (
-
__weakref__
¶ list of weak references to the object (if defined)
-
add_dataset
(title, data)[source]¶ Add a map data set for plotting.
Data sets are stored as dictionaries in the
map_data
list.Parameters: - title (str) – The string describing the data set.
- data (1D array [index]) – The numpy array containing the map to be drawn
-
add_multiple_datasets
(map_number, title, data)[source]¶ Add a map-dataset consisting of a title and the dataset itself to the
map_data
list of dictionaries (pure dictionaries have no order) and reshapes data array for plotting.- INPUT: title a string describing the dataset
- data a numpy array containing the map to be drawn
-
add_multiple_datasets_npy
(map_number, title, data)[source]¶ Method for very large data sets (RAM issues) and useful for PARALLEL code. Data is copied to npy files (titles still in the list) that can be loaded afterwards.
- INPUT: title a string describing the data set
- data a Numpy array containing the map to be drawn
-
generate_map_plots
(file_name, title_on=True, labels_on=True)[source]¶ Generate and save map plots.
Store the plots in the file indicated by
file_name
in the current directory.Map plots are stored in a PDF file, with each map occupying its own page.
Parameters: - file_name (str) – The name for the PDF file containing map plots.
- title_on (bool) – Determines, whether main title is plotted.
- labels_on (bool) – Determines whether individual map titles are plotted.
-
generate_multiple_map_plots
(map_names, map_scales, title_on=True, labels_on=True)[source]¶ Generate map plots from the datasets stored in the
map_data
list of dictionaries. Stores the plots in the file indicated by filename in the current directory.
-
generate_multiple_map_plots_npy
(map_names, map_scales, title_on=True, labels_on=True)[source]¶ Method for very large datasets (RAM issues) and useful for PARALLEL code. Generates map plots from the datasets stored in the npy files and the list of titles. The data is sorted as parallel computation mixes it up. Stores the plots in the file indicated by filename in the current directory.
-
grid
= None¶ (Grid) - The Grid object describing the map data to be plotted.
-
map_data
= None¶ (list) - The list storing map data and titles.
-
map_mult_data
= None¶ (list) - The list storing map data and titles for multiple maps.
-
resources
= None¶ The PyNGL resources allow fine tuning of plotting options.
-
save_ps_map
(title, data, labels_on=True)[source]¶ Directly create a PS file of data with filename=title. Assumes normalized data between 0 and 1.
- INPUT: title a string describing the dataset data a numpy array
- containing the map to be drawn
-
title
= None¶ (string) - The title describing the map data.
-