Skip to content

Commit

Permalink
Revert "Merge branch 'master' of github.com-csyhuang:csyhuang/hn2016_…
Browse files Browse the repository at this point in the history
…falwa"

This reverts commit 546d634, reversing
changes made to 725d8fc.
  • Loading branch information
csyhuang committed Aug 17, 2024
1 parent 546d634 commit 38da93b
Show file tree
Hide file tree
Showing 37 changed files with 163 additions and 240 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/python-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand All @@ -26,11 +26,15 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
python -m pip install flake8 pytest
python -m pip install coverage
python -m pip install -U pytest
python -m pip install --upgrade pip setuptools wheel
sudo apt-get install gfortran
python -m pip install .[test]
python -m pip install scipy==1.11.2
python -m pip install xarray==2024.1.1
python -m pip install numpy==1.24.4
python setup.py develop
- name: Test with pytest
run: |
coverage run -m pytest -k "not output_results"
Expand Down
11 changes: 7 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
import os
import sys
# Need to fix the issue below
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../../src/")
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../../src/falwa/")
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../../")
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../../falwa/")

# import sphinx_rtd_theme


autodoc_mock_imports = [
"matplotlib", # for plot_utils.py
Expand Down Expand Up @@ -76,9 +79,9 @@
# built documents.
#
# The short X.Y version.
version = u'2.0.0'
version = u'1.3.0'
# The full version, including alpha/beta/rc tags.
release = u'2.0.0'
release = u'1.3.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
41 changes: 25 additions & 16 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ extreme weather events. It implements the finite-amplitude local wave activity a
Package Installation
------------------------------

**Attention: substantial changes took place in release v2.0.0. Installation in develop mode is no longer available.**
This current version works for Python 3.x. Note that since v0.3.0, some functions have backend in Fortran. To build the package from source, you need a fortran compiler (e.g. `gfortran <http://hpc.sourceforge.net/>`_) to implement the installation.

Since release v2.0.0, the F2PY modules in `falwa` is compiled with `meson` (See Issue #95 for details) to cope with the deprecation of `numpy.disutils` in python 3.12.
Since the package is still being actively developed, please use the *develop* mode for installation.

### First-time installation
To install the package for the first time, clone the GitHub repo and install via `develop` mode:::

1. To build the package from source, you need a fortran compiler (e.g., [gfortran](http://hpc.sourceforge.net/)) to implement the installation.
2. Clone the package repo by `git clone https://github.com/csyhuang/hn2016_falwa.git` .
3. Navigate into the repository and set up a python environment satisfying the installation requirement by `conda env create -f environment.yml`. The environment name in the file is set to be `falwa_env` (which users can change).
4. Install the package with the command `python -m pip install .`
5. If the installation is successful, you should be able to run through all unit tests in the folder `tests/` by executing `pytest tests/`.
git clone https://github.com/csyhuang/hn2016_falwa.git
cd falwa
python setup.py develop

### Get updated code from new releases

1. To incorporate updates, first, pull the new version of the code from GitHub by `git pull`.
2. Uninstall existing version of `falwa`: `pip uninstall falwa`
3. If there is change in `environment.yml`, remove the existing environment by `conda remove --name falwa_env --all` and create the environment again from the updated YML file: `conda env create -f environment.yml`.
4. Reinstall the updated version by `python -m pip install .`.
5. Run through all unit tests in the folder `tests/` by executing `pytest tests/` to make sure the package has been properly installed.
To incorporate updates, pull the new version of the code from GitHub. Remove any existing f2py modules and recompile.::

# Assume you are already in the falwa/ repo
git pull
rm falwa/*.so
python setup.py develop
pytest tests/ # to check if the package can be run properly


Quick start
-----------------------------------------
Expand All @@ -51,12 +51,21 @@ Depending on what you want to do, the methods to be use may be different.

2. If you want to compute zonal wind reference states and wave activity fluxes in QG Formalism, look at `notebooks/nh2018_science/demo_script_for_nh2018.ipynb` for the usage of `QGField`. This notebook demonstrates how to compute wave activity and reference states presented in Nakamura and Huang (2018). To make sure the package is properly installed in your environment, run through the notebook after installation to see if there is error.

THe conda environment for running the notebook can be found in `environment.yml`. To create the conda environment, execute:::

conda env create -f environment.yml




Issues Reporting
------------------------------

- If you are interested in getting email message related to update of this package, please leave your contact `here <https://goo.gl/forms/5L8fv0mUordugq6v2>`_ such that I can keep you updated of any changes made.
- If you are interested in using the package, please leave your contact `here <https://goo.gl/forms/5L8fv0mUordugq6v2>`_ or email me([email protected]) such that I can keep you updated of any changes made.

- If you encounter *coding issues/bugs* when using the package, please create an `Issue ticket <https://github.com/csyhuang/hn2016_falwa/issues>`_.
- If you have scientific questions, please create a thread in the `Discussion Board <https://github.com/csyhuang/hn2016_falwa/discussions>`_ with the category "General" or "Q&A" according to the circumstance.

- If you have scientific questions, please contact Clare S. Y. Huang via email([email protected]).

Modules
========
Expand Down
20 changes: 9 additions & 11 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ channels:
- defaults

dependencies:
- python=3.12
- numpy=1.26.4
- scipy=1.14.0
- netCDF4=1.6.5
- cftime=1.6.2
- xarray=2024.1.1
- python=3.10
- numpy=1.22.3
- scipy=1.9
- pytest=7.4.0
- matplotlib=3.8.2
- cartopy=0.22.0
- xarray=2023.2.0
- netCDF4=1.5.8
- gridfill
- jupyter
- pip
# - twine
# - gridfill
- matplotlib
- twine
- cartopy
# Other useful packages to visualize plots in notebooks
# - cartopy
2 changes: 1 addition & 1 deletion src/falwa/__init__.py → falwa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Author: Clare Huang, Christopher Polster
"""

__version__ = "2.0.0"
__version__ = "1.3.0"
from .compute_qgpv import compute_qgpv
from .compute_qgpv_direct_inv import compute_qgpv_direct_inv
from .compute_qref_and_fawa_first import compute_qref_and_fawa_first
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/falwa/xarrayinterface.py → falwa/xarrayinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def other_shape(self):
@property
def other_size(self):
"""Size of non-core dimensions"""
return np.prod(self.other_shape)
return np.product(self.other_shape)

# numpy convenience functions

Expand Down Expand Up @@ -358,7 +358,7 @@ def __init__(self, da_u, da_v=None, da_t=None, *, var_names=None,
# fields. These dimensions are restored in the output datasets.
other_dims = da_u.dims[:-3]
other_shape = tuple(da_u[dim].size for dim in other_dims)
other_size = np.prod(other_shape, dtype=np.int64)
other_size = np.product(other_shape, dtype=np.int64)
_shape = (other_size, *da_u.shape[-3:])
# Extract value arrays and collapse all additional dimensions
u = da_u.data.reshape(_shape)
Expand Down
16 changes: 0 additions & 16 deletions meson.build

This file was deleted.

55 changes: 1 addition & 54 deletions notes/developer/pip_deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,5 @@ Deploy the package onto PyPI for real:
```
python3 -m twine upload dist/*
```
# Update of deployment after using pyproject.toml

```
pip install build
python -m build . --sdist
python3 -m pip install --upgrade twine
python3 -m twine upload --repository testpypi dist/*
```



```error
clare@otc:~/isolated_test/hn2016_falwa$ python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps falwa
Looking in indexes: https://test.pypi.org/simple/
Collecting falwa
Downloading https://test-files.pythonhosted.org/packages/b1/0c/00cd0cd844c7d5c2faed03b3a1051de15e42afabe128783c1b9eb8239651/falwa-1.4.0a0.tar.gz (46.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.5/46.5 MB 625.8 kB/s eta 0:00:00
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
Looking in indexes: https://test.pypi.org/simple/
Collecting numpy
Downloading https://test-files.pythonhosted.org/packages/d5/80/b947c574d9732e39db59203f9aa35cb4d9a5dd8a0ea2328acb89cf10d6e3/numpy-1.9.3.zip (4.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 714.2 kB/s eta 0:00:00
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting meson-python
Downloading https://test-files.pythonhosted.org/packages/c9/b6/9665154ee9926317a248e2b171ea21ac2b77788adea404566eec29b84f3b/meson_python-0.13.0-py3-none-any.whl.metadata (4.1 kB)
Collecting meson>=0.63.3 (from meson-python)
Downloading https://test-files.pythonhosted.org/packages/ae/c6/e3c2fa2fc539ca99679f02b05700b56c76ffb9338c1dd62f1c64391828ba/meson-1.1.991-py3-none-any.whl.metadata (1.8 kB)
INFO: pip is looking at multiple versions of meson-python to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement pyproject-metadata>=0.7.1 (from meson-python) (from versions: none)
ERROR: No matching distribution found for pyproject-metadata>=0.7.1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
```

Successfully installed from `.tar.gz`:

```bash
conda install anaconda::pip
python3 -m pip install falwa-1.4.0a0.tar.gz
pytest tests/
```

39 changes: 0 additions & 39 deletions pyproject.toml

This file was deleted.

44 changes: 25 additions & 19 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Python Library: falwa (v2.0.0)
## Python Library: falwa (v1.3.0)

[![Python package](https://github.com/csyhuang/hn2016_falwa/actions/workflows/python-build-test.yml/badge.svg)](https://github.com/csyhuang/hn2016_falwa/actions/workflows/python-build-test.yml)[![codecov.io](https://codecov.io/gh/csyhuang/hn2016_falwa/branch/master/graph/badge.svg)](https://codecov.io/gh/csyhuang/hn2016_falwa)[![Documentation Status](https://readthedocs.org/projects/hn2016-falwa/badge/?version=latest)](http://hn2016-falwa.readthedocs.io/en/latest/?badge=latest)[![DOI](https://zenodo.org/badge/63908662.svg)](https://zenodo.org/badge/latestdoi/63908662)

Expand All @@ -15,25 +15,25 @@ Compute from gridded climate data the Finite-amplitude Local Wave Activity (FALW

## Package Installation

**Attention: substantial changes took place in release v2.0.0. Installation in develop mode is no longer available.**
This current version works for Python 3.x. Note that since v0.3.0, some functions have backend in Fortran. To build the package from source, you need a fortran compiler (e.g. [gfortran](http://hpc.sourceforge.net/)) to implement the installation.

Since release v2.0.0, the F2PY modules in `falwa` is compiled with `meson` (See Issue #95 for details) to cope with the deprecation of `numpy.disutils` in python 3.12.
Since the package is still being actively developed, please use the *develop* mode for installation.

### First-time installation
To install the package for the first time, clone the GitHub repo and install via `develop` mode:
```
git clone https://github.com/csyhuang/hn2016_falwa.git
cd hn2016_falwa
python setup.py develop
```

1. To build the package from source, you need a fortran compiler (e.g., [gfortran](http://hpc.sourceforge.net/)) to implement the installation.
2. Clone the package repo by `git clone https://github.com/csyhuang/hn2016_falwa.git` .
3. Navigate into the repository and set up a python environment satisfying the installation requirement by `conda env create -f environment.yml`. The environment name in the file is set to be `falwa_env` (which users can change).
4. Install the package with the command `python -m pip install .`
5. If the installation is successful, you should be able to run through all unit tests in the folder `tests/` by executing `pytest tests/`.

### Get updated code from new releases

1. To incorporate updates, first, pull the new version of the code from GitHub by `git pull`.
2. Uninstall existing version of `falwa`: `pip uninstall falwa`
3. If there is change in `environment.yml`, remove the existing environment by `conda remove --name falwa_env --all` and create the environment again from the updated YML file: `conda env create -f environment.yml`.
4. Reinstall the updated version by `python -m pip install .`.
5. Run through all unit tests in the folder `tests/` by executing `pytest tests/` to make sure the package has been properly installed.
To incorporate updates, pull the new version of the code from GitHub. Remove any existing f2py modules and recompile.
```
# Assume you are already in the hn2016_falwa/ repo
git pull
rm falwa/*.so
python setup.py develop
pytest tests/ # to check if the package can be run properly
```

## Quick start

Expand All @@ -46,8 +46,14 @@ Depending on what you want to do, the methods to be use may be different.

2. If you want to compute zonal wind reference states and wave activity fluxes in QG Formalism, look at `notebooks/nh2018_science/demo_script_for_nh2018.ipynb` for the usage of `QGField`. This notebook demonstrates how to compute wave activity and reference states presented in Nakamura and Huang (2018). To make sure the package is properly installed in your environment, run through the notebook after installation to see if there is error.

THe conda environment for running the notebook can be found in `environment.yml`. To create the conda environment, execute:

```bash
conda env create -f environment.yml
```

## Inquiries / Issues reporting

- If you are interested in getting email message related to update of this package, please leave your contact [here](https://goo.gl/forms/5L8fv0mUordugq6v2) such that I can keep you updated of any changes made.
- If you are interested in using the package, please leave your contact [here](https://goo.gl/forms/5L8fv0mUordugq6v2) or email me([email protected]) such that I can keep you updated of any changes made.
- If you encounter *coding issues/bugs* when using the package, please create an [Issue ticket](https://github.com/csyhuang/hn2016_falwa/issues).
- If you have scientific questions, please create a thread in the [Discussion Board](https://github.com/csyhuang/hn2016_falwa/discussions) with the category "General" or "Q&A" according to the circumstance.
- If you have scientific questions, please contact Clare S. Y. Huang via email(csyhuang@uchicago.edu).
Loading

0 comments on commit 38da93b

Please sign in to comment.