Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
zhonghua-zheng committed Feb 22, 2021
1 parent bd59363 commit 4315c71
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pyEOF is a **Python** package for `EOF and Rotated EOF Analysis <https://climate
- `sklearn.decomposition.PCA <https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html>`_ (for EOF)
- `Advanced Priniciple Component Analysis <https://github.com/alfredsasko/advanced-principle-component-analysis>`_ (for varimax rotation // varimax rotated EOF // REOF)


Installation
------------

Expand All @@ -43,4 +42,14 @@ Step 2: install using pip::

$ git clone https://github.com/zzheng93/pyEOF.git
$ cd pyEOF
$ python setup.py install
$ python setup.py install

How to use it?
--------------
You may reproduce the jupyter notebook example on `Binder <https://mybinder.org/v2/gh/zzheng93/pyEOF/HEAD?filepath=docs%2Fnotebooks>`_.

Please check `online documentation <https://pyeof.readthedocs.io/en/latest/>`_ for more information.

How to ask for help
-------------------
The `GitHub issue tracker <https://github.com/zzheng93/pyEOF/issues>`_ is the primary place for bug reports.
53 changes: 31 additions & 22 deletions pyEOF/pyEOF.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ def get_time_space(df, time_dim, lumped_space_dims):
Parameters
----------
df : A `pandas.core.frame.DataFrame`, e.g.,
df : pandas.core.frame.DataFrame
| time | lat | lon | PM2.5 |
| 2011 | 66 | 88 | 22 |
| 2011 | 66 | 99 | 23 |
| 2012 | 66 | 88 | 24 |
| 2012 | 66 | 99 | 25 |
time_dim: time dim name (str), e.g., "time"
time_dim:
time dim name (str), e.g., "time"
lumped_space_dims: a list of the lumped space, e.g., ["lat","lon"]
lumped_space_dims:
a list of the lumped space, e.g., ["lat","lon"]
Returns
-------
dataframe with [row (e.g.,time), column (e.g, space)], e.g.,
dataframe:
with [row (e.g.,time), column (e.g, space)], e.g.,
| time | loc1 | loc2 |
| | (66,88) | (66,99) |
| 2011 | 22 | 24 |
Expand All @@ -49,12 +52,14 @@ def __init__(self, df, pca_type=None, n_components=None, scaler=True):
Parameters
----------
df : A `pandas.core.frame.DataFrame`
df :
A `pandas.core.frame.DataFrame`
dim: [row (e.g.,time), column (e.g, space)]
Returns
-------
pca : A `df_eof` instance.
pca :
A `df_eof` instance.
"""
if scaler is True:
Expand Down Expand Up @@ -101,19 +106,19 @@ def pcs(self, s=0, n=1, prefix="PC"):
Parameters
----------
s : Scaling
s :
Scaling
0 : Un-scaled PCs (default).
1 : PCs are divided by the square-root
of the eigenvalue
2 : PCs are multiplied by the square-root
of the eigenvalue.
1 : PCs are divided by the square-root of the eigenvalue.
2 : PCs are multiplied by the square-root of the eigenvalue.
n :
Number of PCs to retrieve.
Returns
-------
pcs: A dataframe [time, PCs]
pcs:
A dataframe [time, PCs]
"""

Expand Down Expand Up @@ -143,19 +148,19 @@ def eofs(self, s=0, n=1, prefix="EOF"):
Parameters
----------
s : Scaling
s :
Scaling
0 : Un-scaled PCs (default).
1 : PCs are divided by the square-root
of the eigenvalue
2 : PCs are multiplied by the square-root
of the eigenvalue.
1 : PCs are divided by the square-root of the eigenvalue.
2 : PCs are multiplied by the square-root of the eigenvalue.
n :
Number of EOFs to retrieve.
Returns
-------
eofs : A dataframe [PCs, space]
eofs :
A dataframe [PCs, space]
"""

Expand Down Expand Up @@ -185,11 +190,13 @@ def eigvals(self, n=1):
Parameters
----------
n : Number of Eigenvalues to retrieve.
n :
Number of Eigenvalues to retrieve.
Returns
-------
eigvals : A numpy array of Eigenvalue(s)
eigvals :
A numpy array of Eigenvalue(s)
"""

Expand All @@ -201,11 +208,13 @@ def evf(self, n=1):
Parameters
----------
n : Number of PCs to retrieve.
n :
Number of PCs to retrieve.
Returns
-------
evf : A numpy array of variance explained by each of the selected components
evf :
A numpy array of variance explained by each of the selected components
"""

Expand Down

0 comments on commit 4315c71

Please sign in to comment.