Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/NCAR/geocat-comp into custo…
Browse files Browse the repository at this point in the history
…m_season_climatology
  • Loading branch information
jukent committed Jun 28, 2023
2 parents 6114616 + 42897c1 commit 8dafa35
Show file tree
Hide file tree
Showing 39 changed files with 266 additions and 494 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ apply to this PR, comment it out or delete it. -->

**Functionality**
- [ ] Function is in appropriate module file
- [ ] New function(s) intended for public API added to `src/geocat/comp/__init__.py` file
- [ ] New function(s) intended for public API added to `geocat/comp/__init__.py` file

**Testing**
- [ ] Tests for function exists in associated module test file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest"]
python-version: [ "3.8", "3.9", "3.10" ]
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest"]
python-version: [ "3.8", "3.9", "3.10" ]
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Run Coverage Tests
run: |
python -m pytest test -v --cov=./src/geocat/comp --cov-report=xml
python -m pytest test -v --cov=./geocat/comp --cov-report=xml
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3.1.4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upstream-dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
- name: Running Tests
run: |
python -m pytest test -v --cov=./src/geocat/comp --cov-report=xml
python -m pytest test -v --cov=./geocat/comp --cov-report=xml
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/build/

# Dask
/src/geocat/comp/dask-worker-space/
geocat/comp/dask-worker-space/


# Created by https://www.gitignore.io/api/python,intellij,intellij+all,intellij+iml
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/mirrors-yapf # To format the code to conform YAPF
rev: v0.31.0
- repo: https://github.com/google/yapf # To format the code to conform YAPF
rev: v0.33.0
hooks:
- id: yapf
args: ['--in-place', '--recursive', '--style', 'google']
Expand Down
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ build:
python: "mambaforge-4.10"
jobs:
post_create_environment:
- pip install geocat-f2py
- python -m pip install --no-cache-dir .

# Build documentation in the docs/ directory with Sphinx
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ following contribution guidelines:
# Adding new functions to the Geocat-comp repo

1. For a new function or family of functions that handle similar computations, create a new Python file in
`$GEOCATCOMP/src/geocat/comp/`.
`$GEOCATCOMP/geocat/comp/`.

