pypago.misc¶
Module that contains miscellaneous functions (functions to determine the indexes of a section or area within a list) and the class that allows to define MATLAB-like structures
Functions
extract_attrlist (dataclass) |
Extract the names of the oject attributes which are not instance method and which do not start by a _ character |
extract_mask (array) |
True where missing data (masked or NaN) |
extract_str (attrnames, dataclass) |
Extract a string which will be used in the __str__ method. |
finddomnum (model_areas, areaplotname) |
Determines the index of a domain in a list of domains |
findsecnum (model_sections, secplotname) |
Determines the index of a section in a list of sections |
make_percentile_cmap (array, perc) |
Returns colormaps limits using percentiles. |
-
extract_attrlist
(dataclass)[source]¶ Extract the names of the oject attributes which are not instance method and which do not start by a _ character
Parameters: dataclass (object) – Input object Returns: A list of strings Return type: list
-
extract_str
(attrnames, dataclass)[source]¶ Extract a string which will be used in the __str__ method. The string list the attributes and display either their shape (for numpy arrays) or their values
Parameters: - attrnames (list) – List of attributes to displau.
- dataclass (object) – Input object
Returns: A string
Return type:
-
finddomnum
(model_areas, areaplotname)[source]¶ Determines the index of a domain in a list of domains
Parameters: - model_areas (list) – list of the Pago areas where to find the area
- areaplotname (str) – name of the area
Returns: index of the area within the list
Return type:
-
findsecnum
(model_sections, secplotname)[source]¶ Determines the index of a section in a list of sections
Parameters: - model_sections (list) – list of the Pago sections where to find the section
- secplotname (str) – name of the section
Returns: index of the section within the list
Return type: Raises: error – if secplotname not found in MODEL_sections
-
make_percentile_cmap
(array, perc)[source]¶ Returns colormaps limits using percentiles. The minimum color value.
Parameters: numpy.array (array) – Input array :param float perc : Percentile (in percentage)
Returns: A tuple containing the lower and upper colorbar limits associated with the array percentiles. Return type: tuple