Skip to content

Commit

Permalink
Mcpca doc (#570)
Browse files Browse the repository at this point in the history
* ensemblegeoseries docstring fix

* ensmultivardecomp doc string fix

* mgs docstrings

* ms docstrings

* mvd docstrings

* doc fixes
  • Loading branch information
alexkjames authored Jun 4, 2024
1 parent c96ecb2 commit a58623f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 59 deletions.
6 changes: 2 additions & 4 deletions pyleoclim/core/ensemblegeoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,9 @@ def make_labels(self):
Returns
-------
time_header : str
Label for the time axis
value_header : str
Label for the value axis
'''
Expand Down Expand Up @@ -318,7 +316,7 @@ def dashboard(self, figsize=[11, 8], gs=None, plt_kwargs=None, histplt_kwargs=No
hue='archiveType', marker='archiveType', size=None, scatter_kwargs=None,
gridspec_kwargs=None,
savefig_settings=None):
'''
'''Dashboard that plots the trace, histogram, map, and power spectrum of the ensemble.
Parameters
----------
Expand Down Expand Up @@ -393,7 +391,7 @@ def dashboard(self, figsize=[11, 8], gs=None, plt_kwargs=None, histplt_kwargs=No
See also
--------
pyleoclim.core.series.Series.plot : plot a timeseries
pyleoclim.core.ensembleseries.EnsembleSeries.plot_envelope: Envelope plots for an ensemble
Expand Down
64 changes: 22 additions & 42 deletions pyleoclim/core/ensmultivardecomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,27 +131,17 @@ def modeplot(self,index=0,flip=False,plot_envelope_kwargs = None, psd_envelope_k
.. jupyter-execute::
n = 3 # number of ensembles
nn = 30 # number of noise realizations
nt = 500
ens_list = []
t,v = pyleo.utils.gen_ts(model='colored_noise',nt=nt,alpha=1.0)
signal = pyleo.Series(t,v)
for _ in range(n):
series_list = []
lat = np.random.randint(-90,90)
lon = np.random.randint(-180,180)
for idx in range(nn): # noise
noise = np.random.randn(nt,nn)*100
ts = pyleo.GeoSeries(time=signal.time, value=signal.value+noise[:,idx], lat=lat, lon=lon, verbose=False)
series_list.append(ts)
ts_ens = pyleo.EnsembleSeries(series_list)
ens_list.append(ts_ens)
mul_ens = pyleo.MulEnsGeoSeries([ts_ens])
n = 100 # number of series
soi = pyleo.utils.load_dataset('SOI')
soi_time_axes = [pyleo.utils.random_time_axis(n=len(soi.time)) for _ in range(n)]
soi_ens = pyleo.EnsembleGeoSeries([pyleo.GeoSeries(time=time, value=soi.value,lat=-5,lon=-85,auto_time_params=True) for time in soi_time_axes])
nino3 = pyleo.utils.load_dataset('NINO3')
nino3_time_axes = [pyleo.utils.random_time_axis(n=len(nino3.time)) for _ in range(n)]
nino3_ens = pyleo.EnsembleGeoSeries([pyleo.GeoSeries(time=time, value=nino3.value,lat=-5,lon=-85,auto_time_params=True) for time in nino3_time_axes])
mul_ens = pyleo.MulEnsGeoSeries([nino3_ens,soi_ens])
mcpca = mul_ens.mcpca(nsim=10,seed=42)
mcpca.modeplot()'''

Expand Down Expand Up @@ -328,27 +318,17 @@ def screeplot(self,clr_eig='C0', linewidth=.3, title='Screeplot', violin_kwargs
.. jupyter-execute::
n = 3 # number of ensembles
nn = 30 # number of noise realizations
nt = 500
ens_list = []
t,v = pyleo.utils.gen_ts(model='colored_noise',nt=nt,alpha=1.0)
signal = pyleo.Series(t,v)
for _ in range(n):
series_list = []
lat = np.random.randint(-90,90)
lon = np.random.randint(-180,180)
for idx in range(nn): # noise
noise = np.random.randn(nt,nn)*100
ts = pyleo.GeoSeries(time=signal.time, value=signal.value+noise[:,idx], lat=lat, lon=lon, verbose=False)
series_list.append(ts)
ts_ens = pyleo.EnsembleSeries(series_list)
ens_list.append(ts_ens)
mul_ens = pyleo.MulEnsGeoSeries([ts_ens])
n = 100 # number of series
soi = pyleo.utils.load_dataset('SOI')
soi_time_axes = [pyleo.utils.random_time_axis(n=len(soi.time)) for _ in range(n)]
soi_ens = pyleo.EnsembleGeoSeries([pyleo.GeoSeries(time=time, value=soi.value,lat=0,lon=0,auto_time_params=True) for time in soi_time_axes])
nino3 = pyleo.utils.load_dataset('NINO3')
nino3_time_axes = [pyleo.utils.random_time_axis(n=len(nino3.time)) for _ in range(n)]
nino3_ens = pyleo.EnsembleGeoSeries([pyleo.GeoSeries(time=time, value=nino3.value,lat=0,lon=0,auto_time_params=True) for time in nino3_time_axes])
mul_ens = pyleo.MulEnsGeoSeries([nino3_ens,soi_ens])
mcpca = mul_ens.mcpca(nsim=10,seed=42)
mcpca.screeplot()'''

Expand Down
3 changes: 1 addition & 2 deletions pyleoclim/core/multiplegeoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ def __init__(self, series_list, time_unit=None, label=None):

super().__init__(series_list, time_unit, label)

# ============ MAP goes here ================

def map(self, marker='archiveType', hue='archiveType', size=None, cmap=None,
edgecolor='k', projection='auto',
proj_default=True, crit_dist=5000, colorbar=True,color_scale_type=None,
background=True, borders=False, coastline=True,rivers=False, lakes=False, land=True,ocean=True,
figsize=None, fig=None, scatter_kwargs=None, gridspec_kwargs=None, legend=True, gridspec_slot=None,
lgd_kwargs=None, savefig_settings=None, **kwargs):
'''
'''Mapping of the collection of GeoSeries objects.
Parameters
Expand Down
3 changes: 0 additions & 3 deletions pyleoclim/core/multipleseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,6 @@ def stripes(self, cmap = 'RdBu_r', sat=1.0, ref_period=None,
figsize : list
a list of two integers indicating the figure size (in inches)
sat : float > 0
Controls the saturation of the colormap normalization by scaling the vmin, vmax in https://matplotlib.org/stable/tutorials/colors/colormapnorms.html
default = 1.0
Expand All @@ -1941,15 +1940,13 @@ def stripes(self, cmap = 'RdBu_r', sat=1.0, ref_period=None,
flag indicating whether or not the x-axis should be shown (default = False)
savefig_settings : dictionary
the dictionary of arguments for plt.savefig(); some notes below:
- 'path' must be specified; it can be any existing or non-existing path,
with or without a suffix; if the suffix is not given in 'path', it will follow 'format'
- 'format' can be one of {"pdf", 'eps', 'png', ps'} The default is None.
time_unit : str
the target time unit, possible inputs:
{
'year', 'years', 'yr', 'yrs',
Expand Down
10 changes: 4 additions & 6 deletions pyleoclim/core/multivardecomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,10 @@ def modeplot(self, index=0, figsize=[8, 8], fig=None, savefig_settings=None,gs=N
hue='EOF', marker=None, size=None, scatter_kwargs=None,
flip = False, map_kwargs=None, gridspec_kwargs=None):

''' Dashboard visualizing the properties of a given mode, including:
1. The temporal coefficient (PC or similar)
2. its spectrum
3. The loadings (EOF or similar), possibly geolocated. If the object
does not have geolocation information, a spaghetti plot of the standardized
series is displayed.
'''Dashboard visualizing the properties of a given mode.
Includes: The temporal coefficient (PC or similar), its spectrum, and the loadings (EOF or similar), possibly geolocated.
If the object does not have geolocation information, a spaghetti plot of the standardized series is displayed.
Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions pyleoclim/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def to_csv(self, metadata_header=True, path = None):
-------
None
See Also
See also
--------
pyleoclim.Series.from_csv
Expand Down Expand Up @@ -513,7 +513,7 @@ def from_csv(cls, path):
Series
pyleoclim Series object containing data and metadata.
See Also
See also
--------
pyleoclim.Series.to_csv
Expand Down

0 comments on commit a58623f

Please sign in to comment.