2. For implementation guidelines (such as Xarray and Dask usage), please refer to:
- Previously implemented functionality as examples,
e.g. [polynomial.py](https://github.com/NCAR/geocat-comp/blob/main/src/geocat/comp/polynomial.py) or others.
e.g. [polynomial.py](https://github.com/NCAR/geocat-comp/blob/main/geocat/comp/polynomial.py) or others.
- [GeoCAT Contributor's Guide](https://geocat.ucar.edu/pages/contributing.html) for further information.

3. In any Python script under `$GEOCATCOMP/src/geocat/comp/`, there may be user API functions, which are
3. In any Python script under `$GEOCATCOMP/geocat/comp/`, there may be user API functions, which are
supposed to be included in the `geocat.comp` namespace, and internal API functions, which are used by the
user API functions as helpers, preferably starts with an underscore ("_") in their names, as well as are
not included in the `geocat.comp` namespace.

4. The user API functions should be imported in `$GEOCATCOMP/src/geocat/comp/__init__.py` to be included in
4. The user API functions should be imported in `$GEOCATCOMP/geocat/comp/__init__.py` to be included in
the namespace.

5. For appropriate documentation, each user API and internal API function should be listed in the
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include LICENSE
include README.md

recursive-include src *.py
recursive-include geocat *.py
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

Expand Down
30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ project and a single Github repository as described here. As the computational c
on geosciences data. Many of these functions originated in NCL and were translated into Python with the help of GeoCAT-comp;
however, developers are welcome to come up with novel computational functions for geosciences data.

Many of the computational functions in GeoCAT are implemented in a pure Python fashion. However,
there are some others that are implemented in Fortran but wrapped up in Python. To facilitate
contribution, the whole GeoCAT-comp structure is split into two repositories with respect to
being pure-Python or Python with compiled codes (i.e. Fortran) implementations. Such implementation
layers are handled within [GeoCAT-comp](https://github.com/NCAR/geocat-comp) and
[GeoCAT-f2py](https://github.com/NCAR/geocat-f2py) repositories, respectively (The
[GeoCAT-f2py](https://github.com/NCAR/geocat-f2py) repo is documented on its own).


# GeoCAT-comp

GeoCAT-comp repo does not explicitly contain or require any compiled code, making it more
accessible to the general Python community at large. However, if
[GeoCAT-f2py](https://github.com/NCAR/geocat-f2py) is installed, then all functions contained in
the "geocat.f2py" package are imported seamlessly into the "geocat.comp" namespace. Thus,
GeoCAT-comp repo serves as a user API to access the entire computational toolkit even though the
repo itself only contains pure Python code from the contributor’s perspective. Whenever prospective
contributors want to add new computational functionality implemented as pure Python, GeoCAT-comp
is the repo to do so. Therefore, there is no onus on contributors of pure python code to
build/compile/test any compiled code (i.e. Fortran) at GeoCAT-comp level.


# Documentation

Expand All @@ -50,15 +29,6 @@ Please see our documentation for
[installation and build instructions](https://github.com/NCAR/geocat-comp/blob/main/INSTALLATION.md).


# Xarray interface vs NumPy interface

GeoCAT-comp provides a high-level [Xarray](http://xarray.pydata.org/en/stable/) interface under the
`geocat.comp` namespace. However, a stripped-down NumPy interface is used under the hood to bridge
the gap between NumPy arrays and the compiled language data structures used by
[GeoCAT-f2py](https://github.com/NCAR/geocat-f2py). These functions are accessible under the
`geocat.comp` namespace, but are minimally documented and are
intended primarily for internal use.

# Citing GeoCAT-comp

If you use this software, please cite it as described at the [GeoCAT-comp - Citation](
Expand Down
3 changes: 1 addition & 2 deletions build_envs/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: gc-docs
channels:
- conda-forge
dependencies:
- python>=3.8, <3.11
- python>=3.9, <3.12
- pre_commit
- geocat-f2py
- geocat-datafiles
- geocat-viz
- xarray<=2023.02.0 #pin per issue #381
Expand Down
3 changes: 1 addition & 2 deletions build_envs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ name: geocat_comp_build
channels:
- conda-forge
dependencies:
- python>=3.8, <3.11 # minimum support 3.8, 3.11 not yet fully supported
- python>=3.9, <3.12 # minimum support 3.9
- cf_xarray>=0.3.1 # min version 0.3.1 for dependencies
- cftime
- dask
- distributed
- eofs
- geocat-f2py
- metpy
- numba
- numpy<1.24 # 1.24 not yet fully compatible with numba
Expand Down
3 changes: 1 addition & 2 deletions build_envs/upstream-dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ name: geocat_comp_upstream
channels:
- conda-forge
dependencies:
- python>=3.8, <3.11
- python>=3.9
- cftime
- eofs
- geocat-datafiles # for tests
- geocat-f2py
- netcdf4 # for tests
- parameterized # for tests
- pytest # for tests
Expand Down
4 changes: 1 addition & 3 deletions docs/getting_started/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,5 @@ GeoCAT-f2py
-----------
While our goal is to recreate NCL functions in pure Python, translating some NCL routines is challenging and time
consuming. To ensure GeoCAT users have access to those functions while we work on full Python versions, the Fortran code
they are based upon is wrapped in Python in the GeoCAT-f2py (Fortran 2 Python) package. GeoCAT-f2py is imported by
GeoCAT-comp and included in the GeoCAT-comp namespace. Simply, this means that GeoCAT-f2py functions can be called
through GeoCAT-comp, so there is no need for users to import GeoCAT-f2py directly in their scripts. Information about
they are based upon is wrapped in Python in the GeoCAT-f2py package. Information about
GeoCAT-f2py can be found on the `package's homepage <https://geocat-f2py.readthedocs.io/>`__.
3 changes: 0 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ the dependencies for building and testing GeoCAT-comp.
.. include:: ../build_envs/environment.yml
:literal:

Note: `GeoCAT-f2py <https://github.com/NCAR/geocat-f2py>`__ dependency will automatically
install further dependencies for compiled language implementation.


How to create a Conda environment for building GeoCAT-comp
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 0 additions & 4 deletions docs/internal_api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ Internal Functionality Helpers

geocat.comp.climatologies._calculate_center_of_time_bounds

geocat.comp.climatologies._find_time_invariant_vars

geocat.comp.climatologies._get_time_coordinate_info

geocat.comp.climatologies._infer_calendar_name

geocat.comp.climatologies._setup_clim_anom_input

geocat.comp.climatologies._validate_freq

geocat.comp.gradient._arc_lat_wgs84
Expand Down
41 changes: 40 additions & 1 deletion docs/release-notes.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.. currentmodule:: geocat.comp

.. _release:

Release Notes
=============

v2023.06.0 (Jun X, 2023)
v2023.07.0 (Jul X, 2023)
-----------------------
[Plain text summary here]

Expand All @@ -14,6 +15,42 @@ New Features


v2023.05.0 (May 4, 2023)
--------------------------
This releases fixes the unintentional limitation of the 2023.06.0 release to python 3.11.0

Bug Fixes
^^^^^^^^^
* Fix python version limit of 3.11.0 by `Anissa Zacharias`_ in (:pr:`431`)


v2023.06.0 (June 23, 2023)
--------------------------
This release removes the geocat-f2py dependency. To use these functions, users
will need to install the geocat-f2py package directly. Additionally, this
release also drops support for python 3.8 and adds support for 3.11.

Documentation
^^^^^^^^^^^^^
* New *Vertically Integrated Moisture Flux Convergence* (VIMFC) example by `Julia Kent`_ in (:pr:`388`)

Internal Changes
^^^^^^^^^^^^^^^^
* Updates deprecated pre-commit YAPF repository from https://github.com/pre-commit/mirrors-yapf to https://github.com/google/yapf by `Anissa Zacharias`_ in (:pr:`417`)
* Reconfigures package structure to remove top level ``src/`` directory by `Anissa Zacharias`_ in (:pr:`419`)

Breaking Changes
^^^^^^^^^^^^^^^^
* Removed deprecated functions ``climatology`` and ``anomaly`` by `Anissa Zacharias`_ in (:pr:`416`)
* Removed internal functions ``_find_time_invariant_vars`` and ``_setup_clim_anom_input`` by `Anissa Zacharias`_ in (:pr:`416`)
* Dropped support for python 3.8 (and added support for python 3.11) by `Anissa Zacharias`_ in (:pr:`426`)
* Removed ``geocat-f2py`` dependency by `Anissa Zacharias`_ in (:pr:`421`)

Bug Fixes
^^^^^^^^^
* Fix bug in `_temp_extrapolate` used by `interp_hybrid_to_pressure` by `Katelyn FitzGerald`_ in (:pr:`422`)


v2023.05.0 (4 May 2023)
-----------------------
In this release, we've added support for numpy input and other improvements to the gradient function

Expand Down Expand Up @@ -75,6 +112,7 @@ Deprecations
^^^^^^^^^^^^
* Remove deprecated functions from v2022.10.0 by `Heather Craker`_ in (:pr:`357`)
* Remove links to deleted function docs by `Heather Craker`_ in (:pr:`359`)

Bug Fixes
^^^^^^^^^
* Partial fix for _vertical_remap_extrap bug by `Heather Craker`_ in (:pr:`360`)
Expand Down Expand Up @@ -193,3 +231,4 @@ Maintenance
.. _`Alea Kootz`: https://github.com/pilotchute
.. _`Mario Rodriguez`: https://github.com/marodrig
.. _`Julia Kent`: https://github.com/jukent
.. _`Katelyn FitzGerald`: https://github.com/kafitzgerald
36 changes: 11 additions & 25 deletions docs/user_api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,6 @@ Statistics
eofunc_pcs
pearson_r


GeoCAT-comp routines from GeoCAT-f2py
-------------------------------------
.. currentmodule:: geocat.comp
.. autosummary::
:nosignatures:
:toctree: ./generated/

grid_to_triple
linint1
linint2
linint2pts
moc_globe_atl
rcm2points
rcm2rgrid
rgrid2rcm
triple_to_grid

NCL Function Name Wrappers
--------------------------
.. currentmodule:: geocat.comp
Expand All @@ -118,15 +100,19 @@ NCL Function Name Wrappers

meteorology.dpres_plev


Deprecated Functions
--------------------
Climatologies
^^^^^^^^^^^^^
.. currentmodule:: geocat.comp.climatologies
---------------------
.. currentmodule:: geocat.comp.deprecated
.. autosummary::
:nosignatures:
:toctree: ./generated/

anomaly
climatology
grid_to_triple
linint1
linint2
linint2pts
moc_globe_atl
rcm2points
rcm2rgrid
rgrid2rcm
triple_to_grid
File renamed without changes.
57 changes: 57 additions & 0 deletions geocat/comp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# move functions into geocat.comp namespace
from .climatologies import (
month_to_season,
calendar_average,
climatology_average,
climate_anomaly,
)
from .fourier_filters import (
fourier_band_block,
fourier_band_pass,
fourier_filter,
fourier_high_pass,
fourier_low_pass,
)
from .gradient import gradient, _arc_lon_wgs84, _arc_lat_wgs84, _rad_lat_wgs84
from .interpolation import (
interp_hybrid_to_pressure,
interp_sigma_to_hybrid,
interp_multidim,
)
from .meteorology import (
dewtemp,
heat_index,
relhum,
relhum_ice,
relhum_water,
actual_saturation_vapor_pressure,
max_daylight,
psychrometric_constant,
saturation_vapor_pressure,
saturation_vapor_pressure_slope,
delta_pressure,
dpres_plev,
)
from .spherical import decomposition, recomposition, scale_voronoi
from .stats import eofunc, eofunc_eofs, eofunc_pcs, eofunc_ts, pearson_r
from .deprecated import (
grid_to_triple,
linint1,
linint2,
linint2pts,
moc_globe_atl,
rcm2points,
rcm2rgrid,
rgrid2rcm,
triple_to_grid,
)

# get version from pyproject.toml
from importlib.metadata import version as _version

try:
__version__ = _version("geocat.comp")
except Exception:
# Local copy or not installed with setuptools.
# Disable minimum version checks on downstream libraries.
__version__ = "999"
Loading

0 comments on commit 8dafa35

Please sign in to comment.