MCPcopy Create free account
hub / github.com/NatLabRockies/windtools / plot_spectrum

Function plot_spectrum

windtools/plotting.py:1056–1277  ·  view source on GitHub ↗

Plot frequency spectrum at a given height for different datasets, time(s) and field(s), using a subplot per time and per field. Note that this function does not interpolate to the requested height, i.e., if height is not None, the specified value should be available in all data

(datasets,
                  fields=None,
                  height=None,
                  times=None,
                  fig=None,ax=None,
                  fieldlimits=None,
                  freqlimits=None,
                  fieldlabels={},
                  labelsubplots=False,
                  showlegend=None,
                  ncols=None,
                  subfigsize=(4,5),
                  datasetkwargs={},
                  **kwargs
                  )

Source from the content-addressed store, hash-verified

1054
1055
1056def plot_spectrum(datasets,
1057 fields=None,
1058 height=None,
1059 times=None,
1060 fig=None,ax=None,
1061 fieldlimits=None,
1062 freqlimits=None,
1063 fieldlabels={},
1064 labelsubplots=False,
1065 showlegend=None,
1066 ncols=None,
1067 subfigsize=(4,5),
1068 datasetkwargs={},
1069 **kwargs
1070 ):
1071 """
1072 Plot frequency spectrum at a given height for different datasets,
1073 time(s) and field(s), using a subplot per time and per field.
1074
1075 Note that this function does not interpolate to the requested height,
1076 i.e., if height is not None, the specified value should be available
1077 in all datasets.
1078
1079 Usage
1080 =====
1081 datasets : pandas.DataFrame or dict
1082 Dataset(s) with spectrum data. If more than one set,
1083 datasets should be a dictionary with entries
1084 <dataset_name>: dataset
1085 fields : str, list, 'all' (or None)
1086 Fieldname(s) corresponding to particular column(s) of
1087 the datasets. fields can be None if input are Series.
1088 'all' means all fields will be plotted (in this case all
1089 datasets should have the same fields)
1090 height : float (or None)
1091 Height for which frequency spectra is plotted. If datasets
1092 have no height dimension, height does not need to be specified.
1093 times : str, int, float, list (or None)
1094 Time(s) for which frequency spectra are plotted, specified as
1095 either datetime strings or numerical values (seconds, e.g.,
1096 simulation time). times can be None if all datasets combined
1097 have no more than one time value.
1098 fig : figure handle
1099 Custom figure handle. Should be specified together with ax
1100 ax : axes handle, or list or numpy ndarray with axes handles
1101 Customand axes handle(s).
1102 Size of ax should equal nfields * ntimes
1103 fieldlimits : list or tuple, or dict
1104 Value range for the various fields. If only one field is
1105 plotted, fieldlimits can be a list or tuple. Otherwise, it
1106 should be a dictionary with entries <fieldname>: fieldlimit.
1107 Missing fieldlimits are set automatically
1108 freqlimits : list or tuple
1109 Frequency axis limits
1110 fieldlabels : str or dict
1111 Custom field labels. If only one field is plotted, fieldlabels
1112 can be a string. Otherwise it should be a dictionary with
1113 entries <fieldname>: fieldlabel

Callers

nothing calls this directly

Calls 11

PlottingInputClass · 0.85
_get_dim_valuesFunction · 0.85
_get_sliceFunction · 0.85
_get_fieldFunction · 0.85
_align_labelsFunction · 0.85
addLabelsFunction · 0.85
_format_legendFunction · 0.85
set_titleMethod · 0.80
set_xlabelMethod · 0.80

Tested by

no test coverage detected